implementazione query cond multiple, progress
This commit is contained in:
parent
d079a84ea6
commit
b937d25ca3
|
@ -682,11 +682,11 @@
|
|||
<select
|
||||
class="custom-select text-muted bg-light border border-success btn-outline-success "
|
||||
id="unitaRicerca">
|
||||
<option value="versi">Versi</option>
|
||||
<option value="verso">Versi</option>
|
||||
<option value="frase">Frasi</option>
|
||||
<option value="periodo">Periodi</option>
|
||||
<option value="discorso">Discorsi</option>
|
||||
<option value="riferimenti">Riferimenti</option>
|
||||
<option value="riferimento">Riferimenti</option>
|
||||
</select>
|
||||
<!-- <select
|
||||
class="custom-select text-muted bg-light border border-success btn-outline-success "
|
||||
|
|
|
@ -278,15 +278,14 @@ $(document).ready(function() {
|
|||
*/
|
||||
|
||||
|
||||
var prevstart = -1
|
||||
var prevoffset = -1
|
||||
//var prevstart = -1
|
||||
//var prevoffset = -1
|
||||
jQuery.manageResultList = function manageResultList(start, offset = showOffset) {
|
||||
|
||||
/*if (offset == prevoffset && start == prevstart && cantoDisplayed == '#vistaFrasi')
|
||||
return*/
|
||||
|
||||
console.log('Paginazione...')
|
||||
prevstart = start
|
||||
prevoffset = offset
|
||||
//prevstart = start
|
||||
//prevoffset = offset
|
||||
if (cantoDisplayed != '#vistaFrasi') {
|
||||
prevCantoDisplayed = cantoDisplayed;
|
||||
$(cantoDisplayed).css("display", "none");
|
||||
|
@ -1508,7 +1507,7 @@ $(document).ready(function() {
|
|||
unitaRicerca = 'forma'
|
||||
else
|
||||
unitaRicerca = jsonQuery['unitaRicerca']
|
||||
if (unitaRicerca=='riferimenti'){
|
||||
if (unitaRicerca=='riferimento'){
|
||||
var esprLR=jsonQuery.EsprLogicaRif
|
||||
if(esprLR.length && esprLR.length==1){
|
||||
listaRisultatiCommenti=queryRiferimenti(jsonQuery[esprLR[0].trim()], cantoDisplayed)
|
||||
|
@ -2012,7 +2011,7 @@ $(document).ready(function() {
|
|||
listaClausoleRisultatoContesti = []
|
||||
//Unità di ricerca è 'frase'
|
||||
|
||||
if ((!listarisultati.length && unitaRicerca == 'forme') || unitaRicerca == 'frase' || unitaRicerca == 'versi') {
|
||||
if ((!listarisultati.length && unitaRicerca == 'forme') || unitaRicerca == 'frase' || unitaRicerca == 'verso') {
|
||||
//if (unitaRicerca == 'frase') {
|
||||
unitaRicerca = 'frase'
|
||||
resultsInCantica = []
|
||||
|
@ -2162,7 +2161,6 @@ $(document).ready(function() {
|
|||
// mostra lista risultati
|
||||
//$.manageResultList(0, showOffset);
|
||||
$("#cantica0").trigger("click");
|
||||
//$("#vistaFrasi").css("display", "none");
|
||||
|
||||
});
|
||||
//var queryExecuted = true;
|
||||
|
|
|
@ -420,7 +420,7 @@ function buildSPQuery(guiquery) {
|
|||
theguiQ = guiquery;
|
||||
var SparqlParser = sparqljs.Parser;
|
||||
var spqparser = new SparqlParser();
|
||||
if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {//Multiple Conditions UR=Periodo
|
||||
if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {//Multiple Conditions
|
||||
multipleCondSpQuery = spqparser.parse(sentencetargetquery);
|
||||
bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
||||
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
|
||||
|
@ -433,8 +433,9 @@ function buildSPQuery(guiquery) {
|
|||
var test = guiquery['EsprLogica'].join(" ");
|
||||
test = test.replaceAll("( ", "(")
|
||||
test = test.replaceAll(" )", ")")
|
||||
clauses = parser.parse(test);
|
||||
jsonclauses = JSON.parse(clauses)
|
||||
var clauses = parser.parse(test);
|
||||
//here get clauses
|
||||
var jsonclauses = JSON.parse(clauses)
|
||||
|
||||
for (const ck of Object.keys(jsonclauses)) {
|
||||
parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where)
|
||||
|
@ -453,6 +454,25 @@ function buildSPQuery(guiquery) {
|
|||
}
|
||||
|
||||
}
|
||||
//preprocess multiple conditions query
|
||||
|
||||
function processMultipleCond(rawquery){
|
||||
for (var pc of rawquery['EsprLogica']){
|
||||
if (pc.startsWith('Clausola')){
|
||||
//console.log(rawquery[pc])
|
||||
if ((rawquery[pc]['typeSyntax0'].trim() != 'all' || rawquery[pc]['functionSyntax'].trim() != 'all') &&
|
||||
rawquery[pc]['typeGramm0'].trim() == 'all') {//solo filtro sintattico
|
||||
rawquery[pc]["TipoClausola"]="Sintattico"
|
||||
}
|
||||
if ((rawquery[pc]['typeSyntax0'].trim() == 'all' && rawquery[pc]['functionSyntax'].trim() == 'all') &&
|
||||
rawquery[pc]['typeGramm0'].trim() != 'all') {//solo filtro grammaticale
|
||||
rawquery[pc]["TipoClausola"]="Grammaticale"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return rawquery
|
||||
}
|
||||
|
||||
//BUILD THE QUERY!
|
||||
|
||||
|
@ -467,8 +487,8 @@ function buildSQ(stquery) {
|
|||
console.log(stquery)
|
||||
|
||||
if (stquery['QueryAvanzata'] == 1 && stquery['EsprLogica'] != null && stquery['EsprLogica'].length > 1) {
|
||||
//parsedquery = parser.parse(ontoSparqlQueryMultCond)
|
||||
buildSPQuery(stquery)
|
||||
var processedquery=processMultipleCond(stquery)
|
||||
buildSPQuery(processedquery)
|
||||
return multipleCondSpQuery;
|
||||
}
|
||||
var clausolaS='Clausola0'
|
||||
|
@ -478,8 +498,8 @@ function buildSQ(stquery) {
|
|||
filtroContesto = getFiltroContestoJson(JSON.parse(stquery[clause[0]]['contesto']))
|
||||
|
||||
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != '.+') ||
|
||||
stquery[clause]['functionSyntax'].trim() != '.+') &&
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != 'all') ||
|
||||
stquery[clause]['functionSyntax'].trim() != 'all') &&
|
||||
stquery[clause]['typeGramm0'].trim() == 'all') {//solo filtro sintattico
|
||||
parsedquery = parser.parse(ontoSparqlQuerySynt);
|
||||
var tempsyntquery = buildSintacticClause(stquery[clause], parsedquery, 2)
|
||||
|
@ -490,7 +510,7 @@ function buildSQ(stquery) {
|
|||
}
|
||||
return tempsyntquery
|
||||
}
|
||||
if ((stquery[clause]['typeSyntax0'].trim() == '.+' && stquery[clause]['functionSyntax'].trim() == '.+') &&
|
||||
if ((stquery[clause]['typeSyntax0'].trim() == 'all' && stquery[clause]['functionSyntax'].trim() == 'all') &&
|
||||
stquery[clause]['typeGramm0'].trim() != 'all') {//solo filtro grammaticale
|
||||
myquery = buildClause(stquery[clause], parsedquery, 2)
|
||||
if (filtroContesto.length > 0) {
|
||||
|
@ -509,8 +529,8 @@ function buildSQ(stquery) {
|
|||
}
|
||||
|
||||
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != '.+') ||
|
||||
(stquery[clause]['functionSyntax'].trim() != '' && stquery[clause]['functionSyntax'].trim() != '.+')) &&
|
||||
if (((stquery[clause]['typeSyntax0'].trim() != '' && stquery[clause]['typeSyntax0'].trim() != '.+' && stquery[clause]['typeSyntax0'].trim() != 'all') ||
|
||||
(stquery[clause]['functionSyntax'].trim() != '' && stquery[clause]['functionSyntax'].trim() != 'all')) &&
|
||||
stquery[clause]['typeGramm0'].trim() != 'all') {//entrambi i filtri
|
||||
console.log('entrambi i filtri')
|
||||
//preparo la query sparql
|
||||
|
@ -758,12 +778,12 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
|||
var typeS = clause['typeSyntax0']
|
||||
console.log(functS + ' ' + typeS)
|
||||
var myf = ''
|
||||
if (functS != null && functS != ".+") {
|
||||
if (functS != null && functS != ".+" && functS != "all") {
|
||||
myf = buildsyntClause(funzione_clausola[functS])
|
||||
if (myf != '')
|
||||
tmpgroup.patterns.at(-1).triples.push(myf)
|
||||
}
|
||||
if (typeS != null && typeS != ".+") {
|
||||
if (typeS != null && typeS != ".+" && typeS != "all") {
|
||||
var alltipi = Object.assign(macrotipi_sint, tipi_sint);
|
||||
let mymt = alltipi[typeS]
|
||||
|
||||
|
|
Loading…
Reference in New Issue