diff --git a/js/sparqltemplates.js b/js/sparqltemplates.js
index 28e3589..90576d4 100644
--- a/js/sparqltemplates.js
+++ b/js/sparqltemplates.js
@@ -113,6 +113,31 @@ WHERE {
}`
+ //Query per advanced search con obiettivo = 'Verso'
+ const versotargetquery = `
+ PREFIX ecrm:
+ PREFIX xsd:
+ PREFIX olires:
+ PREFIX syntit:
+ PREFIX rdf:
+ PREFIX lemon:
+ PREFIX orl:
+ PREFIX ontolex:
+ prefix tresont:
+
+ SELECT distinct (?t_canto AS ?Canto) (?t_cantica AS ?Cantica) ?sentence ?clfr ?clto ?clafunction ?clt ?pos WHERE {
+
+ ?verso olires:OccursInRegion ?regver.
+ ?regver olires:fragmentRegionFrom ?clfr;
+ olires:fragmentRegionTo ?clto.
+ ?canto olires:hasStructuralComponent ?verso;
+ ecrm:P102_has_title ?t_canto;
+ olires:hasNumber ?num.
+ ?cantica ecrm:P102_has_title ?t_cantica;
+ olires:hasStructuralComponent ?canto.
+
+ }`
+
//Query per advanced search con obiettivo = 'Frase'
const clausetargetquery = `
PREFIX ecrm:
@@ -245,6 +270,16 @@ const clausepos_gr_filter=`
}
*/
+const formapos_verso_filter=`
+{
+ "type": "filter",
+ "expression": {
+ "type": "operation",
+ "operator": "=",
+ "args": []
+ }
+}`
+
const formapos_frase_filter=`
{
"type": "filter",
diff --git a/js/utilsMgr_5.1.js b/js/utilsMgr_5.1.js
index 4c2879d..18ab271 100644
--- a/js/utilsMgr_5.1.js
+++ b/js/utilsMgr_5.1.js
@@ -455,6 +455,7 @@ var clauseTypeBindConcatStatement = ''
var clausePosCoalesceStatement = ''
var occBindConcatStatement = ''
var posBindConcatStatement = ''
+var filterVerso=''
var conditions = []
var filters = []
@@ -518,18 +519,22 @@ function buildSPQuery(guiquery) {
bindConcatStatement = JSON.parse(sentencetarget_functionbind);
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
posBindConcatStatement = JSON.parse(sentencetarget_posbind);
+ filterVerso=JSON.parse(formapos_verso_filter);
+
//clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
- if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
- multipleCondSpQuery = spqparser.parse(clausetargetquery);
+ if (theguiQ['unitaRicerca'] == 'verso') {
+ multipleCondSpQuery = spqparser.parse(versotargetquery);
}
+
+ if (theguiQ['unitaRicerca'] == 'frase') {
+ multipleCondSpQuery = spqparser.parse(clausetargetquery);
+
+ }
if (theguiQ['unitaRicerca'] == 'periodo') {//Multiple Conditions
multipleCondSpQuery = spqparser.parse(sentencetargetquery);
- /*bindConcatStatement = JSON.parse(sentencetarget_functionbind);
- occBindConcatStatement = JSON.parse(sentencetarget_occbind);
- posBindConcatStatement = JSON.parse(sentencetarget_posbind);*/
}
@@ -560,6 +565,10 @@ function buildSPQuery(guiquery) {
}
}
+ /*if (theguiQ['unitaRicerca'] == 'verso'){
+ if(filterVerso.expression.args.length>1)
+ multipleCondSpQuery.where.push(filterVerso)
+ }*/
}
//preprocess multiple conditions query
@@ -856,8 +865,17 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token, op
tmpg = tmpg.replaceAll('"seqpos"', '"seqpos' + token + '"')
tmpg = tmpg.replaceAll('"lm"', '"lm' + token + '"')
tmpg = tmpg.replaceAll('"reg"', '"reg' + token + '"')
- tmpg = tmpg.replaceAll('"verso"', '"verso' + token + '"')
- tmpg = tmpg.replaceAll('"nv"', '"nv' + token + '"')
+
+ if (theguiQ['unitaRicerca'] != 'verso'){
+ tmpg = tmpg.replaceAll('"verso"', '"verso' + token + '"')
+ tmpg = tmpg.replaceAll('"nv"', '"nv' + token + '"')
+ }
+
+ if (theguiQ['unitaRicerca'] == 'verso' && token >1){
+ tmpg = tmpg.replaceAll('"sentence"', '"sentence' + token + '"')
+ tmpg = tmpg.replaceAll('"clg"', '"cl' + token + '"')
+ }
+
if (op == 'OR')
tmpg = tmpg.replaceAll('"clg"', '"clg' + token + '"')
else
@@ -874,7 +892,9 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token, op
}
]
}`
-
+
+ var tmpopverso=`{"termType": "Variable", "value": "nv`+token +`"}`
+ filterVerso.expression.args.push(JSON.parse(tmpopverso))
if (theguiQ['unitaRicerca'] == 'periodo') {
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
tmppos = `{"termType": "Literal",
@@ -899,7 +919,7 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token, op
if (orfilters.length == 0 || !orfilters.includes(JSON.stringify(orfilter))) {
if (parsedquery['where'].at(-1).type == "filter") {
- var texp = JSON.parse(JSON.stringify(parsedquery['where'].at(-1).expression))
+ var texp = formapos_frase_filterJSON.parse(JSON.stringify(parsedquery['where'].at(-1).expression))
var targs = []
targs.push(texp)
targs.push(JSON.parse(JSON.stringify(orfilter.expression)))
@@ -1497,7 +1517,7 @@ function resetGraphStruct() {
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
sentence[i].classList.remove('font-italic');
if (!vistaPeriodi && !listaPeriodiRisultato.includes(tmpsent)
- && listaClausoleRisultato.filter(cl => cl.split('-')[0] == tmpsent).length == 0)
+ && listaClausoleRisultato.flter(cl => cl.split('-')[0] == tmpsent).length == 0)
sentence[i].style.removeProperty('color');
sentence[i].classList.remove('font-weight-normal');