selezione contesto (in progress)

This commit is contained in:
cesare 2023-12-13 17:04:58 +01:00
parent 8105f89863
commit 036d1f5f28
1 changed files with 17 additions and 50 deletions

View File

@ -531,9 +531,9 @@ function getFiltroContestoJson(datiContesto) {
if (Object.keys(canticheids).length > 0){
console.log(JSON.stringify(canticheids))
//console.log(JSON.stringify(canticheids))
var test=buildFilterContextJson (canticheids)
console.log(test)
return (test)
}
else
@ -733,50 +733,6 @@ function getStringFilter(filter, opzione) {
function buildFilterContextJson( contextcantiche) {
var resfilters=[]
var tcontextgroup = ` {
"type": "group",
"patterns": [
{
"type": "bgp",
"triples": [
{"subject": {"termType": "Variable","value": "clocc"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/orl/current/occurrenceOf"},
"object": {"termType": "Variable","value": "cl"}},
{"subject": {"termType": "Variable","value": "clocc"},
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P148_has_component"},
"object": {"termType": "Variable","value": "fa"}},
{"subject": {"termType": "Variable","value": "clocc"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occursInRegion"},
"object": {"termType": "Variable","value": "frag"}},
{"subject": {"termType": "Variable","value": "sentence"},
"predicate": {"termType": "NamedNode","value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"},
"object": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/syntit/current/Sentence"}},
{"subject": {"termType": "Variable","value": "sentence"},
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P148i_is_component_of"},
"object": {"termType": "Variable","value": "canto"}},
{"subject": {"termType": "Variable","value": "sentence"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/syntit/current/hasSyntacticalComponent"},
"object": {"termType": "Variable","value": "cl"}},
{"subject": {"termType": "Variable","value": "cl"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/syntit/current/hasClauseType"},
"object": {"termType": "Variable","value": "clatype"}},
{"subject": {"termType": "Variable","value": "cl"},
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P190_has_symbolic_content"},
"object": {"termType": "Variable","value": "cltext"}},
{"subject": {"termType": "Variable","value": "cl"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/syntit/current/hasClauseFunction"},
"object": {"termType": "Variable","value": "clafunction"}},
{"subject": {"termType": "Variable","value": "frag"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/fragmentRegionFrom"},
"object": {"termType": "Variable","value": "clfr"}},
{"subject": {"termType": "Variable","value": "frag"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/fragmentRegionTo"},
"object": {"termType": "Variable","value": "clto"}}
]
}
]
}
`
var contextgroup = ` {
"type": "group",
"patterns": [
@ -876,12 +832,23 @@ function buildFilterContextJson( contextcantiche) {
filters['expression']['args'].push(contextfilter)
//resfilters.push(filters)
cgroup.patterns.splice(0,0,filters)
cantichefilters['expression']['args'].push(cantichecontextfilter)
cgroup.patterns.splice(0,0, cantichefilters)
resfilters.push(cgroup)
}
}
var uniontmp=`{"type": "union", "patterns":[]}`
jsunion=JSON.parse(uniontmp)
if (resfilters.length>1){
var tmpres=[]
for (filter in resfilters){
jsunion.patterns.push(resfilters[filter])
}
tmpres.push(jsunion)
return (tmpres)
}
cantichefilters['expression']['args'].push(cantichecontextfilter)
//resfilters.push(cantichefilters)
cgroup.patterns.splice(0,0, cantichefilters)
resfilters.push(cgroup)
return resfilters