2024-05-23 08:26:42 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//query per le simple search con condizioni sulla clausola grammaticale
|
|
|
|
|
|
|
|
var ontoSparqlQuery = `PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
|
|
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
|
|
|
PREFIX hdn: <http://dantenetwork.it/data/commedia/>
|
|
|
|
PREFIX lemon: <http://lemon-model.net/lemon#>
|
|
|
|
PREFIX orl: <https://dantenetwork.it/ontology/orl/current/>
|
|
|
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
|
|
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
|
|
|
|
PREFIX olires:<https://dantenetwork.it/ontology/olires/current/>
|
|
|
|
PREFIX comm: <http://dantenetwork.it/data/commedia/>
|
|
|
|
PREFIX syntit: <https://dantenetwork.it/ontology/syntit/current/>
|
|
|
|
|
|
|
|
SELECT (?t_canto as ?Canto) (?t_cantica as ?Cantica) ?clatype ?clafunction ?clfr ?clto ?cl ?sentence ?cltext ?pos ?clocc
|
|
|
|
WHERE {
|
|
|
|
FILTER(REGEX(?Rappresentazione, "^buon$", "i")) .
|
|
|
|
FILTER(LANGMATCHES(LANG(?Rappresentazione), "it"))
|
|
|
|
###condizioni grammaticali
|
|
|
|
{
|
|
|
|
|
|
|
|
?form ontolex:writtenRep ?Rappresentazione.
|
|
|
|
?lent ontolex:lexicalForm ?form;
|
|
|
|
ontolex:canonicalForm ?cf.
|
|
|
|
?cf ontolex:writtenRep ?lm.
|
|
|
|
?fa olires:occurrenceOf ?form;
|
|
|
|
olires:OccursInRegion ?reg .
|
|
|
|
?reg olires:fragmentRegionFrom ?pos .
|
|
|
|
}
|
|
|
|
###end
|
|
|
|
###condizioni sintattiche
|
|
|
|
{
|
|
|
|
?clocc olires:occurrenceOf ?cl ;
|
|
|
|
ecrm:P148_has_component ?fa ; #condizione join grammaticale sintattica
|
|
|
|
olires:occursInRegion ?frag .
|
|
|
|
|
|
|
|
?sentence a syntit:Sentence ;
|
|
|
|
ecrm:P148i_is_component_of ?canto;
|
|
|
|
syntit:hasSyntacticalComponent ?cl.
|
|
|
|
|
|
|
|
?cl syntit:hasClauseType ?clatype ;
|
|
|
|
ecrm:P190_has_symbolic_content ?cltext ;
|
|
|
|
syntit:hasClauseFunction ?clafunction.
|
|
|
|
|
|
|
|
?frag olires:fragmentRegionFrom ?clfr ;
|
|
|
|
olires:fragmentRegionTo ?clto .
|
|
|
|
}
|
|
|
|
### end
|
|
|
|
### condizioni comuni
|
|
|
|
|
|
|
|
?canto ecrm:P102_has_title ?t_canto;
|
|
|
|
olires:hasNumber ?num .
|
|
|
|
?cantica ecrm:P102_has_title ?t_cantica;
|
|
|
|
olires:hasStructuralComponent ?canto.
|
|
|
|
# FILTER (?t_cantica in ("Inferno", "Purgatorio"))
|
|
|
|
# FILTER (?num IN ("12"^^xsd:short, "4"^^xsd:short ) )
|
|
|
|
### end
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
|
|
//Query generica per advanced search con piu condizioni
|
|
|
|
|
|
|
|
var ontoSparqlQueryMultCond = `PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
|
|
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
|
|
|
PREFIX hdn: <http://dantenetwork.it/data/commedia/>
|
|
|
|
PREFIX lemon: <http://lemon-model.net/lemon#>
|
|
|
|
PREFIX orl: <https://dantenetwork.it/ontology/orl/current/>
|
|
|
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
|
|
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
|
|
|
|
PREFIX olires:<https://dantenetwork.it/ontology/olires/current/>
|
|
|
|
PREFIX comm: <http://dantenetwork.it/data/commedia/>
|
|
|
|
PREFIX syntit: <https://dantenetwork.it/ontology/syntit/current/>
|
|
|
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
|
|
|
|
|
|
SELECT (?t_canto as ?Canto) (?t_cantica as ?Cantica) ?clatype ?clafunction ?clfr ?clto ?cl ?sentence ?pos ?clocc
|
|
|
|
WHERE {
|
|
|
|
FILTER(REGEX(?Rappresentazione, "^buon$", "i")) .
|
|
|
|
FILTER(LANGMATCHES(LANG(?Rappresentazione), "it"))
|
|
|
|
|
|
|
|
### condizioni
|
|
|
|
?canto ecrm:P102_has_title ?t_canto;
|
|
|
|
olires:hasNumber ?num .
|
|
|
|
?cantica ecrm:P102_has_title ?t_cantica;
|
|
|
|
olires:hasStructuralComponent ?canto.
|
|
|
|
###condizioni end
|
|
|
|
###condizioni sintattiche
|
|
|
|
{
|
|
|
|
?clocc olires:occurrenceOf ?cl ;
|
|
|
|
ecrm:P148_has_component ?fa ; # join grammaticale sintattica
|
|
|
|
olires:occursInRegion ?frag .
|
|
|
|
|
|
|
|
?sentence a syntit:Sentence ;
|
|
|
|
ecrm:P148i_is_component_of ?canto;
|
|
|
|
syntit:hasSyntacticalComponent ?cl.
|
|
|
|
|
|
|
|
?cl syntit:hasClauseType ?clatype ;
|
|
|
|
ecrm:P190_has_symbolic_content ?cltext ;
|
|
|
|
syntit:hasClauseFunction ?clafunction.
|
|
|
|
|
|
|
|
?frag olires:fragmentRegionFrom ?clfr ;
|
|
|
|
olires:fragmentRegionTo ?clto .
|
|
|
|
#?frag olires:fragmentRegionFrom ?pos.
|
|
|
|
}
|
|
|
|
###condizioni sintattiche end
|
|
|
|
BIND(COALESCE(?pos1,-1) AS ?pos)
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Query per advanced search con obiettivo = 'Periodo'
|
|
|
|
const sentencetargetquery = `
|
|
|
|
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
|
|
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
|
|
PREFIX olires: <https://dantenetwork.it/ontology/olires/current/>
|
|
|
|
PREFIX syntit: <https://dantenetwork.it/ontology/syntit/current/>
|
|
|
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
|
|
PREFIX lemon: <http://lemon-model.net/lemon#>
|
|
|
|
PREFIX orl: <https://dantenetwork.it/ontology/orl/current/>
|
|
|
|
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
|
|
|
|
|
|
|
|
SELECT (?t_canto as ?Canto) (?t_cantica as ?Cantica) ?sentence ?clfr ?clto ?clafunction ?clocc WHERE {
|
|
|
|
{
|
|
|
|
?sentence rdf:type syntit:Sentence;
|
|
|
|
ecrm:P148i_is_component_of ?canto.
|
|
|
|
?seocc olires:occurrenceOf ?sentence;
|
|
|
|
olires:occursInRegion ?frag.
|
|
|
|
?frag olires:fragmentRegionFrom ?clfr;
|
|
|
|
olires:fragmentRegionTo ?clto.
|
|
|
|
|
|
|
|
####aggiungere condizioni sulle clausole
|
|
|
|
}
|
|
|
|
|
|
|
|
?canto ecrm:P102_has_title ?t_canto;
|
|
|
|
olires:hasNumber ?num.
|
|
|
|
?cantica ecrm:P102_has_title ?t_cantica;
|
|
|
|
olires:hasStructuralComponent ?canto.
|
|
|
|
#BIND(concat(str(?clatype1),";", str(?clatype2)) AS ?clatype)
|
|
|
|
#BIND(COALESCE(?posgen,-1) AS ?pos)
|
|
|
|
}
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetargetstatement_posCoalesce=JSON.parse(`{
|
|
|
|
"type": "bind",
|
|
|
|
"variable": {
|
|
|
|
"termType": "Variable",
|
|
|
|
"value": "pos"
|
|
|
|
},
|
|
|
|
"expression": {
|
|
|
|
"type": "operation",
|
|
|
|
"operator": "coalesce",
|
|
|
|
"args": [
|
|
|
|
{
|
|
|
|
"termType": "Variable",
|
|
|
|
"value": "posgen"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"termType": "Literal",
|
|
|
|
"value": "-1",
|
|
|
|
"language": "",
|
|
|
|
"datatype": {
|
|
|
|
"termType": "NamedNode",
|
|
|
|
"value": "http://www.w3.org/2001/XMLSchema#integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}`)
|
|
|
|
|
|
|
|
const sentencetarget_functionbind=
|
|
|
|
`
|
|
|
|
{
|
|
|
|
"type": "bind",
|
|
|
|
"variable": {
|
|
|
|
"termType": "Variable",
|
|
|
|
"value": "clafunction"
|
|
|
|
},
|
|
|
|
"expression": {
|
|
|
|
"type": "operation",
|
|
|
|
"operator": "concat",
|
|
|
|
"args": []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetarget_occbind=
|
|
|
|
`
|
|
|
|
{
|
|
|
|
"type": "bind",
|
|
|
|
"variable": {
|
|
|
|
"termType": "Variable",
|
|
|
|
"value": "clocc"
|
|
|
|
},
|
|
|
|
"expression": {
|
|
|
|
"type": "operation",
|
|
|
|
"operator": "concat",
|
|
|
|
"args": []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetarget_posbind=
|
|
|
|
`
|
|
|
|
{
|
|
|
|
"type": "bind",
|
|
|
|
"variable": {
|
|
|
|
"termType": "Variable",
|
|
|
|
"value": "pos"
|
|
|
|
},
|
|
|
|
"expression": {
|
|
|
|
"type": "operation",
|
|
|
|
"operator": "concat",
|
|
|
|
"args": []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetarget_syntgroup = `{
|
|
|
|
"type": "group",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"type": "bgp",
|
|
|
|
"triples": [
|
|
|
|
{"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": "https://dantenetwork.it/ontology/syntit/current/hasClauseFunction"},
|
|
|
|
"object": {"termType": "Variable","value": "clafunction"}}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetarget_morphgroup = `{"type": "group",
|
|
|
|
"patterns": [{"type": "bgp",
|
|
|
|
"triples": [
|
|
|
|
{"subject": {"termType": "Variable","value": "form"},
|
|
|
|
"predicate": {"termType": "NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#writtenRep"},
|
|
|
|
"object": {"termType": "Variable","value": "Rappresentazione"}},
|
|
|
|
{"subject": {"termType": "Variable","value": "lent"},
|
|
|
|
"predicate": {"termType": "NamedNode","value": "http://www.w3.org/ns/lemon/ontolex#lexicalForm"},
|
|
|
|
"object": {"termType": "Variable", "value": "form"}},
|
|
|
|
{"subject": {"termType": "Variable","value": "lent"},
|
|
|
|
"predicate": {"termType": "NamedNode","value": "http://www.w3.org/ns/lemon/ontolex#canonicalForm"},
|
|
|
|
"object": {"termType": "Variable","value": "cf"}},
|
|
|
|
{"subject": {"termType": "Variable","value": "cf"},
|
|
|
|
"predicate": {"termType": "NamedNode","value": "http://www.w3.org/ns/lemon/ontolex#writtenRep"},
|
|
|
|
"object": {"termType": "Variable","value": "lm"}},
|
|
|
|
{"subject": {"termType": "Variable","value": "fa"},
|
|
|
|
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
|
|
|
|
"object": {"termType": "Variable","value": "form"}},
|
|
|
|
{"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"}}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetarget_morphgroup_short = `{"type": "group",
|
|
|
|
"patterns": [{"type": "bgp",
|
|
|
|
"triples": [
|
|
|
|
{"subject": {"termType": "Variable","value": "fa"},
|
|
|
|
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
|
|
|
|
"object": {"termType": "Variable","value": "form"}},
|
|
|
|
{"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": "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"},
|
2024-05-24 17:03:19 +02:00
|
|
|
"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"}}
|
2024-05-23 08:26:42 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const sentencetarget_posVariable=`{
|
|
|
|
"termType": "Variable",
|
|
|
|
"value": "pos"
|
|
|
|
}`
|
|
|
|
|
|
|
|
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"}}`
|
2024-05-24 17:03:19 +02:00
|
|
|
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"}}`
|
2024-05-23 08:26:42 +02:00
|
|
|
|
2024-05-24 17:03:19 +02:00
|
|
|
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"}}`
|
|
|
|
|
|
|
|
|