query, wip

This commit is contained in:
cesare 2024-05-24 17:03:19 +02:00
parent 62a3e3250a
commit b37f7ea134
2 changed files with 40 additions and 13 deletions

View File

@ -288,18 +288,18 @@ const sentencetarget_morphgroup = `{"type": "group",
{"subject": {"termType": "Variable","value": "fa"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/OccursInRegion"},
"object": {"termType": "Variable", "value": "reg"}},
{"subject": {"termType": "Variable","value": "reg"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/fragmentRegionFrom"},
"object": {"termType": "Variable","value": "pos"}},
{"subject": {"termType": "Variable","value": "sentence"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/syntit/current/hasSyntacticalComponent"},
"object": {"termType": "Variable","value": "clg"}},
{"subject": {"termType": "Variable","value": "cloccte"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
"object": {"termType": "Variable","value": "clg"}},
{"subject": {"termType": "Variable","value": "cloccte"},
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P148_has_component"},
"object": {"termType": "Variable","value": "fa"}}
"object": {"termType": "Variable","value": "fa"}},
{"subject": {"termType": "Variable","value": "reg"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/fragmentRegionFrom"},
"object": {"termType": "Variable","value": "pos"}},
{"subject": {"termType": "Variable","value": "sentence"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/syntit/current/hasSyntacticalComponent"},
"object": {"termType": "Variable","value": "clg"}}
]
}
]
@ -313,6 +313,18 @@ const sentencetarget_morphgroup = `{"type": "group",
const lemma_writtenrepresentation = `{"subject": {"termType": "Variable", "value":"cf"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#writtenRep"}, "object": {"termType": "Variable", "value": "lm"}}`
const lemma_canonicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#canonicalForm"}, "object": {"termType": "Variable", "value": "cf"}}`
const lemma_lexicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#lexicalForm"}, "object": {"termType": "Variable", "value": "form"}}`
const lemma_lexicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#lexicalForm"},
"object": {"termType": "Variable", "value": "form"}}`
const occurrenceof_form=`{"subject": {"termType": "Variable","value": "fa"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
"object": {"termType": "Variable","value": "form"}}`
const clauseocc_hascomponent_formocc=`{"subject": {"termType": "Variable","value": "cloccu"},
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P148_has_component"},
"object": {"termType": "Variable","value": "fa"}}`
const occurrenceof_clause=`{"subject": {"termType": "Variable","value": "cloccu"},
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
"object": {"termType": "Variable","value": "cl"}}`

View File

@ -477,15 +477,17 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
var stmt = buildFilterStatement(clause['lemma_forma'], clause['queryText'].trim(), clause['opzioni_testo'])
tmpgroup.patterns.push(stmt)
tmpgroup.patterns.push(JSON.parse(unionop)['bgp']);
tmpgroup.patterns.unshift(stmt)
//tmpgroup.patterns.push(JSON.parse(unionop)['bgp']);
tmpgroup.patterns.splice(1, 0, JSON.parse(unionop)['bgp']);
if(clause['lemma_forma']=='lemma'){
tmpgroup.patterns.at(-1).triples.push(JSON.parse(lemma_lexicalform))
tmpgroup.patterns.at(-1).triples.push(JSON.parse(lemma_canonicalform))
tmpgroup.patterns.at(-1).triples.push(JSON.parse(lemma_writtenrepresentation))
}
else{
tmpgroup.patterns.at(-1).triples.push(JSON.parse(writtenrepresentation))
tmpgroup.patterns[1].triples.push(JSON.parse(writtenrepresentation))
//tmpgroup.patterns.at(-1).triples.push(JSON.parse(writtenrepresentation))
}
}
@ -563,6 +565,15 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
if (clause['TipoClausola'] == "Sintattico") {
tmpgroup.patterns.push(JSON.parse(unionop)['bgp']);
//controllo se tra i filtri c'e una stringa
if (clause['queryText'] != null && clause['queryText'].trim() != "") {
//aggiungo statements per legare la stringa alla clausola
tmpgroup.patterns[1].triples.push(JSON.parse(occurrenceof_form))
tmpgroup.patterns[1].triples.push(JSON.parse(clauseocc_hascomponent_formocc))
tmpgroup.patterns[1].triples.push(JSON.parse(occurrenceof_clause))
}
var functS = clause['functionSyntax'];
var typeS = clause['typeSyntax0']
console.log(functS + ' ' + typeS)
@ -575,7 +586,7 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
if (typeS != null && typeS != ".+") {
var alltipi = Object.assign(macrotipi_sint, tipi_sint);
let mymt=alltipi[typeS]
//let mymt=macrotipi_sint[typeS]
if(listaMacroTipiConSubTipo.includes(mymt.split(':')[1])){
let myfa=buildMacroSyntType(mymt)
for (fa in myfa){
@ -599,6 +610,10 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
mytest=mytest.replaceAll(':"cl"', ':"cl'+token+'"')
mytest=mytest.replaceAll(':"clatype"', ':"clatype'+token+'"')
mytest=mytest.replaceAll(':"clafunction"', ':"clafunction'+token+'"')
mytest=mytest.replaceAll(':"cloccu"', ':"cloccu'+token+'"')
mytest=mytest.replaceAll(':"fa"', ':"fa'+token+'"')
mytest=mytest.replaceAll(':"form"', ':"form'+token+'"')
mytest=mytest.replaceAll(':"Rappresentazione"', ':"Rappresentazione'+token+'"')
var mystrb=`{
"type": "operation",
"operator": "str",