nuova query con versi successivo e precedente

This commit is contained in:
cesare 2022-10-21 15:00:07 +02:00
parent b87fe4b1d0
commit 8dfff2cc7f
1 changed files with 52 additions and 17 deletions

View File

@ -4,6 +4,7 @@ PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX orl: <http://dantenetwork.it/ontology/ORL/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX olires: <https://dantenetwork.it/ontology/OLIRes/>
PREFIX comm: <http://dantenetwork.it/data/commedia/>
SELECT (?form AS ?IRIForma) (?Rappresentazione AS ?Forma) (?lm AS ?Lemma) (?textver AS ?Verso) (?NumVerso AS ?NumeroVerso) (?t_canto AS ?Canto) (?t_cantica AS ?Cantica) WHERE {
?fa orl:occurrenceOf ?form;
ecrm:P148i_is_component_of ?ver.
@ -28,9 +29,52 @@ SELECT (?form AS ?IRIForma) (?Rappresentazione AS ?Forma) (?lm AS ?Lemma) (?text
{ ?form <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> orl:FormaSostantivoVolgare;
orl:TipoNumeroSostantivoVolgare orl:NumeroSingolareSostantivoVolgare. }
}
}
} ORDER BY (?Cantica) (?Canto)
LIMIT 50
`
tqvpvs=`
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX orl: <http://dantenetwork.it/ontology/ORL/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX olires: <https://dantenetwork.it/ontology/OLIRes/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIx comm: <https://dantenetwork.it/data/commedia/>
SELECT (?form AS ?IRIForma) (?Rappresentazione AS ?Forma) (?lm AS ?Lemma) (?textver AS ?Verso) (?NumVerso AS ?NumeroVerso) (?t_canto AS ?Canto) (?t_cantica AS ?Cantica)
(?textver1 AS ?VersoPrec) (?textver2 AS ?VersoSucc)
WHERE {
?fa orl:occurrenceOf ?form;
ecrm:P148i_is_component_of ?ver.
?ver ecrm:P190_Has_Symbolic_Content ?textver;
olires:hasNumber ?NumVerso;
ecrm:P148i_is_component_of ?canto.
?canto ecrm:P102_has_title ?t_canto;
ecrm:P148i_is_component_of ?cantica.
?cantica ecrm:P102_has_title ?t_cantica.
?form ontolex:writtenRep ?Rappresentazione.
?lent ontolex:lexicalForm ?form;
ontolex:canonicalForm ?cf.
?cf ontolex:writtenRep ?lm.
FILTER(REGEX(?Rappresentazione, "^stelle$", "i")) .
FILTER(LANGMATCHES(LANG(?Rappresentazione), "it")) .
#BIND(IF((?NumVerso-1) >0,(xsd:short(?NumVerso-1)), (xsd:short(1))) as ?NumVerso1)
BIND(xsd:short(?NumVerso-1) as ?NumVerso1)
BIND(xsd:short(?NumVerso+1) as ?NumVerso2)
Optional{
?ver1 ecrm:P190_Has_Symbolic_Content ?textver1;
olires:hasNumber ?NumVerso1;
ecrm:P148i_is_component_of ?canto.
}
OPTIONAL {
?ver2 ecrm:P190_Has_Symbolic_Content ?textver2;
olires:hasNumber ?NumVerso2;
ecrm:P148i_is_component_of ?canto.
}
} ORDER BY (?canto) (?cantica)
LIMIT 10
`
//ORDER BY (?Cantica) (?Canto)
var hdnquerygrammar = `
@ -91,7 +135,7 @@ PREFIX orl: <http://dantenetwork.it/ontology/ORL/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX olires:<https://dantenetwork.it/ontology/OLIRes/>
PREFIX comm: <http://dantenetwork.it/data/commedia/>
SELECT (?form as ?IRIForma) (?Rappresentazione as ?Forma) (?lm as ?Lemma) (?textver as ?Verso) (?NumVerso as ?NumeroVerso)
(?t_canto as ?Canto) (?t_cantica as ?Cantica)
@ -115,7 +159,6 @@ WHERE {
FILTER langMatches(lang(?Rappresentazione),"it")
} ORDER BY ?Cantica ?Canto ?NumVerso
LIMIT 50`
//ORDER BY ?Cantica ?Canto ?NumVerso
//Togliere LIMIT in prod
orlprefix = 'http://dantenetwork.it/ontology/ORL/'
@ -143,7 +186,8 @@ function writesearchValue(form) {
function gimmespq() {
var SparqlParser = sparqljs.Parser;
var parser = new SparqlParser();
return parser.parse(ontoSparqlQuery);
//return parser.parse(ontoSparqlQuery);
return parser.parse(tqvpvs);
}
@ -243,10 +287,11 @@ function buildSQ(stquery) {
stringInSparql= false;
var SparqlParser = sparqljs.Parser;
var parser = new SparqlParser();
const parsedquery = parser.parse(ontoSparqlQuery);
//Prendo la query SPARQL template
//const parsedquery = parser.parse(ontoSparqlQuery);
const parsedquery = parser.parse(tqvpvs);
const lf = document.getElementById("lemma_forma");
mytestq = parser.parse(tq);
//mytestq = parser.parse(tq);
var ftxt = document.getElementById("queryText");
//Nick
if (ftxt == null) {
@ -500,18 +545,8 @@ function buildsubcategoryClause(sttmnt) {
}
/*
{
"b": "VerboVolgareFunzioneAvverbio",
"l": "VerboVolgareFunzioneLocuzione" #CONTROLLARE
}
"Persona" : ["Qualsiasi persona", "1ª persona singolare", "2ª persona singolare", "3ª persona singolare", "1ª persona plurale", "2ª persona plurale", "3ª persona plurale"],
*/
var sottoCategorie = {
"verbovolgare": {
"Diatesi": { "Attivo": "TipoDiatesiVerboVolgare:VerboVolgareAttivo", "Passivo": "TipoDiatesiVerboVolgare:VerboVolgarePassivo" },