From b9d42b1d0abfc921edc62340802c40586b057841 Mon Sep 17 00:00:00 2001 From: cesare Date: Thu, 29 Sep 2022 14:54:49 +0200 Subject: [PATCH] query sul nuovo grafico --- js/utils.js | 88 ++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 52 deletions(-) diff --git a/js/utils.js b/js/utils.js index 9d76e9d..3cd3c32 100644 --- a/js/utils.js +++ b/js/utils.js @@ -1,30 +1,29 @@ //query -sparqlquery=`PREFIX rdfs: +ontoSparqlQuery=`PREFIX rdfs: PREFIX ecrm: -PREFIX hdn: +PREFIX hdn: PREFIX lemon: -PREFIX orl: +PREFIX orl: PREFIX xsd: +PREFIX ontolex: +PREFIX olires: -SELECT ?pos ?sc ?ver ?canto ?cantica ?form +SELECT (?form as ?IRIForma) ?Rappresentazione (?textver as ?Verso) ?NumVerso (?t_canto as ?Canto) (?t_cantica as ?Cantica) 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 orl:FormaVerboVolgare . - ?form orl:TipoTransitivitàVerboVolgare orl:VerboVolgareTransitivo . - ?form orl:TipoDiatesiVerboVolgare orl:VerboVolgareAttivo . - ?form orl:TipoConiugazioneVerboVolgare orl:VerboVolgarePrimaConiugazione . - ?form orl:TipoTempoVerboVolgare orl:FuturoSempliceIndicativoVerboVolgare . - ?form orl:TipoPersonaVerboVolgare orl:PrimaPersonaSingolareVerboVolgare . - ?form lemon:writtenRep ?Rappresentazione . + ?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 . FILTER regex(?Rappresentazione,"^farò$","i") . + FILTER langMatches(lang(?Rappresentazione),"it") }` - function writesparqlquery(query) { +function writesparqlquery(query) { return (query); } // write the query in natural language @@ -46,28 +45,9 @@ function writesearchValue(form) { function gimmespq(){ var SparqlParser = sparqljs.Parser; var parser = new SparqlParser(); - //const sparqlParser = sp_js.Parser; - return parser.parse( - `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") . - }`); + return parser.parse(ontoSparqlQuery); + + } // the query is transformed according the form values @@ -99,17 +79,21 @@ function gimmespqfromjson(form){ } -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"}} +function getStatememts(){ + return data21 +} + +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/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/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/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/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/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/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/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/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/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/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/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/ORL/FormaLocuzioneVolgare"}} } ` \ No newline at end of file