From b141e82ae40fd7c1ee372eb685191362699a7d3f Mon Sep 17 00:00:00 2001 From: cesare Date: Thu, 8 Jun 2023 16:14:17 +0200 Subject: [PATCH] cambiata la numerazione delle frasi --- js/cesareBrowse.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index 29f6eaa..bda3bf3 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -21,6 +21,7 @@ $(document).ready(function() { const sparqlGenerator = sparqljs.Generator; const myEngine = new Comunica.QueryEngine(); const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; + //const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/CommediaReasoningTest/query"; var shownSentenceList = new Set() @@ -895,9 +896,11 @@ function resetFrasi(){ function showCanto(formecantica, idcantica, canto) { var setVersiCanto = new Set() - + var periodinum = {}; var cantica=cantiche[parseInt(idcantica)-1]; var elverso, formaItem, currSentenceId; + var ultimaFormaCanto; + let numeroPeriodo=1; formecantica.map(function(item) { formaItem = item.split("_"); var sentenceid=idcantica+"_"+formaItem[1]+"_s_"+formaItem[5] @@ -911,7 +914,8 @@ function resetFrasi(){ } if(currSentenceId!=null && currSentenceId != sentenceid){ - createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso) + + createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso, periodinum[currSentenceId]) currSentenceId=null } //elverso=createDivVersoNew(cantica, formaItem[3], 'Canto_' + formaItem[1]) @@ -919,17 +923,28 @@ function resetFrasi(){ setVersiCanto.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1]) } if(currSentenceId==null || currSentenceId != sentenceid){ + if (currSentenceId!=null){ - createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso) + createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso, periodinum[currSentenceId]) } currSentenceId=sentenceid; - createSpanPeriodiTag(openSTag, 'o', formaItem[2], sentenceid, elverso) + if (periodinum[currSentenceId]==null){ + periodinum[currSentenceId]=numeroPeriodo + numeroPeriodo=numeroPeriodo+1; + } + //periodinum[currSentenceId]=numeroPeriodo + //numeroPeriodo=numeroPeriodo+1; + createSpanPeriodiTag(openSTag, 'o', formaItem[2], sentenceid, elverso, periodinum[currSentenceId]) } createSpanFormeNew(formaItem[0], formaItem[4], formaItem[2], sentenceid,formaItem[6],elverso) + ultimaFormaCanto=formaItem; } }) + //crea tag di chiusura per l'ultimo periodo del canto + + createSpanPeriodiTag(closeSTag, 'c', ultimaFormaCanto[2]-1, currSentenceId, elverso, periodinum[currSentenceId]) //gestione risultati @@ -1057,7 +1072,7 @@ function resetFrasi(){ return null; } - function createSpanPeriodiTag(separator, catgramm, pos, sentenceid, elementoverso) { + function createSpanPeriodiTag(separator, catgramm, pos, sentenceid, elementoverso, pnum) { var spanoccorrenza = $('') spanoccorrenza.attr('id', 'sep_'+pos) spanoccorrenza.attr('title', catgramm) @@ -1065,7 +1080,8 @@ function resetFrasi(){ spanoccorrenza.append(separator+" ") if (separator==closeSTag){ varsupel=$('') - varsupel.append(sentenceid.split('_')[3]+' ') + //varsupel.append(sentenceid.split('_')[3]+' ') + varsupel.append(pnum+' ') varsupel.appendTo(spanoccorrenza) } spanoccorrenza.css("display", "none")