diff --git a/js/utils.js b/js/utils.js index 924f20c..5bb6464 100644 --- a/js/utils.js +++ b/js/utils.js @@ -4,6 +4,7 @@ PREFIX ecrm: PREFIX orl: PREFIX ontolex: PREFIX olires: +PREFIX comm: 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 orl:FormaSostantivoVolgare; orl:TipoNumeroSostantivoVolgare orl:NumeroSingolareSostantivoVolgare. } } -} +} ORDER BY (?Cantica) (?Canto) LIMIT 50 ` + +tqvpvs=` +PREFIX ecrm: +PREFIX orl: +PREFIX ontolex: +PREFIX olires: +PREFIX xsd: +PREFIx comm: + +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: PREFIX xsd: PREFIX ontolex: PREFIX olires: - +PREFIX comm: 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" },