browsing in progress

This commit is contained in:
cesare 2022-11-12 19:45:14 +01:00
parent c539c060d4
commit e1de64fee1
2 changed files with 89 additions and 11 deletions

View File

@ -113,8 +113,9 @@ $(document).ready(function() {
myquery =new sparqlGenerator().stringify(jsonQuery) myquery =new sparqlGenerator().stringify(jsonQuery)
executeQuerySearch(myquery) executeQuerySearch(myquery)
if (currentMinimap!='')
showMinimap(currentMinimap)
}); });
@ -140,6 +141,7 @@ $(document).ready(function() {
tempstringa=tempstringa.replaceAll(" !", "!") tempstringa=tempstringa.replaceAll(" !", "!")
tempstringa=tempstringa.replaceAll(" ?", "?") tempstringa=tempstringa.replaceAll(" ?", "?")
tempstringa=tempstringa.replaceAll(" ;", ";") tempstringa=tempstringa.replaceAll(" ;", ";")
tempstringa=tempstringa.replaceAll("%20", " ")
return tempstringa return tempstringa
} }
@ -148,7 +150,8 @@ $(document).ready(function() {
for (verso of listarisultativersi){ for (verso of listarisultativersi){
idverso='#'+verso idverso='#'+verso
console.log(idverso) console.log(idverso)
$(idverso).attr('class', $(idverso).attr('class').replace(" dark-blue", "")) //$(idverso).attr('class', $(idverso).attr('class').replace(" dark-blue", ""))
$(idverso).attr('class', 'f6 font-weight-lighter')
} }
if (currentMinimap!='') if (currentMinimap!='')
showMinimap(currentMinimap) showMinimap(currentMinimap)
@ -234,6 +237,7 @@ $(document).ready(function() {
var listaCanti = new Set() var listaCanti = new Set()
listaVersi = new Set() listaVersi = new Set()
listaForme = new Set()
let cantica = 0; let cantica = 0;
bindingsStream.on('data', (binding) => { bindingsStream.on('data', (binding) => {
//cantica //cantica
@ -242,13 +246,20 @@ $(document).ready(function() {
listaCanti.add(binding.get('Canto').value) listaCanti.add(binding.get('Canto').value)
//la lista dei versi //la lista dei versi
var obj = new Object(); var obj = new Object();
var forma=new Object()
obj.numverso = binding.get('NumeroVerso').value; obj.numverso = binding.get('NumeroVerso').value;
obj.verso = binding.get('Verso').value; obj.verso = binding.get('Verso').value;
obj.canto = binding.get('Canto').value; obj.canto = binding.get('Canto').value;
obj.from = binding.get('from').value; //obj.pos = binding.get('pos').value;
obj.to = binding.get('to').value; //obj.form = binding.get('textform').value;
obj.cantica = cantica; obj.cantica = cantica;
listaVersi.add(obj) listaVersi.add(obj)
forma.numverso = binding.get('NumeroVerso').value;
forma.canto = binding.get('Canto').value;
forma.pos = binding.get('pos').value;
forma.form = binding.get('textform').value;
forma.cantica = cantica;
listaForme.add(forma)
}); });
@ -268,6 +279,25 @@ $(document).ready(function() {
if (parseInt(a.numverso) < parseInt(b.numverso)) { if (parseInt(a.numverso) < parseInt(b.numverso)) {
return -1; return -1;
} }
});
orderedListaVersi = orderedListaVersi.filter((value, index, self) =>
index === self.findIndex((t) => (
t.numverso === value.numverso && t.canto === value.canto && t.cantica===value.cantica
))
)
var orderedListaForme = Array.from(listaForme)
orderedListaForme = orderedListaForme.sort((a, b) => {
if (parseInt(a.pos) < parseInt(b.pos)) {
return -1;
}
}); });
var divListaCanti = $('<DIV id="Canti' + cantica + '" />') var divListaCanti = $('<DIV id="Canti' + cantica + '" />')
@ -297,15 +327,17 @@ $(document).ready(function() {
var elementoverso = $('<p />') var elementoverso = $('<p />')
vartestoverso=verso.numverso; vartestoverso=verso.numverso;
elementoverso.append(verso.numverso + ". ") elementoverso.append(verso.numverso + ". ")
arrayVerso=managePunctuation(verso.verso).split(" "); /*arrayVerso=managePunctuation(verso.verso).split(" ");
for (wpos in arrayVerso){ for (wpos in arrayVerso){
var divoccorrenza=$('<span />') var divoccorrenza=$('<span />')
var pos=parseInt(verso.from)+parseInt(wpos) var pos=parseInt(verso.from)+parseInt(wpos)
divoccorrenza.attr('id', verso.cantica+"_"+ verso.canto.replace(" ", "_")+"_"+verso.numverso+"_"+pos) divoccorrenza.attr('id', verso.cantica+"_"+ verso.canto.replace(" ", "_")+"_"+verso.numverso+"_"+pos)
divoccorrenza.append(arrayVerso[wpos]+" ") divoccorrenza.append(arrayVerso[wpos])
divoccorrenza.appendTo(elementoverso) divoccorrenza.appendTo(elementoverso)
} elementoverso.append('&nbsp;')
}*/
//elementoverso.append(verso.numverso + ". " + managePunctuation(verso.verso)) //elementoverso.append(verso.numverso + ". " + managePunctuation(verso.verso))
elementoverso.attr("style", "line-height: 0.5em") elementoverso.attr("style", "line-height: 0.5em")
elementoverso.attr('class', 'f6 font-weight-lighter') elementoverso.attr('class', 'f6 font-weight-lighter')
@ -314,6 +346,16 @@ $(document).ready(function() {
} }
orderedListaForme.forEach((element) => {
var spanoccorrenza=$('<span />')
var pos=parseInt(element.pos)
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
spanoccorrenza.append(managePunctuation(element.form))
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
spanoccorrenza.appendTo(elementoverso)
elementoverso.append('&nbsp;')
})
}); });
@ -327,7 +369,7 @@ $(document).ready(function() {
//execute query //execute query
async function executeQuerySearch(query) { async function executeQuerySearch(query) {
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], }); seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
console.log(query) //console.log(query)
alert(query) alert(query)
try { try {
var resultVersi = new Set() var resultVersi = new Set()
@ -349,7 +391,13 @@ $(document).ready(function() {
for (verso of listarisultativersi){ for (verso of listarisultativersi){
idverso='#'+verso idverso='#'+verso
console.log(idverso) console.log(idverso)
$(idverso).attr('class', $(idverso).attr('class')+" dark-blue") $(idverso).attr('class', "f6 b dark-blue ")
}
if (currentMinimap!=''){
showMinimap(currentMinimap)
} }

View File

@ -76,7 +76,7 @@ LIMIT 20
` `
// Per restituire i versi di una cantica // Per restituire i versi di una cantica
var qVersiCantica=` var qVersiCanticaold=`
PREFIX ecrm: <http://erlangen-crm.org/current/> PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX orl: <http://dantenetwork.it/ontology/ORL/> PREFIX orl: <http://dantenetwork.it/ontology/ORL/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#> PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
@ -99,6 +99,36 @@ var qVersiCantica=`
FILTER regex(?t_cantica,"Inferno","i") . FILTER regex(?t_cantica,"Inferno","i") .
}` }`
var qVersiCantica=`
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX orl: <http://dantenetwork.it/ontology/ORL/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX olires: <https://dantenetwork.it/ontology/OLIRes/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX text: <http://jena.apache.org/text#>
PREFIx hdn: <https://dantenetwork.it/data/commedia/>
SELECT (?textver AS ?Verso) (?NumVerso AS ?NumeroVerso) (?t_canto AS ?Canto) (?t_cantica AS ?Cantica)
?textform ?pos
WHERE {
?ver ecrm:P190_Has_Symbolic_Content ?textver;
olires:hasNumber ?NumVerso;
olires:hasStructuralComponent ?fa.
# olires:OccursInRegion ?reg .
?fa orl:occurrenceOf ?form.
?fa olires:OccursInRegion ?regfo .
?regfo olires:fragmentRegionFrom ?pos .
?form ontolex:writtenRep ?textform.
# ?reg olires:fragmentRegionFrom ?from;
# olires:fragmentRegionTo ?to .
?canto ecrm:P102_has_title ?t_canto;
olires:hasStructuralComponent ?ver.
?cantica ecrm:P102_has_title ?t_cantica ;
olires:hasStructuralComponent ?canto.
FILTER regex(?t_cantica,"Inferno","i") .
}`
var hdnquerygrammar = ` var hdnquerygrammar = `
Expression Expression
= head:((_)?"("(_)?("AND "/"OR ") Filtro+ (_)?(")")?){return '{"'+head[3]+'": ['+head[4]+"]}"}//{ return head}.join("").replaceAll(", ,","").replaceAll("(,","(").replaceAll(",("," (")} = head:((_)?"("(_)?("AND "/"OR ") Filtro+ (_)?(")")?){return '{"'+head[3]+'": ['+head[4]+"]}"}//{ return head}.join("").replaceAll(", ,","").replaceAll("(,","(").replaceAll(",("," (")}