minor changes

This commit is contained in:
cesare 2025-03-06 18:09:50 +01:00
parent 371ba234db
commit 1253b5001e
1 changed files with 31 additions and 41 deletions

View File

@ -127,7 +127,7 @@ const maptypes = {
const filterposition=`
const filterposition = `
Filter = head:(interval? val?) {return head}
interval= limitinf? limitsup?
@ -142,7 +142,7 @@ const maptypes = {
_ "whitespace"= " "*`
//Filtro posizione
var parserFiltroPosizione=peg.generate(filterposition);
var parserFiltroPosizione = peg.generate(filterposition);
var orlprefix = 'https://dantenetwork.it/ontology/orl/current/'
@ -855,42 +855,32 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token, op
parsedquery['variables'].push(JSON.parse(tmppos))
var andfilter = clausepos_gr_filter.replaceAll("pos_", "pos" + token)
//TEST
if (document.querySelector('#Posizione_fr')!=null &&
document.querySelector('#Posizione_fr').value.trim()!=''){
var posrestr=document.querySelector('#Posizione_fr').value
var pospar=parserFiltroPosizione.parse(posrestr.trim())
if (pospar[1]!=null){
andfilter=andfilter.replace('<=', '=')
andfilter=andfilter.replace('clfr', 'clfr+'+(parseInt(pospar[1])-1))
if (document.querySelector('#Posizione_fr') != null &&
document.querySelector('#Posizione_fr').value.trim() != '') {
var posrestr = document.querySelector('#Posizione_fr').value
var pospar = []
try {
pospar = parserFiltroPosizione.parse(posrestr.trim())
if (pospar[1] != null) {
andfilter = andfilter.replace('<=', '=')
andfilter = andfilter.replace('clfr', 'clfr+' + (parseInt(pospar[1]) - 1))
}
else{
var inter=pospar[0]
if (inter[0]!=null){
andfilter=andfilter.replace('clfr', 'clfr+'+(parseInt(inter[0])-1))
else {
var inter = pospar[0]
if (inter[0] != null) {
andfilter = andfilter.replace('clfr', 'clfr+' + (parseInt(inter[0])))
}
if (inter[1]!=null){
var newarg=`{
"type": "operation",
"operator": ">",
"args": [
{
"termType": "Variable",
"value": "clfr"
},
{
"termType": "Variable",
"value": "pos_"
}
]
}`
newarg=newarg.replace("clfr", "clfr+"+parseInt(inter[1]))
var tmpij=JSON.parse(andfilter)
tmpij.expression.args.push(JSON.parse(newarg))
andfilter=JSON.stringify(tmpij)
if (inter[1] != null) {
andfilter = andfilter.replace('clto', 'clfr+' + (parseInt(inter[1])))
}
}
}
catch (err) {
console.log(err)
}
}
parsedquery['where'].push(JSON.parse(andfilter))
}