implementazione ricerca avanzata, in progress
This commit is contained in:
parent
415691f7fc
commit
8f66ce7848
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, getFormaCntxt, getListaIdCommenti} from './dataMgr.js';
|
||||
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, getFormaCntxt, getListaIdCommenti} from './dataMgr_5.0.js';
|
||||
import { getJsonQuery, emptyStructCard } from './script_5.0.js';
|
||||
import {resetGraphStr} from './syntgraph_5.0.js'
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import {numeroContesti, resetResult, showOffset} from './browseMgr_5.0.js'
|
||||
import { resetGraphStr } from './syntgraph_5.0.js';
|
||||
import { getAutoriFontiCitazioniS, getCommentatoriS, getAreeTematicheS, getFontiS} from './dataMgr.js';
|
||||
import { getAutoriFontiCitazioniS, getCommentatoriS, getAreeTematicheS, getFontiS} from './dataMgr_5.0.js';
|
||||
|
||||
export var getJsonQuery;
|
||||
export var fillStructCard;
|
||||
|
|
|
@ -413,7 +413,7 @@ function buildSPQuery(guiquery) {
|
|||
parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where)
|
||||
|
||||
}
|
||||
if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase'|| theguiQ['unitaRicerca'] == 'verso') {
|
||||
if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
||||
multipleCondSpQuery.where.push(bindConcatStatement)
|
||||
multipleCondSpQuery.where.push(occBindConcatStatement)
|
||||
|
||||
|
@ -444,7 +444,7 @@ function buildSQ(stquery) {
|
|||
buildSPQuery(stquery)
|
||||
return multipleCondSpQuery;
|
||||
}
|
||||
|
||||
var clausolaS='Clausola0'
|
||||
if (stquery['QueryAvanzata'] == 1 && stquery['EsprLogica'] != null && stquery['EsprLogica'] != '' && stquery['EsprLogica'].length == 1) {
|
||||
clause = stquery['EsprLogica']
|
||||
|
||||
|
@ -452,8 +452,8 @@ function buildSQ(stquery) {
|
|||
|
||||
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != '.+') ||
|
||||
stquery[clause]['functionSyntax'].trim() != '.+') &&
|
||||
stquery[clause]['typeGramm0'].trim() == 'all') {//solo filtro sintattico
|
||||
stquery[clause]['functionSyntax'].trim() != '.+') &&
|
||||
stquery[clause]['typeGramm0'].trim() == 'all') {//solo filtro sintattico
|
||||
parsedquery = parser.parse(ontoSparqlQuerySynt);
|
||||
var tempsyntquery = buildSintacticClause(stquery[clause], parsedquery, 2)
|
||||
if (filtroContesto.length > 0) {
|
||||
|
@ -463,8 +463,8 @@ function buildSQ(stquery) {
|
|||
}
|
||||
return tempsyntquery
|
||||
}
|
||||
if ((stquery[clause]['typeSyntax0'].trim() == '.+' && stquery[clause]['functionSyntax'].trim() == '.+') &&
|
||||
stquery[clause]['typeGramm0'].trim() != 'all') {//solo filtro grammaticale
|
||||
if ((stquery[clause]['typeSyntax0'].trim() == '.+' && stquery[clause]['functionSyntax'].trim() == '.+') &&
|
||||
stquery[clause]['typeGramm0'].trim() != 'all') {//solo filtro grammaticale
|
||||
myquery = buildClause(stquery[clause], parsedquery, 2)
|
||||
if (filtroContesto.length > 0) {
|
||||
for (tmpc of filtroContesto) {
|
||||
|
@ -481,51 +481,53 @@ function buildSQ(stquery) {
|
|||
return (myquery)
|
||||
}
|
||||
|
||||
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != '.+') ||
|
||||
(stquery[clause]['functionSyntax'].trim() != '' && stquery[clause]['functionSyntax'].trim() != '.+')) &&
|
||||
stquery[clause]['typeGramm0'].trim() != 'all') {//entrambi i filtri
|
||||
console.log('entrambi i filtri')
|
||||
//preparo la query sparql
|
||||
var tmpCont=stquery[clause]['contesto']
|
||||
var tmpCl0=stquery['Clausola0']
|
||||
var tmpUnric=stquery['unitaRicerca']
|
||||
|
||||
var tmpCl2= {
|
||||
"queryText": stquery[clause]["queryText"],
|
||||
"lemma_forma": stquery[clause]["lemma_forma"],
|
||||
"opzioni_testo": stquery[clause]["opzioni_testo"],
|
||||
"TipoClausola": "Sintattico",
|
||||
"Attiva": "1",
|
||||
"typeSyntax0": stquery[clause]["typeSyntax0"],
|
||||
"functionSyntax": stquery[clause]["functionSyntax"],
|
||||
"contesto": tmpCont
|
||||
}
|
||||
|
||||
var tmpCl1J=stquery['Clausola1']
|
||||
//var tmpCl1J= JSON.parse(tC1);
|
||||
delete tmpCl1J['typeSyntax0'];
|
||||
delete tmpCl1J['functionSyntax'];
|
||||
tmpCl1J["TipoClausola"]="Grammaticale"
|
||||
var tmpJ={
|
||||
"EsprLogica": ["(","AND","Clausola1","Clausola2",")"],
|
||||
"LogicaGui": ["(","AND","Clausola1","Clausola2",")"],
|
||||
"QueryAvanzata": "1",
|
||||
"unitaRicerca": tmpUnric,
|
||||
"LiDaVersion": "1.0",
|
||||
"Clausola0": tmpCl0,
|
||||
"Clausola1":tmpCl1J,
|
||||
"Clausola2": tmpCl2
|
||||
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != '.+') ||
|
||||
(stquery[clause]['functionSyntax'].trim() != '' && stquery[clause]['functionSyntax'].trim() != '.+')) &&
|
||||
stquery[clause]['typeGramm0'].trim() != 'all') {//entrambi i filtri
|
||||
console.log('entrambi i filtri')
|
||||
//preparo la query sparql
|
||||
var tmpCont = stquery[clause]['contesto']
|
||||
var tmpCl0 = stquery['Clausola0']
|
||||
var tmpUnric = stquery['unitaRicerca']
|
||||
|
||||
var tmpCl2 = {
|
||||
"queryText": stquery[clause]["queryText"],
|
||||
"lemma_forma": stquery[clause]["lemma_forma"],
|
||||
"opzioni_testo": stquery[clause]["opzioni_testo"],
|
||||
"TipoClausola": "Sintattico",
|
||||
"Attiva": "1",
|
||||
"typeSyntax0": stquery[clause]["typeSyntax0"],
|
||||
"functionSyntax": stquery[clause]["functionSyntax"],
|
||||
"contesto": tmpCont
|
||||
}
|
||||
|
||||
var tmpCl1J = stquery['Clausola1']
|
||||
//var tmpCl1J= JSON.parse(tC1);
|
||||
delete tmpCl1J['typeSyntax0'];
|
||||
delete tmpCl1J['functionSyntax'];
|
||||
tmpCl1J["TipoClausola"] = "Grammaticale"
|
||||
var tmpJ = {
|
||||
"EsprLogica": ["(", "AND", "Clausola1", "Clausola2", ")"],
|
||||
"LogicaGui": ["(", "AND", "Clausola1", "Clausola2", ")"],
|
||||
"QueryAvanzata": "1",
|
||||
"unitaRicerca": tmpUnric,
|
||||
"LiDaVersion": "1.0",
|
||||
"Clausola0": tmpCl0,
|
||||
"Clausola1": tmpCl1J,
|
||||
"Clausola2": tmpCl2
|
||||
}
|
||||
console.log(tmpJ);
|
||||
buildSPQuery(tmpJ);
|
||||
return multipleCondSpQuery;
|
||||
|
||||
}
|
||||
console.log(tmpJ);
|
||||
buildSPQuery(tmpJ);
|
||||
return multipleCondSpQuery;
|
||||
|
||||
}
|
||||
if (stquery[clause]['queryText'].trim() != "")
|
||||
clausolaS=clause
|
||||
}
|
||||
//Simple query
|
||||
|
||||
filtroContestoJson = getFiltroContestoJson(JSON.parse(stquery['Clausola0']['contesto']))
|
||||
filtroContestoJson = getFiltroContestoJson(JSON.parse(stquery[clausolaS]['contesto']))
|
||||
if (filtroContestoJson.length > 0) {
|
||||
for (tmpc of filtroContestoJson) {
|
||||
//console.log(filtroContesto[0])
|
||||
|
@ -535,20 +537,20 @@ function buildSQ(stquery) {
|
|||
|
||||
}
|
||||
|
||||
if (stquery['Clausola0']['queryText'] != "" && stquery['Clausola0']['Attiva'] == 1) {
|
||||
searchtext = stquery['Clausola0']['queryText']
|
||||
if (stquery[clausolaS]['queryText'] != "" && stquery[clausolaS]['Attiva'] == 1) {
|
||||
searchtext = stquery[clausolaS]['queryText']
|
||||
let strval = "^" + searchtext.trim() + "$"
|
||||
|
||||
if (stquery['Clausola0']['opzioni_testo'] == 'parola') {
|
||||
if (stquery[clausolaS]['opzioni_testo'] == 'parola') {
|
||||
strval = "^" + searchtext.trim() + "$";
|
||||
}
|
||||
if (stquery['Clausola0']['opzioni_testo'] == 'sottostringa') {
|
||||
if (stquery[clausolaS]['opzioni_testo'] == 'sottostringa') {
|
||||
strval = searchtext.trim();
|
||||
}
|
||||
if (stquery['Clausola0']['opzioni_testo'] == 'suffisso') {
|
||||
if (stquery[clausolaS]['opzioni_testo'] == 'suffisso') {
|
||||
strval = searchtext.trim() + "$";
|
||||
}
|
||||
if (stquery['Clausola0']['opzioni_testo'] == 'prefisso') {
|
||||
if (stquery[clausolaS]['opzioni_testo'] == 'prefisso') {
|
||||
strval = "^" + searchtext.trim();
|
||||
}
|
||||
|
||||
|
@ -556,7 +558,7 @@ function buildSQ(stquery) {
|
|||
|
||||
|
||||
parsedquery.where[0].expression.args[1].value = strval;
|
||||
if (stquery['Clausola0']['lemma_forma'] == 'lemma') {
|
||||
if (stquery[clausolaS]['lemma_forma'] == 'lemma') {
|
||||
parsedquery.where[0].expression.args[0].value = "lm";
|
||||
parsedquery.where.splice(1, 1)
|
||||
parsedquery.where[1].patterns[0].triples.splice(0, 1)
|
||||
|
|
Loading…
Reference in New Issue