bug fixed, eliminato codice duplicato

This commit is contained in:
cesare 2024-12-06 14:37:39 +01:00
parent 9906fe54a8
commit d4bb49a04f
4 changed files with 192 additions and 140 deletions

View File

@ -7,7 +7,6 @@ var resetResult;
var lsentid;
var lisid;
const formaClass = 'frm'
var selectedVista;
var vistaPeriodi = false
var vistaDialoghi = false
var vistaRiferimenti = true
@ -77,8 +76,6 @@ $(document).ready(function() {
changedOption = $(this)[0].id;
switch (changedOption + "|" + this.checked) {
case "visPeriodi|true":
selectedVista = 'frasi'
vistaPeriodi = true
loadFrasi();
break;
@ -113,8 +110,6 @@ $(document).ready(function() {
vistaRiferimenti = false
break;
case "visDialoghi|true":
selectedVista = 'dialoghi'
//resetFrasi()
loadDialoghi();
vistaDialoghi = true
break;
@ -248,7 +243,6 @@ $(document).ready(function() {
if (listaClausoleRisultato.length) {
for (clsid of listaClausoleRisultato) {
let tmpid = clsid.split('-')
//loadFrase(tmpid[0], tmpid[1])
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
}
@ -428,7 +422,7 @@ $(document).ready(function() {
canto = forma.canto
}
if (!setVersicontesto.has(forma.verso)) {
divVerso = createDivVersoLI(forma.cantica+1, forma.verso, forma.canto)
divVerso = createDivVersoLI(forma.cantica + 1, forma.verso, forma.canto)
versiIniziali.append(divVerso)
listaVersi.append(versiIniziali)
elencoRisutati.append(listaVersi)
@ -525,7 +519,7 @@ $(document).ready(function() {
//rimuove il grafo sintattico se c'è'
resetGraphStruct()
emptyStructCard()
$(cantoDisplayed).css("display", "none");
@ -716,7 +710,7 @@ $(document).ready(function() {
return
$(cantoDisplayed).find(' .' + idperiodo).each(function() {
var vid=parseInt($(this).attr('id').replace('e', ''))
var vid = parseInt($(this).attr('id').replace('e', ''))
if (vid >= parseInt(fromn)
&& vid <= parseInt(ton)) {
var pstp = $(this).attr('class').split(" ")[1]
@ -728,7 +722,7 @@ $(document).ready(function() {
})
minim.contents().find(' .' + idperiodo).each(function() {
var vid=parseInt($(this).attr('id').replace('e', ''))
var vid = parseInt($(this).attr('id').replace('e', ''))
if (vid >= parseInt(fromn)
&& vid <= parseInt(ton)) {
var mpstp = $(this).attr('class').split(" ")[1]
@ -1293,9 +1287,8 @@ $(document).ready(function() {
//Calcola lemma e categoria grammaticale oppure categoria sintattica per tooltip
function formatTTContent(categ, syntType, sentId) {
/*if (selectedVista=='frasi'){
return '<div class="ttContent"><b>'+maptypes[syntType]+'</b></div>';
}*/
var details = [];
var lemma = categ.split('#')[1].replace("^", " ") //il lemma
var categoria = categ.split('#')[0] // la categoria
@ -1965,9 +1958,9 @@ $(document).ready(function() {
listaClausoleRisultato = []
//Unità di ricerca è 'frase'
if ((!listarisultati.length && unitaRicerca == 'forme') || unitaRicerca == 'frase') {
//if (unitaRicerca == 'frase') {
unitaRicerca='frase'
if ((!listarisultati.length && unitaRicerca == 'forme') || unitaRicerca == 'frase') {
//if (unitaRicerca == 'frase') {
unitaRicerca = 'frase'
resultsInCantica = []
resultsInCanto = []
//listaPeriodiRisultato = []

View File

@ -21,7 +21,8 @@ document.addEventListener("dblclick", function(e){
if(target){
if (locResetGraphStruct())
//if (locResetGraphStruct())
if(resetGraphStruct())
return
var hcontainer="#structCard0"
@ -60,7 +61,7 @@ document.addEventListener("dblclick", function(e){
for (let i = 0; i < collection.length; i++) {
//collection[i].classList.add('font-weight-normal');
collection[i].classList.add('font-italic');
if (selectedVista!='frasi'){
if (!vistaPeriodi){
var synttp=collection[i].className.split(" ")[1]
collection[i].style.color = colorssp(mapsynttypestopalette[synttp]);
}
@ -82,7 +83,7 @@ document.addEventListener("dblclick", function(e){
});
function resetMinimap(sentid){
/*function resetMinimap(sentid){
//var iframe = document.getElementsByClassName("minimap__content");
var iframeDocument = iframe[0].contentDocument || iframe[0].contentWindow.document;
@ -92,13 +93,13 @@ function resetMinimap(sentid){
var iframeSentence = iframeDocument.getElementsByClassName(sentid);
for (let i = 0; i < iframeSentence.length; i++) {
iframeSentence[i].classList.remove('font-italic');
if (selectedVista!='frasi')
if (!vistaPeriodi)
iframeSentence[i].style.removeProperty('color');
iframeSentence[i].classList.remove('font-weight-normal');
}
}
}*/
function updateMinimap(sentid){
@ -112,7 +113,7 @@ function updateMinimap(sentid){
for (let i = 0; i < iframeSentence.length; i++) {
iframeSentence[i].classList.add('font-italic');
if (selectedVista!='frasi'){
if (!vistaPeriodi){
var synttp=iframeSentence[i].className.split(" ")[1]
iframeSentence[i].style.color = colorssp(mapsynttypestopalette[synttp]);
}
@ -120,7 +121,7 @@ function updateMinimap(sentid){
}
function locResetGraphStruct(){
/*function locResetGraphStruct(){
var periodograph=document.getElementById("periodograph");
if (periodograph!=null){
@ -134,7 +135,7 @@ function locResetGraphStruct(){
for (let i = 0; i < sentence.length; i++) {
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
sentence[i].classList.remove('font-italic');
if (selectedVista!='frasi' && !listaPeriodiRisultato.includes(tmpsent))
if (!vistaPeriodi && !listaPeriodiRisultato.includes(tmpsent))
sentence[i].style.removeProperty('color');
sentence[i].classList.remove('font-weight-normal');
@ -153,4 +154,4 @@ function locResetGraphStruct(){
return false
}
}
}*/

View File

@ -1300,116 +1300,7 @@ function getVersiConCitazioniJson(canticapar = '', cantopar = '') {
return citazionitemp;
}
/*function getVersiConCitazioni(canticapar='', cantopar=''){
let citcantiche=['Inferno','Purgatorio','Paradiso']
if (canticapar==''){
citazioni.map(function(item) {
console.log(item['Cantica']+', '+item['Canto']+', '+item['Verso'].split('-')[0]);
})
return
}
var citazionitemp=[]
citazioni.map(function(item) {
if (item['Cantica']==canticapar && item['Canto']==cantopar){
//versi.push(item['Verso'])
//console.log(item['Cantica']+', '+item['Canto']+', '+item['Verso']);
//console.log(citcantiche.indexOf(item['Cantica'])+1);
//console.log(item['Canto']);
tca=item['Canto']
if (tca.startsWith('0'))
tca=tca.replace('0','')
citid=(citcantiche.indexOf(item['Cantica'])+1).toString()+'_'+tca+'_'+item['Verso'].split('-')[0]
//console.log(citid)
var commentsItem = {}
commentsItem['verso'] = citid;
commentsItem['annotazione'] = item['Ann'];
commentsItem['commentario'] = item['Commentario'];
commentsItem['frammentoNota'] = item['FrammentoNota'];
//commentsItem['AutoreCitazione'] = item['InfoCitazione.Autore'];
commentsItem['AutoreCitazione'] = item['AC'];
//commentsItem['FonteCitazione'] = item['InfoCitazione.Fonte'];
commentsItem['FonteCitazione'] = item['F'];
//commentsItem['LuogoFonteCitazione'] = item['InfoCitazione.LuogoFonte'];
commentsItem['LuogoFonteCitazione'] = item['LF'];
//commentsItem['NotaFonteCitazione'] = item['InfoCitazione.NotaFonte'];
commentsItem['NotaFonteCitazione'] = item['NF'];
//commentsItem['TestoFonteCitazione'] = item['InfoCitazione.TestoFonte'];
commentsItem['TestoFonteCitazione'] = item['TF'];
//commentsItem['URLFonteCitazione'] = item['InfoCitazione.UrlFonte'];
commentsItem['URLFonteCitazione'] = item['UF'];
commentsItem['NaturaRiferimento'] = item['NaRi'];
//commentsItem['RapportoCommentoCommentatoreText'] = item['RapportoCommentoCommentatoreText'];
commentsItem['RapportoCommentoCommentatoreText'] = item['RCC'];
//commentsItem['RapportoSoggettoOggetto'] = item['RapportoSoggettoOggetto'];
commentsItem['RapportoSoggettoOggetto'] = item['RSO'];
commentsItem['NomeAutoreCitazione'] = item['Aut'];
commentsItem['TitoloFonteCitazione'] = item['TiFo'];
commentsItem['VersoCitazione'] = item['Verso'];
if (item['AutoreCitazione']==null){
commentsItem['AutoreCitazione'] ='autore'
}
if (item['TiCi']=='no'){
commentsItem['TipoCitazione'] =''
}
else{
commentsItem['TipoCitazione'] =item['TiCi']
}
//'CEP', 'CIM', 'CTE', 'CMO', 'CST', 'CTO'
if (item['CEP']=='no'){
commentsItem['CitEpisodi'] =''
}
else{
commentsItem['CitEpisodi'] =item['CEP']
}
if (item['CIM']=='no'){
commentsItem['CitImmagini'] =''
}
else{
commentsItem['CitImmagini'] =item['CIM']
}
if (item['CTE']=='no'){
commentsItem['CitTeorie'] =''
}
else{
commentsItem['CitTeorie'] =item['CTE']
}
if (item['CMO']=='no'){
commentsItem['CitMotivi'] =''
}
else{
commentsItem['CitMotivi'] =item['CMO']
}
if (item['CST']=='no'){
commentsItem['CitStilemi'] =''
}
else{
commentsItem['CitStilemi'] =item['CST']
}
if (item['CTO']=='no'){
commentsItem['CitTopografie'] =''
}
else{
commentsItem['CitTopografie'] =item['CTO']
}
citazionitemp.push(commentsItem)
}
})
return citazionitemp;
}*/
//TEMPORANEAMENTE: gestione del grafo quando viene chiusa la finestra dal bottone, dovebbe essere spostato
const myiframe = document.getElementsByClassName("minimap__content");
function resetGraphStruct() {
@ -1425,7 +1316,8 @@ function resetGraphStruct() {
for (let i = 0; i < sentence.length; i++) {
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
sentence[i].classList.remove('font-italic');
if (selectedVista != 'frasi' && !listaPeriodiRisultato.includes(tmpsent))
if (!vistaPeriodi && !listaPeriodiRisultato.includes(tmpsent)
&& listaClausoleRisultato.filter(cl => cl.split('-')[0]==tmpsent).length==0)
sentence[i].style.removeProperty('color');
sentence[i].classList.remove('font-weight-normal');
@ -1433,7 +1325,6 @@ function resetGraphStruct() {
}
//reset Minimap
var iframeDocument = myiframe[0].contentDocument || myiframe[0].contentWindow.document;
if (!iframeDocument) {
throw "iframe couldn't be found in DOM.";
@ -1441,12 +1332,12 @@ function resetGraphStruct() {
var iframeSentence = iframeDocument.getElementsByClassName(tmpsent);
for (let i = 0; i < iframeSentence.length; i++) {
iframeSentence[i].classList.remove('font-italic');
if (selectedVista != 'frasi')
if (!vistaPeriodi)
iframeSentence[i].style.removeProperty('color');
iframeSentence[i].classList.remove('font-weight-normal');
}
//EMPTY CARD
emptyStructCard()
if (tmpsent == lsentid) {

View File

@ -26,6 +26,8 @@
function writeQuery(query_s){
console.log(yasgui.getTab().yasqe)
yasgui.getTab().yasqe.addPrefixes({ lila: "http://lila-erc.eu/ontologies/lila/" });
yasgui.getTab().yasqe.setValue(query_s)
mw=document.getElementById("closeModalQ")
mw.click();
@ -41,6 +43,7 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX its: <http://itserr.it/data/>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
SELECT * WHERE {
?sub ?pred ?obj .
@ -679,6 +682,155 @@ const query_16=`PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
?libro rdfs:label ?titolo .
BIND (CONCAT(str(?titolo), '.', str(?chno), '.', str(?vno)) as ?rif)
} order by ?rif`
const query_17=`PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
#i 10 verbi più frequenti nel libro 'Genesis'
SELECT ?lemma ?inflection ?parole ?n_occorrenze
WHERE{
{
SELECT (?ltt as ?lemma) ?sa (GROUP_CONCAT(DISTINCT ?tt ;separator=", ")as ?parole) (count(?tt) as ?n_occorrenze)
WHERE {
FILTER regex(?titolo,"^Genesis$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?tilibro rdfs:label ?titolo .
?book ecrm:P102_has_title ?tilibro .
?lese tresont:inSequence ?book ;
tresont:occurrenceOf ?lf .
?lf ontolex:writtenRep ?tt .
?lexent ontolex:lexicalForm ?lf;
ontolex:canonicalForm ?cf.
?cf ontolex:writtenRep ?ltt;
lila:hasPOS lila:verb;
owl:sameAs ?sa.
} group by ?ltt ?sa having (count(?ltt) > 10) order by DESC(?n_occorrenze) limit 10
}
service<https://lila-erc.eu/sparql/lila_knowledge_base/sparql>{
?sa lila:hasInflectionType ?inty.
?inty rdfs:label ?inflection .
}
}`
const query_18=`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
# Le occorrennze delle categorie verbali (lila:POS) delle sequenze di 4 parole nei versetti del libro 'Genesis'.
# (è un test, tempo di esecuzione molto lungo)
SELECT DISTINCT ?rif (count(?rif) as ?occo)
WHERE {
FILTER(?fvaiif1 = ?fvaiif+1) .
FILTER(?fvaiif2 = ?fvaiif+2) .
FILTER(?fvaiif3 = ?fvaiif+3) .
FILTER regex(?titolo,"^Genesis","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?libro rdfs:label ?titolo .
?bo ecrm:P102_has_title ?libro.
?cha tresont:inSequence ?bo;
tresont:hasStructuralType tresont:chapterType;
tresont:occurrenceOf ?chapi.
?verso tresont:isPartOf ?chapi.
?vero tresont:occurrenceOf ?verso ;
tresont:hasStructuralType tresont:verseType .
?lf tresont:isPartOf ?verso.
?subocc tresont:occurrenceOf ?lf;
tresont:hasPosition ?fvaiif .
?lexen ontolex:lexicalForm ?lf;
ontolex:canonicalForm ?lcf.
?lf1 tresont:isPartOf ?verso.
?subocc1 tresont:occurrenceOf ?lf1 ;
tresont:hasPosition ?fvaiif1 .
?sub1 ontolex:lexicalForm ?lf1;
ontolex:canonicalForm ?lcf1.
?lf2 tresont:isPartOf ?verso.
?subocc2 tresont:occurrenceOf ?lf2 ;
tresont:hasPosition ?fvaiif2 .
?sub2 ontolex:lexicalForm ?lf2;
ontolex:canonicalForm ?lcf2.
?lf3 tresont:isPartOf ?verso.
?subocc3 tresont:occurrenceOf ?lf3 ;
tresont:hasPosition ?fvaiif3 .
?sub3 ontolex:lexicalForm ?lf3;
ontolex:canonicalForm ?lcf3.
?lcf lila:hasPOS ?pos1.
?lcf1 lila:hasPOS ?pos2.
?lcf2 lila:hasPOS ?pos3.
?lcf3 lila:hasPOS ?pos4.
BIND(concat(replace (str(?pos1), "http://lila-erc.eu/ontologies/lila/", ""), ", ", replace (str(?pos2), "http://lila-erc.eu/ontologies/lila/", ""),
", ", replace (str(?pos3), "http://lila-erc.eu/ontologies/lila/", ""), ", ", replace (str(?pos4), "http://lila-erc.eu/ontologies/lila/", "")) AS ?rif)
} group by ?rif order by DESC(?occo) limit 20`
const query_19=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
# Le occorrenze delle categorie verbali (lila:POS) delle prime 4 parole dei versetti del libro 'Genesis'.
SELECT DISTINCT ?sequenza_POS (count(?sequenza_POS) as ?occorrenze) (GROUP_CONCAT(DISTINCT ?rif ;separator=", ")as ?versetti)
WHERE {
FILTER(?fvaiif1 = ?fvaiif+1) .
FILTER(?fvaiif2 = ?fvaiif+2) .
FILTER(?fvaiif3 = ?fvaiif+3) .
FILTER regex(?titolo,"^Genesis","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?libro rdfs:label ?titolo .
?bo ecrm:P102_has_title ?libro.
?cha tresont:inSequence ?bo;
tresont:hasStructuralType tresont:chapterType;
tresont:hasNumber ?chno;
tresont:occurrenceOf ?chapi.
?verso tresont:isPartOf ?chapi.
?vero tresont:occurrenceOf ?verso ;
tresont:hasNumber ?vno;
tresont:hasInterval ?vint;
tresont:hasStructuralType tresont:verseType .
?vint tresont:intervalFrom ?fvaiif .
?lf tresont:isPartOf ?verso.
?subocc tresont:occurrenceOf ?lf;
tresont:hasPosition ?fvaiif .
?lexen ontolex:lexicalForm ?lf;
ontolex:canonicalForm ?lcf.
?lf1 tresont:isPartOf ?verso.
?subocc1 tresont:occurrenceOf ?lf1 ;
tresont:hasPosition ?fvaiif1 .
?sub1 ontolex:lexicalForm ?lf1;
ontolex:canonicalForm ?lcf1.
?lf2 tresont:isPartOf ?verso.
?subocc2 tresont:occurrenceOf ?lf2 ;
tresont:hasPosition ?fvaiif2 .
?sub2 ontolex:lexicalForm ?lf2;
ontolex:canonicalForm ?lcf2.
?lf3 tresont:isPartOf ?verso.
?subocc3 tresont:occurrenceOf ?lf3 ;
tresont:hasPosition ?fvaiif3 .
?sub3 ontolex:lexicalForm ?lf3;
ontolex:canonicalForm ?lcf3.
?lcf lila:hasPOS ?pos1.
?lcf1 lila:hasPOS ?pos2.
?lcf2 lila:hasPOS ?pos3.
?lcf3 lila:hasPOS ?pos4.
bind (concat(str(?chno), ".", str(?vno)) as ?rif)
BIND(concat(replace (str(?pos1), "http://lila-erc.eu/ontologies/lila/", ""), ", ", replace (str(?pos2), "http://lila-erc.eu/ontologies/lila/", ""),
", ", replace (str(?pos3), "http://lila-erc.eu/ontologies/lila/", ""), ", ", replace (str(?pos4), "http://lila-erc.eu/ontologies/lila/", "")) AS ?sequenza_POS)
} group by ?sequenza_POS order by DESC(?occorrenze) ?chno limit 20`
</script>
<style>
.yasgui .autocompleteWrapper {
@ -745,7 +897,8 @@ const query_16=`PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
value: defaultQuery
},
requestConfig : {
endpoint : "https://lida.dantenetwork.it/fuseki/itserr/query"
endpoint:"https://hdnlab1.isti.cnr.it/fuseki/vulgata/query"
//endpoint : "https://lida.dantenetwork.it/fuseki/itserr/query"
},
copyEndpointOnNewTab : true,
resizeable : true,
@ -753,7 +906,8 @@ const query_16=`PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
});
const yasqe= yasgui.getTab().yasqe
const yasr= yasgui.getTab().yasr
yasqe.addPrefixes({ lila: "http://lila-erc.eu/ontologies/lila/", tresont:"https://itserr.it/ns/tresont/current/",
its: "http://itserr.it/data/"});
//console.log(yasgui.config);
@ -821,6 +975,9 @@ const query_16=`PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
<a href="#" class="link-info" onClick='writeQuery(query_8)'>Cerco
i verbi (lila:verb) presenti in un libro.</a>
</p>
<p>
<a href="#" class="link-info" onClick='writeQuery(query_17)'>I verbi più frequenti in un libro.</a>
</p>
<p>
<a href="#" class="link-danger" onClick='writeQuery(query_6)'>Cerco
i versetti di un libro in cui una parola in una specifica
@ -833,6 +990,16 @@ const query_16=`PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
che hanno rispettivamente categoria grammaticale 'lila:verb' e
'lila:noun'</a>
</p>
<p>
<a href="#" class="link-danger" onClick='writeQuery(query_19)'>
Le occorrenze delle categorie verbali (lila:POS) delle prime 4 parole dei versetti del libro 'Genesis'.
</a>
</p>
<p>
<a href="#" class="link-danger" onClick='writeQuery(query_18)'>
TEST! Le occorrenze delle categorie verbali (lila:POS) nelle sequenze di 4 parole nei versetti del libro 'Genesi'.
</a>
</p>
<p>
<a href="#" class="link-danger" onClick='writeQuery(query_13)'>Cerco
le forme derivate da un lemma secondo le regole definite