cambiata la numerazione delle frasi

This commit is contained in:
cesare 2023-06-08 16:14:17 +02:00
parent 378182f929
commit b141e82ae4
1 changed files with 22 additions and 6 deletions

View File

@ -21,6 +21,7 @@ $(document).ready(function() {
const sparqlGenerator = sparqljs.Generator; const sparqlGenerator = sparqljs.Generator;
const myEngine = new Comunica.QueryEngine(); const myEngine = new Comunica.QueryEngine();
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
//const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/CommediaReasoningTest/query";
var shownSentenceList = new Set() var shownSentenceList = new Set()
@ -895,9 +896,11 @@ function resetFrasi(){
function showCanto(formecantica, idcantica, canto) { function showCanto(formecantica, idcantica, canto) {
var setVersiCanto = new Set() var setVersiCanto = new Set()
var periodinum = {};
var cantica=cantiche[parseInt(idcantica)-1]; var cantica=cantiche[parseInt(idcantica)-1];
var elverso, formaItem, currSentenceId; var elverso, formaItem, currSentenceId;
var ultimaFormaCanto;
let numeroPeriodo=1;
formecantica.map(function(item) { formecantica.map(function(item) {
formaItem = item.split("_"); formaItem = item.split("_");
var sentenceid=idcantica+"_"+formaItem[1]+"_s_"+formaItem[5] var sentenceid=idcantica+"_"+formaItem[1]+"_s_"+formaItem[5]
@ -911,7 +914,8 @@ function resetFrasi(){
} }
if(currSentenceId!=null && currSentenceId != sentenceid){ 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 currSentenceId=null
} }
//elverso=createDivVersoNew(cantica, formaItem[3], 'Canto_' + formaItem[1]) //elverso=createDivVersoNew(cantica, formaItem[3], 'Canto_' + formaItem[1])
@ -919,17 +923,28 @@ function resetFrasi(){
setVersiCanto.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1]) setVersiCanto.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])
} }
if(currSentenceId==null || currSentenceId != sentenceid){ if(currSentenceId==null || currSentenceId != sentenceid){
if (currSentenceId!=null){ if (currSentenceId!=null){
createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso) createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso, periodinum[currSentenceId])
} }
currSentenceId=sentenceid; 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) 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 //gestione risultati
@ -1057,7 +1072,7 @@ function resetFrasi(){
return null; return null;
} }
function createSpanPeriodiTag(separator, catgramm, pos, sentenceid, elementoverso) { function createSpanPeriodiTag(separator, catgramm, pos, sentenceid, elementoverso, pnum) {
var spanoccorrenza = $('<span />') var spanoccorrenza = $('<span />')
spanoccorrenza.attr('id', 'sep_'+pos) spanoccorrenza.attr('id', 'sep_'+pos)
spanoccorrenza.attr('title', catgramm) spanoccorrenza.attr('title', catgramm)
@ -1065,7 +1080,8 @@ function resetFrasi(){
spanoccorrenza.append(separator+" ") spanoccorrenza.append(separator+" ")
if (separator==closeSTag){ if (separator==closeSTag){
varsupel=$('<sup />') varsupel=$('<sup />')
varsupel.append(sentenceid.split('_')[3]+' ') //varsupel.append(sentenceid.split('_')[3]+' ')
varsupel.append(pnum+' ')
varsupel.appendTo(spanoccorrenza) varsupel.appendTo(spanoccorrenza)
} }
spanoccorrenza.css("display", "none") spanoccorrenza.css("display", "none")