diff --git a/js/browseMgr.js b/js/browseMgr.js index c475d55..fa14293 100644 --- a/js/browseMgr.js +++ b/js/browseMgr.js @@ -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 '
'+maptypes[syntType]+'
'; - }*/ + + 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 = [] diff --git a/js/syntgraph.js b/js/syntgraph.js index 0ed9d85..84c25f9 100644 --- a/js/syntgraph.js +++ b/js/syntgraph.js @@ -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 } -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/js/utilsMgr.js b/js/utilsMgr.js index 72ea39a..faff358 100644 --- a/js/utilsMgr.js +++ b/js/utilsMgr.js @@ -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) { diff --git a/yasgui/index_its_lida.html b/yasgui/index_its_lida.html index 2b3df22..a948ae3 100644 --- a/yasgui/index_its_lida.html +++ b/yasgui/index_its_lida.html @@ -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: PREFIX tresont: PREFIX ecrm: PREFIX its: +PREFIX lila: SELECT * WHERE { ?sub ?pred ?obj . @@ -679,6 +682,155 @@ const query_16=`PREFIX skos: ?libro rdfs:label ?titolo . BIND (CONCAT(str(?titolo), '.', str(?chno), '.', str(?vno)) as ?rif) } order by ?rif` + +const query_17=`PREFIX owl: +PREFIX rdfs: +PREFIX ecrm: +PREFIX tresont: +PREFIX xsd: +PREFIX ontolex: +PREFIX 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{ + ?sa lila:hasInflectionType ?inty. + ?inty rdfs:label ?inflection . + } +}` +const query_18=`PREFIX ecrm: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX tresont: +PREFIX xsd: +PREFIX ontolex: +PREFIX 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: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX tresont: +PREFIX xsd: +PREFIX ontolex: +PREFIX 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`