Merge branch 'master' of https://gitea-s2i2s.isti.cnr.it/concordia/LiDa_Search.git
This commit is contained in:
commit
09598255ee
33
js/utils.js
33
js/utils.js
|
@ -95,16 +95,22 @@ function getStatements(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildSQ() {
|
function buildSQ(stquery) {
|
||||||
const sparqlgen = sparqljs.Generator;
|
//const sparqlgen = sparqljs.Generator;
|
||||||
const generator = new sparqlgen({orl: "http://www.w3.org/2000/01/rdf-schema#" })
|
//const generator = new sparqlgen({orl: "http://www.w3.org/2000/01/rdf-schema#" })
|
||||||
var SparqlParser = sparqljs.Parser;
|
var SparqlParser = sparqljs.Parser;
|
||||||
var parser = new SparqlParser();
|
var parser = new SparqlParser();
|
||||||
const parsedquery =parser.parse(ontoSparqlQuery);
|
const parsedquery =parser.parse(ontoSparqlQuery);
|
||||||
const lf = document.getElementById("lemma_forma");
|
const lf = document.getElementById("lemma_forma");
|
||||||
const ftxt = document.getElementById("queryText");
|
const ftxt = document.getElementById("queryText");
|
||||||
if (ftxt.value != "") {
|
if (ftxt.value.trim() != "") {
|
||||||
parsedquery.where[1].expression.args[1].value = "^" + ftxt.value + "$";
|
|
||||||
|
if (ftxt.value.trim().slice(-1) !=='*')
|
||||||
|
strval="^" +ftxt.value.trim()+ "$";
|
||||||
|
else
|
||||||
|
strval=ftxt.value.trim().slice(0, -1)
|
||||||
|
|
||||||
|
parsedquery.where[1].expression.args[1].value = strval;
|
||||||
if (lf.value == 'lemma')
|
if (lf.value == 'lemma')
|
||||||
parsedquery.where[1].expression.args[0].value = "lm";
|
parsedquery.where[1].expression.args[0].value = "lm";
|
||||||
}
|
}
|
||||||
|
@ -115,8 +121,19 @@ function buildSQ() {
|
||||||
mycg=document.getElementById("grammtypes1")
|
mycg=document.getElementById("grammtypes1")
|
||||||
if (mycg !=null && mycg.value != "all"){
|
if (mycg !=null && mycg.value != "all"){
|
||||||
parsedquery.where[0].triples.push(JSON.parse(data21)[mycg.value]);
|
parsedquery.where[0].triples.push(JSON.parse(data21)[mycg.value]);
|
||||||
|
//test per sottocategorie
|
||||||
|
lst_sc=JSON.parse(sottoCategorie)[mycg.value]
|
||||||
|
for (msc in lst_sc){
|
||||||
|
ename=lst_sc[msc].split(',')[0]
|
||||||
|
esize=lst_sc[msc].split(',')[1]
|
||||||
|
tmp=document.getElementById("cla1"+ename)
|
||||||
|
if (tmp!=null && esize=='2' && tmp.querySelector('input[name="cla1'+ename.trim()+'"]:checked')!=null){
|
||||||
|
//alert (tmp.querySelector('input[name="cla1'+ename.trim()+'"]:checked').value)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//alert(generator.stringify(parsedquery))
|
|
||||||
return (parsedquery)
|
return (parsedquery)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,4 +151,6 @@ data21 = `{"verbovolgare": {"subject": {"termType": "Variable", "value":"form"},
|
||||||
"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"}},
|
"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"}}
|
"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"}}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
sottoCategorie=`{"verbovolgare": ["Diatesi,2", "Transitivita,2", "Genere,2", "Numero,2", "Pers,1", "Rifl,1", "Coniugazione,n", "Tempi,n", "Persona,n", "Funzione,n", "Declinazione,n"],
|
||||||
|
"sostantivovolgare": ["pippo,2", "pluto,2"]}`
|
||||||
|
|
Loading…
Reference in New Issue