modifica gestione query
This commit is contained in:
parent
f3510eb14b
commit
5d0f90bc1c
|
@ -208,7 +208,7 @@ $(document).ready(function() {
|
|||
var versiContestoExp = getFormaContext(parseInt(parcid[3]), expcontextLength);
|
||||
var divVersoExp = ''
|
||||
var setVersicontestoExp = new Set()
|
||||
for (forma of versiContestoExp) {
|
||||
for (var forma of versiContestoExp) {
|
||||
if (!setVersicontestoExp.has(forma.verso)) {
|
||||
divVersoExp = createDivVersoLI(forma.cantica+1, forma.verso, forma.canto)
|
||||
$(reit).append(divVersoExp)
|
||||
|
@ -235,21 +235,21 @@ $(document).ready(function() {
|
|||
|
||||
//evidenzio risultato
|
||||
|
||||
for (ris of listarisultati) {
|
||||
for (var ris of listarisultati) {
|
||||
idris = '#e' + ris
|
||||
$(idris).addClass("font-weight-bold mark ")
|
||||
}
|
||||
|
||||
//gestisco risultati se unità di ricerca è periodo
|
||||
if (listaPeriodiRisultato.length) {
|
||||
for (msid of listaPeriodiRisultato) {
|
||||
for (var msid of listaPeriodiRisultato) {
|
||||
loadPeriodo(msid)
|
||||
|
||||
}
|
||||
}
|
||||
//gestisce risultati se unità di ricerca è frase
|
||||
if (listaClausoleRisultato.length) {
|
||||
for (clsid of listaClausoleRisultato) {
|
||||
for (var clsid of listaClausoleRisultato) {
|
||||
let tmpid = clsid.split('-')
|
||||
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
|
||||
|
||||
|
@ -325,15 +325,7 @@ $(document).ready(function() {
|
|||
if (listaClausoleRisultato.length) {
|
||||
numeroContesti = listaClausoleRisultatoContesti.length
|
||||
return (listaClausoleRisultatoContesti.length)
|
||||
/*var tempr = new Set()
|
||||
for (singleres of listaClausoleRisultato) {
|
||||
tempr.add(singleres.split('-')[0])
|
||||
}
|
||||
var myRis = []
|
||||
|
||||
tempr.forEach(y => myRis.push(listaClausoleRisultato.filter(x => (x.split('-')[0] == y) && x.split('-').length > 1)))
|
||||
numeroContesti = myRis.length
|
||||
return (myRis.length)*/
|
||||
|
||||
}
|
||||
numeroContesti = numeroRisultati
|
||||
return (numeroRisultati)
|
||||
|
@ -363,14 +355,7 @@ $(document).ready(function() {
|
|||
}
|
||||
if (listaClausoleRisultatoContesti.length && !listarisultati.length ) {
|
||||
|
||||
/*for (risultato of listaClausoleRisultatoContesti) {
|
||||
contaContesti = contaContesti + 1;
|
||||
if (contaContesti >= startcont && contaContesti < endcont) {
|
||||
res.push(risultato)
|
||||
}
|
||||
if (contaContesti > endcont)
|
||||
break;
|
||||
}*/
|
||||
|
||||
for (let i=startcont; i<=endcont; i++){
|
||||
res.push(listaClausoleRisultatoContesti[i])
|
||||
}
|
||||
|
@ -511,7 +496,7 @@ $(document).ready(function() {
|
|||
}
|
||||
//evidenzio le frasi se unità di ricerca è frase
|
||||
if (listaClausoleRisultato.length) {
|
||||
for (clsid of listaClausoleRisultato) {
|
||||
for (var clsid of listaClausoleRisultato) {
|
||||
let tmpid = clsid.split('-')
|
||||
//loadFrase(tmpid[0], tmpid[1])
|
||||
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
|
||||
|
@ -689,10 +674,10 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
function isPeriodoInCanto(idperiodo, canto) {
|
||||
datiperiodo = idperiodo.split('_')
|
||||
daticanto = canto.split('_')
|
||||
canticaprd = datiperiodo[0]
|
||||
cantoprd = datiperiodo[1]
|
||||
var datiperiodo = idperiodo.split('_')
|
||||
var daticanto = canto.split('_')
|
||||
var canticaprd = datiperiodo[0]
|
||||
var cantoprd = datiperiodo[1]
|
||||
if (canticaprd == '1' && daticanto[0].includes('Inferno'))
|
||||
return (cantoprd == daticanto[1])
|
||||
if (canticaprd == '2' && daticanto[0].includes('Purgatorio'))
|
||||
|
@ -792,7 +777,7 @@ $(document).ready(function() {
|
|||
}
|
||||
function resetDialoghi() {
|
||||
|
||||
for (mk in dialogspeakers) {
|
||||
for (var mk in dialogspeakers) {
|
||||
//console.log (mk+' '+dialogspeakers[mk])
|
||||
$(cantoDisplayed).find(' .' + dialogspeakers[mk]).each(function() {
|
||||
$(this).removeClass(dialogspeakers[mk]);
|
||||
|
@ -842,7 +827,7 @@ $(document).ready(function() {
|
|||
|
||||
//evidenzio i periodi se unità di ricerca è impostato come periodo
|
||||
if (listaPeriodiRisultato.length) {
|
||||
for (msid of listaPeriodiRisultato) {
|
||||
for (var msid of listaPeriodiRisultato) {
|
||||
//if (isPeriodoInCanto(msid, cantoDisplayed))
|
||||
loadPeriodo(msid)
|
||||
|
||||
|
@ -851,7 +836,7 @@ $(document).ready(function() {
|
|||
}
|
||||
//evidenzio le frasi se unità di ricerca è frase
|
||||
if (listaClausoleRisultato.length) {
|
||||
for (clsid of listaClausoleRisultato) {
|
||||
for (var clsid of listaClausoleRisultato) {
|
||||
if (isPeriodoInCanto(clsid, cantoDisplayed)) {
|
||||
let tmpid = clsid.split('-')
|
||||
//loadFrase(tmpid[0], tmpid[1])
|
||||
|
@ -1288,26 +1273,11 @@ $(document).ready(function() {
|
|||
divFrammAnnot.appendTo(collapse);
|
||||
}
|
||||
|
||||
/* function hasComments(cid) {
|
||||
var id = cid.substr(9);
|
||||
for (var pos in commentsArray) {
|
||||
var comments = commentsArray[pos]
|
||||
if (comments.verso == id) {
|
||||
//console.log(comments)
|
||||
return (true)
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}*/
|
||||
|
||||
|
||||
function hasCommentsJson(cid) {
|
||||
|
||||
//return commentsJson.hasOwnProperty(cid.substr(9));
|
||||
//var id = cid.substr(9);
|
||||
/*for (const [key, value] of Object.entries(commentsJson)) {
|
||||
if (key == id || key.startsWith(id + '-'))
|
||||
return true
|
||||
}*/
|
||||
|
||||
var id = cid.split('_').at(-1)
|
||||
for (const [keyt, value] of Object.entries(commentsSQL)) {
|
||||
if (keyt == id || keyt.startsWith(id+'-')) {
|
||||
|
@ -1325,12 +1295,7 @@ $(document).ready(function() {
|
|||
*/
|
||||
function numberOfCommentsJson(cid) {
|
||||
var cntc = 0
|
||||
/*var id = cid.substr(9);
|
||||
for (const [key, value] of Object.entries(commentsJson)) {
|
||||
if (key == id || key.startsWith(id + '-'))
|
||||
cntc += commentsJson[key].length
|
||||
}*/
|
||||
//
|
||||
|
||||
var id=cid.split('_').at(-1)
|
||||
for (const keyt in commentsSQL){
|
||||
if (keyt==id) {
|
||||
|
@ -1470,7 +1435,7 @@ $(document).ready(function() {
|
|||
|
||||
});
|
||||
}
|
||||
for (clsid of listaClausoleRisultato) {
|
||||
for (var clsid of listaClausoleRisultato) {
|
||||
var tmpcl = clsid.split('-');
|
||||
$('.' + tmpcl[0]).each(function() {
|
||||
$(this).css('color', '');
|
||||
|
@ -1583,8 +1548,8 @@ $(document).ready(function() {
|
|||
executeLocalSearch(searchwords, formeterza, (formeterza.length - searchwords.length), cantiche[2], par, resultsInCantica, resultsInCanto)
|
||||
if (listarisultati.length) {
|
||||
//evidenzia risultati
|
||||
for (ris of listarisultati) {
|
||||
idris = '#' + ris
|
||||
for (var ris of listarisultati) {
|
||||
var idris = '#' + ris
|
||||
$(idris).addClass("font-weight-bold mark ")
|
||||
|
||||
}
|
||||
|
@ -1731,11 +1696,7 @@ $(document).ready(function() {
|
|||
|
||||
}
|
||||
}
|
||||
/*var telive=getListaRis()
|
||||
for (var tel of telive){
|
||||
$(tel).addClass("mark ")
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
function createCommentSpan(idVerso, elementoverso, numberOfComments) {
|
||||
|
@ -1995,7 +1956,7 @@ $(document).ready(function() {
|
|||
if (pos && !result.has(pos)) {
|
||||
if (pos.includes(';')) {
|
||||
var posses = pos.slice(0, -1).split(';')
|
||||
for (po in posses)
|
||||
for (var po in posses)
|
||||
result.add(posses[po])
|
||||
}
|
||||
else
|
||||
|
|
|
@ -403,7 +403,7 @@ function buildSPQuery(guiquery) {
|
|||
else
|
||||
multipleCondSpQuery = spqparser.parse(ontoSparqlQueryMultCond);
|
||||
var parser = peg.generate(hdnquerygrammar);
|
||||
test = guiquery['EsprLogica'].join(" ");
|
||||
var test = guiquery['EsprLogica'].join(" ");
|
||||
test = test.replaceAll("( ", "(")
|
||||
test = test.replaceAll(" )", ")")
|
||||
clauses = parser.parse(test);
|
||||
|
@ -449,12 +449,14 @@ function buildSQ(stquery) {
|
|||
clause = stquery['EsprLogica']
|
||||
|
||||
filtroContesto = getFiltroContestoJson(JSON.parse(stquery[clause[0]]['contesto']))
|
||||
if (stquery[clause]['TipoClausola'] == 'Sintattico') {
|
||||
|
||||
|
||||
//if (stquery[clause]['TipoClausola'] == 'Sintattico') {
|
||||
if (stquery[clause]['typeSyntax0'].trim()!='' && stquery[clause]['typeSyntax0'].trim()!='.+'){
|
||||
parsedquery = parser.parse(ontoSparqlQuerySynt);
|
||||
var tempsyntquery = buildSintacticClause(stquery[clause], parsedquery, 2)
|
||||
if (filtroContesto.length > 0) {
|
||||
for (tmpc of filtroContesto) {
|
||||
|
||||
tempsyntquery.where.splice(0, 0, tmpc)
|
||||
}
|
||||
}
|
||||
|
@ -467,10 +469,7 @@ function buildSQ(stquery) {
|
|||
console.log(filtroContesto[0])
|
||||
myquery.where.splice(1, 0, tmpc)
|
||||
}
|
||||
//myArray[0] = myArray.splice(1, 1, myArray[0])[0];
|
||||
//let tw=myquery.where[4]
|
||||
//myquery.where[4]=myquery.where[3]
|
||||
//myquery.where[3]=tw
|
||||
|
||||
if (stquery[clause]['queryText'].trim() == "") {
|
||||
if (myquery.where[0].type == 'filter')
|
||||
myquery.where.splice(0, 1)
|
||||
|
@ -851,11 +850,11 @@ function buildClause(clause, parsedquery, whereind) {
|
|||
//sctmp=JSON.parse(sottoCategorieSostantivi)
|
||||
sctmp = sottoCategorie[clause['typeGramm0'].trim()]
|
||||
sctk = Object.keys(sctmp)
|
||||
for (ke in sctk) {
|
||||
for (ke of sctk) {
|
||||
|
||||
keval = clause[sctk[ke]]
|
||||
keval = clause[ke]
|
||||
if (keval != null && keval != '') {
|
||||
sttmts = sctmp[sctk[ke]]
|
||||
sttmts = sctmp[ke]
|
||||
if (sttmts[keval] != null && (sttmts[keval].split(':')[1]) != null) {
|
||||
subcatstat = buildsubcategoryClause(sttmts[keval])
|
||||
if (whereind > -1)
|
||||
|
|
Loading…
Reference in New Issue