From 78897d88b623c5fa9704ec2cbaef85a7b40cc39d Mon Sep 17 00:00:00 2001 From: Luca Trupiano Date: Thu, 29 Sep 2022 15:17:44 +0200 Subject: [PATCH] allineata con cesare --- index_Luk_Q.html | 2 +- js/script_Luk_Q.js | 118 ++++----------------------------------------- js/utils.js | 2 +- 3 files changed, 12 insertions(+), 110 deletions(-) diff --git a/index_Luk_Q.html b/index_Luk_Q.html index 5abf774..aad2c84 100644 --- a/index_Luk_Q.html +++ b/index_Luk_Q.html @@ -26,7 +26,7 @@ - + diff --git a/js/script_Luk_Q.js b/js/script_Luk_Q.js index a66a07c..d72e1ff 100644 --- a/js/script_Luk_Q.js +++ b/js/script_Luk_Q.js @@ -364,12 +364,14 @@ $(document).ready(function() { $("form").submit(function(e){ e.preventDefault(); //alert("Funzione non ancora implementata!"); - const SparqlParser = sparqljs.Parser; + //const SparqlParser = sparqljs.Parser; const sparqlGenerator = sparqljs.Generator; - var parser = new SparqlParser(); - jsonQuery = parser.parse(baseQuery); + //var parser = new SparqlParser(); + myquery = gimmespq(); + //jsonQuery = parser.parse(baseQuery); //jsonQuery = parser.parse(sparqlQuery1); - jsonQuery = form2filter(jsonQuery); + //jsonQuery = form2filter(jsonQuery); + jsonQuery = form2filter(myquery); queryFields = []; for (var i in jsonQuery.variables) { if (jsonQuery.variables[i].value) { @@ -579,113 +581,12 @@ $(document).ready(function() { queryJson.Clausola0 = c0; const myEngine = new Comunica.QueryEngine(); - const sparqlEndpoint2 = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; - const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commedia-wip/query"; + const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; + const sparqlEndpoint2 = "https://hdnlab1.isti.cnr.it/fuseki/commedia-wip/query"; - - // Variabili per le query di prova - - // su /fuseki/commedia-wip/query - var baseQuery = `PREFIX rdfs: - PREFIX ecrm: - PREFIX hdn: - PREFIX lemon: - PREFIX orl: - PREFIX xsd: - PREFIX rdf: - - SELECT ?pos ?sc ?ver ?canto ?cantica ?form ?categ - WHERE { - ?occ ecrm:P148_is_component_of ?ver . - ?occ hdn:isInPosition ?pos . - ?canto ecrm:P148_has_component ?ver . - ?ver ecrm:P190_has_symbolic_content ?sc . - ?cantica ecrm:P148_has_component ?canto . - ?occ hdn:occurrenceOf ?form . - ?form a ?categ . - ?form lemon:writtenRep ?Rappresentazione . - FILTER regex(?Rappresentazione,"^farò$","i") . - }` - - // su /fuseki/commediaontosintgra - var sparqlQuery1 = `PREFIX ecrm: -PREFIX hdn: -PREFIX lemon: -SELECT DISTINCT ?form ?sc ?rep WHERE { - ?occ ecrm:P148i_is_component_of . - ?canto ecrm:P148_has_component . - ecrm:P190_has_symbolic_content ?sc. - ?cantica ecrm:P148_has_component ?canto. - ?occ hdn:occurrenceOf ?form. - ?form ?categ; - lemon:writtenRep ?rep. -}` - - // su /fuseki/commediaontosintgra - var sparqlQuery2 = `PREFIX rdfs: -PREFIX ecrm: -PREFIX hdn: -PREFIX lemon: -PREFIX orl: -PREFIX xsd: -SELECT ?Verbo ?Rappresentazione ?occ ?pos ?ver ?canto ?cantica -WHERE { - ?Verbo a orl:FormaVerboVolgare . - ?Verbo lemon:writtenRep ?Rappresentazione . - ?Verbo orl:TipoTransitivitàVerboVolgare orl:VerboVolgareTransitivo . - ?Verbo orl:TipoDiatesiVerboVolgare orl:VerboVolgareAttivo . - ?Verbo orl:TipoConiugazioneVerboVolgare orl:VerboVolgarePrimaConiugazione . - ?Verbo orl:TipoTempoVerboVolgare orl:FuturoSempliceIndicativoVerboVolgare . - ?Verbo orl:TipoPersonaVerboVolgare orl:PrimaPersonaSingolareVerboVolgare . - ?occ hdn:occurrenceOf ?Verbo . - ?occ hdn:isInPosition ?pos . - ?occ ecrm:P148i_is_component_of ?ver . - ?canto ecrm:P148_has_component ?ver . - ?cantica ecrm:P148_has_component ?canto . - FILTER langMatches(lang(?Rappresentazione),"it") -} LIMIT 20` - - // su /fuseki/commediaontosintgra - var sparqlQuery3 = `PREFIX rdfs: -PREFIX ecrm: -PREFIX hdn: -PREFIX lemon: -PREFIX orl: -PREFIX xsd: -SELECT ?form (?pos as ?posizione_verso) (?poscanto as ?posizione_canto) ?ver ?canto ?cantica -WHERE { - ?occ ecrm:P148i_is_component_of ?ver . - ?occ hdn:isInPosition ?pos . - ?occ hdn:isInPositionCanto ?poscanto . - ?canto ecrm:P148_has_component ?ver . - ?cantica ecrm:P148_has_component ?canto . - ?occ hdn:occurrenceOf ?form . - ?form a orl:FormaVerboVolgare . - ?form orl:TipoDiatesiVerboVolgare orl:VerboVolgareAttivo . - ?form orl:TipoConiugazioneVerboVolgare orl:VerboVolgarePrimaConiugazione . - ?form orl:TipoTempoVerboVolgare orl:FuturoSempliceIndicativoVerboVolgare . - ?form orl:TipoPersonaVerboVolgare orl:PrimaPersonaSingolareVerboVolgare . - ?form lemon:writtenRep ?Rappresentazione . - FILTER regex(?Rappresentazione,"^farò$","i") . - }` - - const data21 = `{"verbovolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaVerboVolgare"}}, - "sostantivovolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaSostantivoVolgare"}}, - "aggettivovolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaAggettivoVolgare"}}, - "avverbiovolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaAvverbioVolgare"}}, - "pronomevolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaPronomeVolgare"}}, - "congiunzionevolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaCongiunzioneVolgare"}}, - "articolovolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaArticoloVolgare"}}, - "preposizionevolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaPreposizioneVolgare"}}, - "interiezionevolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaInteriezioneVolgare"}}, - "onomasticavolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaOnomasticaVolgare"}}, - "citazionevolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaCitazioneVolgare"}}, - "locuzionevolgare": {"subject": {"termType": "Variable", "value":"form"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, "object": {"termType": "NamedNode", "value": "http://dantenetwork.it/resource/ontology/ORL/FormaLocuzioneVolgare"}} - } - ` - // Fine variabili + async function executeQuery(){ //execQuery = sparqlQuery3; //queryFields = queryFields3; @@ -991,6 +892,7 @@ WHERE { }; function form2filter(jsonQuery){ + data21 = getStatements(); qText = $("form #queryText"); if (qText.length) { if (qText[0].value != '') diff --git a/js/utils.js b/js/utils.js index 3cd3c32..8878b89 100644 --- a/js/utils.js +++ b/js/utils.js @@ -79,7 +79,7 @@ function gimmespqfromjson(form){ } -function getStatememts(){ +function getStatements(){ return data21 }