aggiunta funzione per generare query
This commit is contained in:
parent
7e02244cbc
commit
57b957b003
39
js/utils.js
39
js/utils.js
|
@ -9,8 +9,9 @@ PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
|
||||||
PREFIX olires:<https://dantenetwork.it/ontology/OLIRes/>
|
PREFIX olires:<https://dantenetwork.it/ontology/OLIRes/>
|
||||||
|
|
||||||
|
|
||||||
SELECT (?form as ?IRIForma) (?Rappresentazione as ?Forma) (?textver as ?Verso) ?NumVerso (?t_canto as ?Canto) (?t_cantica as ?Cantica)
|
SELECT (?form as ?IRIForma) (?Rappresentazione as ?Forma) (?lm as ?Lemma) (?textver as ?Verso) ?NumVerso
|
||||||
(?lm as ?Lemma)
|
(?t_canto as ?Canto) (?t_cantica as ?Cantica)
|
||||||
|
|
||||||
|
|
||||||
WHERE {
|
WHERE {
|
||||||
?fa orl:occurrenceOf ?form;
|
?fa orl:occurrenceOf ?form;
|
||||||
|
@ -28,7 +29,9 @@ WHERE {
|
||||||
FILTER regex(?Rappresentazione,"^farò$","i") .
|
FILTER regex(?Rappresentazione,"^farò$","i") .
|
||||||
#FILTER regex(?lm,"^fare$","i") .
|
#FILTER regex(?lm,"^fare$","i") .
|
||||||
FILTER langMatches(lang(?Rappresentazione),"it")
|
FILTER langMatches(lang(?Rappresentazione),"it")
|
||||||
}`
|
} ORDER BY ?Cantica ?Canto ?NumVerso
|
||||||
|
LIMIT 50`
|
||||||
|
//Togliere LIMIT in prod
|
||||||
|
|
||||||
function writesparqlquery(query) {
|
function writesparqlquery(query) {
|
||||||
return (query);
|
return (query);
|
||||||
|
@ -51,7 +54,7 @@ function writesearchValue(form) {
|
||||||
|
|
||||||
function gimmespq(){
|
function gimmespq(){
|
||||||
var SparqlParser = sparqljs.Parser;
|
var SparqlParser = sparqljs.Parser;
|
||||||
var parser = new SparqlParser();
|
var parser = new SparqlParser();
|
||||||
return parser.parse(ontoSparqlQuery);
|
return parser.parse(ontoSparqlQuery);
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +90,35 @@ function gimmespqfromjson(form){
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStatements(){
|
function getStatements(){
|
||||||
|
|
||||||
return data21
|
return data21
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildSQ() {
|
||||||
|
const sparqlgen = sparqljs.Generator;
|
||||||
|
const generator = new sparqlgen({orl: "http://www.w3.org/2000/01/rdf-schema#" })
|
||||||
|
var SparqlParser = sparqljs.Parser;
|
||||||
|
var parser = new SparqlParser();
|
||||||
|
const parsedquery =parser.parse(ontoSparqlQuery);
|
||||||
|
const lf = document.getElementById("lemma_forma");
|
||||||
|
const ftxt = document.getElementById("queryText");
|
||||||
|
if (ftxt.value != "") {
|
||||||
|
parsedquery.where[1].expression.args[1].value = "^" + ftxt.value + "$";
|
||||||
|
if (lf.value == 'lemma')
|
||||||
|
parsedquery.where[1].expression.args[0].value = "lm";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
parsedquery.where.splice(1, 1)
|
||||||
|
}
|
||||||
|
//categorie grammaticali
|
||||||
|
mycg=document.getElementById("grammtypes1")
|
||||||
|
if (mycg !=null && mycg.value != "all"){
|
||||||
|
parsedquery.where[0].triples.push(JSON.parse(data21)[mycg.value]);
|
||||||
|
}
|
||||||
|
//alert(generator.stringify(parsedquery))
|
||||||
|
return (parsedquery)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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"}},
|
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"}},
|
||||||
|
|
Loading…
Reference in New Issue