allineata con cesare

This commit is contained in:
Luca Trupiano 2022-09-29 15:17:44 +02:00
parent b9d42b1d0a
commit 78897d88b6
3 changed files with 12 additions and 110 deletions

View File

@ -26,7 +26,7 @@
<!-- <script src="https://rdf.js.org/comunica-browser/versions/v2/engines/query-sparql/comunica-browser.js"></script> --> <!-- <script src="https://rdf.js.org/comunica-browser/versions/v2/engines/query-sparql/comunica-browser.js"></script> -->
<!-- <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js" defer></script> --> <!-- <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js" defer></script> -->
<script type="text/javascript" src="./js/datatables.min.js" defer></script> <script type="text/javascript" src="./js/datatables.min.js" defer></script>
<!-- <script type="text/javascript" src="./js/utils.js"></script> --> <script type="text/javascript" src="./js/utils.js"></script>
<script type="text/javascript" src="https://bundle.run/sparqljs@3.4.1"></script> <script type="text/javascript" src="https://bundle.run/sparqljs@3.4.1"></script>
<script type="text/javascript" src="./js/script_Luk_Q.js"></script> <script type="text/javascript" src="./js/script_Luk_Q.js"></script>
</head> </head>

View File

@ -364,12 +364,14 @@ $(document).ready(function() {
$("form").submit(function(e){ $("form").submit(function(e){
e.preventDefault(); e.preventDefault();
//alert("Funzione non ancora implementata!"); //alert("Funzione non ancora implementata!");
const SparqlParser = sparqljs.Parser; //const SparqlParser = sparqljs.Parser;
const sparqlGenerator = sparqljs.Generator; const sparqlGenerator = sparqljs.Generator;
var parser = new SparqlParser(); //var parser = new SparqlParser();
jsonQuery = parser.parse(baseQuery); myquery = gimmespq();
//jsonQuery = parser.parse(baseQuery);
//jsonQuery = parser.parse(sparqlQuery1); //jsonQuery = parser.parse(sparqlQuery1);
jsonQuery = form2filter(jsonQuery); //jsonQuery = form2filter(jsonQuery);
jsonQuery = form2filter(myquery);
queryFields = []; queryFields = [];
for (var i in jsonQuery.variables) { for (var i in jsonQuery.variables) {
if (jsonQuery.variables[i].value) { if (jsonQuery.variables[i].value) {
@ -579,113 +581,12 @@ $(document).ready(function() {
queryJson.Clausola0 = c0; queryJson.Clausola0 = c0;
const myEngine = new Comunica.QueryEngine(); const myEngine = new Comunica.QueryEngine();
const sparqlEndpoint2 = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commedia-wip/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: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX hdn: <http://hdn.dantenetwork.it/resource/work/commedia/cantica/>
PREFIX lemon: <http://lemon-model.net/lemon#>
PREFIX orl: <http://dantenetwork.it/resource/ontology/ORL/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>
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: <http://erlangen-crm.org/current/>
PREFIX hdn: <http://hdn.dantenetwork.it/resource/>
PREFIX lemon: <http://lemon-model.net/lemon#>
SELECT DISTINCT ?form ?sc ?rep WHERE {
?occ ecrm:P148i_is_component_of <http://hdn.dantenetwork.it/resource/work/commedia/cantica/1/canto/1/verso/5>.
?canto ecrm:P148_has_component <http://hdn.dantenetwork.it/resource/work/commedia/cantica/1/canto/1/verso/5>.
<http://hdn.dantenetwork.it/resource/work/commedia/cantica/1/canto/1/verso/5> ecrm:P190_has_symbolic_content ?sc.
?cantica ecrm:P148_has_component ?canto.
?occ hdn:occurrenceOf ?form.
?form <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?categ;
lemon:writtenRep ?rep.
}`
// su /fuseki/commediaontosintgra
var sparqlQuery2 = `PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX hdn: <http://hdn.dantenetwork.it/resource/>
PREFIX lemon: <http://lemon-model.net/lemon#>
PREFIX orl: <http://dantenetwork.it/resource/ontology/ORL/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX hdn: <http://hdn.dantenetwork.it/resource/>
PREFIX lemon: <http://lemon-model.net/lemon#>
PREFIX orl: <http://dantenetwork.it/resource/ontology/ORL/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 // Fine variabili
async function executeQuery(){ async function executeQuery(){
//execQuery = sparqlQuery3; //execQuery = sparqlQuery3;
//queryFields = queryFields3; //queryFields = queryFields3;
@ -991,6 +892,7 @@ WHERE {
}; };
function form2filter(jsonQuery){ function form2filter(jsonQuery){
data21 = getStatements();
qText = $("form #queryText"); qText = $("form #queryText");
if (qText.length) { if (qText.length) {
if (qText[0].value != '') if (qText[0].value != '')

View File

@ -79,7 +79,7 @@ function gimmespqfromjson(form){
} }
function getStatememts(){ function getStatements(){
return data21 return data21
} }