query, in progress
This commit is contained in:
parent
9c138ccdb6
commit
0dbde2b4a9
|
@ -1,9 +1,9 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, getFormaCntxt, getListaIdCommenti, queryRiferimentimul} from './dataMgr_5.1.js';
|
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, getFormaCntxt, getListaIdCommenti, queryRiferimentimul } from './dataMgr_5.1.js';
|
||||||
import { getJsonQuery, emptyStructCard } from './script_5.1.js';
|
import { getJsonQuery, emptyStructCard } from './script_5.1.js';
|
||||||
import {resetGraphStr} from './syntgraph_5.1.js'
|
import { resetGraphStr } from './syntgraph_5.1.js'
|
||||||
|
|
||||||
|
|
||||||
export var resetResult;
|
export var resetResult;
|
||||||
|
@ -35,12 +35,12 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
const dialogaltri = 'diaAltri'
|
const dialogaltri = 'diaAltri'
|
||||||
var listaClausoleRisultatoContesti = []
|
var listaClausoleRisultatoContesti = []
|
||||||
|
|
||||||
var listaRisultatiCommenti=[]
|
var listaRisultatiCommenti = []
|
||||||
|
|
||||||
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/commedia/query";
|
//const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commedia/query";
|
||||||
const sparqlEndpoint = "https://lida.dantenetwork.it/fuseki/commedia/query";
|
const sparqlEndpoint = "https://lida.dantenetwork.it/fuseki/commedia/query";
|
||||||
|
|
||||||
|
@ -57,12 +57,12 @@ $(document).ready(function() {
|
||||||
var loadedCanti = new Set();
|
var loadedCanti = new Set();
|
||||||
const openSTag = "{"
|
const openSTag = "{"
|
||||||
const closeSTag = "}"
|
const closeSTag = "}"
|
||||||
|
|
||||||
cantoDisplayed = "#InfernoCanto_1";
|
cantoDisplayed = "#InfernoCanto_1";
|
||||||
|
|
||||||
var prevCantoDisplayed = "#InfernoCanto_1";
|
var prevCantoDisplayed = "#InfernoCanto_1";
|
||||||
var contextLength = 3;
|
var contextLength = 3;
|
||||||
|
|
||||||
var idCitazione = "citazioneFrase";
|
var idCitazione = "citazioneFrase";
|
||||||
|
|
||||||
initCitazioni();
|
initCitazioni();
|
||||||
|
@ -213,7 +213,7 @@ $(document).ready(function() {
|
||||||
var setVersicontestoExp = new Set()
|
var setVersicontestoExp = new Set()
|
||||||
for (var forma of versiContestoExp) {
|
for (var forma of versiContestoExp) {
|
||||||
if (!setVersicontestoExp.has(forma.verso)) {
|
if (!setVersicontestoExp.has(forma.verso)) {
|
||||||
divVersoExp = createDivVersoLI(forma.cantica+1, forma.verso, forma.canto)
|
divVersoExp = createDivVersoLI(forma.cantica + 1, forma.verso, forma.canto)
|
||||||
$(reit).append(divVersoExp)
|
$(reit).append(divVersoExp)
|
||||||
setVersicontestoExp.add(forma.verso)
|
setVersicontestoExp.add(forma.verso)
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ $(document).ready(function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Costruzione e visualizzazione del risultato in frasi.
|
* Costruzione e visualizzazione del risultato in frasi.
|
||||||
*/
|
*/
|
||||||
|
@ -296,7 +296,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
//listarisultati.sort(function(a, b){return a - b});
|
//listarisultati.sort(function(a, b){return a - b});
|
||||||
showFrasi(start, offset)
|
showFrasi(start, offset)
|
||||||
|
|
||||||
if (vistaPeriodi) {
|
if (vistaPeriodi) {
|
||||||
loadFrasi();
|
loadFrasi();
|
||||||
}
|
}
|
||||||
|
@ -355,11 +355,11 @@ $(document).ready(function() {
|
||||||
res.sort(function(a, b) { return a - b });
|
res.sort(function(a, b) { return a - b });
|
||||||
return (res)
|
return (res)
|
||||||
}
|
}
|
||||||
if (listaClausoleRisultatoContesti.length && !listarisultati.length ) {
|
if (listaClausoleRisultatoContesti.length && !listarisultati.length) {
|
||||||
var lim=endcont
|
var lim = endcont
|
||||||
if (listaClausoleRisultatoContesti.length<=endcont)
|
if (listaClausoleRisultatoContesti.length <= endcont)
|
||||||
lim=listaClausoleRisultatoContesti.length-1
|
lim = listaClausoleRisultatoContesti.length - 1
|
||||||
for (let i=startcont; i<=lim; i++){
|
for (let i = startcont; i <= lim; i++) {
|
||||||
res.push(listaClausoleRisultatoContesti[i])
|
res.push(listaClausoleRisultatoContesti[i])
|
||||||
}
|
}
|
||||||
//res.sort(function(a, b) { puno = a[0].split('-')[3]; pdue = b[0].split('-')[3]; return parseInt(puno) - parseInt(pdue) });
|
//res.sort(function(a, b) { puno = a[0].split('-')[3]; pdue = b[0].split('-')[3]; return parseInt(puno) - parseInt(pdue) });
|
||||||
|
@ -389,20 +389,20 @@ $(document).ready(function() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var versiContesto = ''
|
var versiContesto = ''
|
||||||
var ctxpivot=0
|
var ctxpivot = 0
|
||||||
if (!Array.isArray(risultato)) {
|
if (!Array.isArray(risultato)) {
|
||||||
risultato = parseInt(risultato)
|
risultato = parseInt(risultato)
|
||||||
versiContesto = getFormaContext(risultato, contextLength);
|
versiContesto = getFormaContext(risultato, contextLength);
|
||||||
ctxpivot=risultato
|
ctxpivot = risultato
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
versiContesto = getFraseContext(risultato, contextLength);
|
versiContesto = getFraseContext(risultato, contextLength);
|
||||||
if(versiContesto.length){
|
if (versiContesto.length) {
|
||||||
var tmind=Math.floor(versiContesto.length/2);
|
var tmind = Math.floor(versiContesto.length / 2);
|
||||||
ctxpivot=versiContesto[tmind]['posizione']
|
ctxpivot = versiContesto[tmind]['posizione']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var setVersicontesto = new Set()
|
var setVersicontesto = new Set()
|
||||||
divVerso = ''
|
divVerso = ''
|
||||||
|
@ -519,7 +519,7 @@ $(document).ready(function() {
|
||||||
//rimuove il grafo sintattico se c'è'
|
//rimuove il grafo sintattico se c'è'
|
||||||
resetGraphStr()
|
resetGraphStr()
|
||||||
emptyStructCard()
|
emptyStructCard()
|
||||||
|
|
||||||
|
|
||||||
$(cantoDisplayed).css("display", "none");
|
$(cantoDisplayed).css("display", "none");
|
||||||
|
|
||||||
|
@ -542,8 +542,8 @@ $(document).ready(function() {
|
||||||
//$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
|
//$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
|
||||||
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
||||||
|
|
||||||
var telive=getListaRis()
|
var telive = getListaRis()
|
||||||
for (var tel of telive){
|
for (var tel of telive) {
|
||||||
$(tel).addClass("mark ")
|
$(tel).addClass("mark ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,8 +650,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
return (cantica + '_' + mcanto.split('_')[1])
|
return (cantica + '_' + mcanto.split('_')[1])
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function loadPeriodo(idperiodo) {
|
function loadPeriodo(idperiodo) {
|
||||||
|
|
||||||
|
@ -853,52 +853,52 @@ $(document).ready(function() {
|
||||||
|
|
||||||
async function initCitazioni() {
|
async function initCitazioni() {
|
||||||
//"#InfernoCanto_1"
|
//"#InfernoCanto_1"
|
||||||
var idcantica='1'
|
var idcantica = '1'
|
||||||
var mcanto = cantoDisplayed.replace("#", '')
|
var mcanto = cantoDisplayed.replace("#", '')
|
||||||
var cantica = ''
|
var cantica = ''
|
||||||
if (mcanto.startsWith('Inf'))
|
if (mcanto.startsWith('Inf'))
|
||||||
cantica = 'Inferno'
|
cantica = 'Inferno'
|
||||||
if (mcanto.startsWith('Pur')){
|
if (mcanto.startsWith('Pur')) {
|
||||||
cantica = 'Purgatorio'
|
cantica = 'Purgatorio'
|
||||||
idcantica='2'
|
idcantica = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcanto.startsWith('Par')) {
|
if (mcanto.startsWith('Par')) {
|
||||||
cantica = 'Paradiso'
|
cantica = 'Paradiso'
|
||||||
idcantica='3'
|
idcantica = '3'
|
||||||
}
|
}
|
||||||
var canto = mcanto.split('_')[1]
|
var canto = mcanto.split('_')[1]
|
||||||
var idCommento = "Commento_" + idcantica + "_" + canto + "_";
|
var idCommento = "Commento_" + idcantica + "_" + canto + "_";
|
||||||
var idverso=cantica+'_Canto_'+canto+'_'
|
var idverso = cantica + '_Canto_' + canto + '_'
|
||||||
var idminimap=cantica+'Canto_'+canto
|
var idminimap = cantica + 'Canto_' + canto
|
||||||
/*console.log(myid)*/
|
/*console.log(myid)*/
|
||||||
if (canto.length == 1)
|
if (canto.length == 1)
|
||||||
canto = '0' + canto
|
canto = '0' + canto
|
||||||
//commentsJson = getVersiConCitazioniJson(cantica, canto)
|
//commentsJson = getVersiConCitazioniJson(cantica, canto)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
var mresult =await getVersiConCitazioni(cantica, canto)
|
var mresult = await getVersiConCitazioni(cantica, canto)
|
||||||
|
|
||||||
commentsSQL= Object.groupBy(mresult, ({ VersoCitazione }) => VersoCitazione);
|
commentsSQL = Object.groupBy(mresult, ({ VersoCitazione }) => VersoCitazione);
|
||||||
|
|
||||||
var tmpkeys=[]
|
var tmpkeys = []
|
||||||
|
|
||||||
for (const ke in commentsSQL){
|
for (const ke in commentsSQL) {
|
||||||
//console.log(ke.split('-')[0])
|
//console.log(ke.split('-')[0])
|
||||||
var t=ke.split('-')[0]
|
var t = ke.split('-')[0]
|
||||||
if (tmpkeys.indexOf(t) == -1)
|
if (tmpkeys.indexOf(t) == -1)
|
||||||
tmpkeys.push(t)
|
tmpkeys.push(t)
|
||||||
else
|
else
|
||||||
continue
|
continue
|
||||||
var pio=$( "#"+idCommento+t)
|
var pio = $("#" + idCommento + t)
|
||||||
if(pio.length)
|
if (pio.length)
|
||||||
break;
|
break;
|
||||||
var elverso=$( "#"+idverso+t)//$("li[value='"+t+"']")
|
var elverso = $("#" + idverso + t)//$("li[value='"+t+"']")
|
||||||
//console.log(elverso)
|
//console.log(elverso)
|
||||||
createCommentSpan(idCommento+t, elverso, commentsSQL[ke].length)
|
createCommentSpan(idCommento + t, elverso, commentsSQL[ke].length)
|
||||||
}
|
}
|
||||||
|
|
||||||
drawMinimap("#" + idminimap, false)
|
drawMinimap("#" + idminimap, false)
|
||||||
//console.log (commentsSQL)
|
//console.log (commentsSQL)
|
||||||
}
|
}
|
||||||
|
@ -937,7 +937,7 @@ $(document).ready(function() {
|
||||||
$("#noteCard0")[0].remove();
|
$("#noteCard0")[0].remove();
|
||||||
}
|
}
|
||||||
var id = cid.substr(9);
|
var id = cid.substr(9);
|
||||||
id=parcid.at(-1)
|
id = parcid.at(-1)
|
||||||
var collapseNote;
|
var collapseNote;
|
||||||
var gruppoVersi;
|
var gruppoVersi;
|
||||||
var versText = "";
|
var versText = "";
|
||||||
|
@ -947,11 +947,11 @@ $(document).ready(function() {
|
||||||
var currentGroup;
|
var currentGroup;
|
||||||
|
|
||||||
allGrouplKeys.sort().some(function(k) {
|
allGrouplKeys.sort().some(function(k) {
|
||||||
if (k == id || k.startsWith(id+'-')){ //~k.indexOf(id + '-')) {
|
if (k == id || k.startsWith(id + '-')) { //~k.indexOf(id + '-')) {
|
||||||
//console.log('gruppo commenti '+k)
|
//console.log('gruppo commenti '+k)
|
||||||
console.log(commentsSQL[k].length)
|
console.log(commentsSQL[k].length)
|
||||||
//gruppoVersi = k.split("_").slice(-1)[0]
|
//gruppoVersi = k.split("_").slice(-1)[0]
|
||||||
gruppoVersi=k
|
gruppoVersi = k
|
||||||
if (gruppoVersi.includes("-")) {
|
if (gruppoVersi.includes("-")) {
|
||||||
versText = ", Versi " + gruppoVersi;
|
versText = ", Versi " + gruppoVersi;
|
||||||
} else {
|
} else {
|
||||||
|
@ -959,9 +959,9 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
currentGroup = createNoteGroup(cantica, getRoman(parcid[2]), versText, k, commentsSQL[k].length)
|
currentGroup = createNoteGroup(cantica, getRoman(parcid[2]), versText, k, commentsSQL[k].length)
|
||||||
commentsSQL[k].forEach(function(value, i) {
|
commentsSQL[k].forEach(function(value, i) {
|
||||||
currentGroup.append(createNoteEntry(value, k, i))
|
currentGroup.append(createNoteEntry(value, k, i))
|
||||||
});
|
});
|
||||||
commentArea.append(currentGroup);
|
commentArea.append(currentGroup);
|
||||||
}
|
}
|
||||||
$('#tab-list #vis0-tab').tab('show')
|
$('#tab-list #vis0-tab').tab('show')
|
||||||
|
@ -993,14 +993,14 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNoteEntry(comments, id, pos) {
|
function createNoteEntry(comments, id, pos) {
|
||||||
const tmplistaidcomm=getListaIdCommenti()
|
const tmplistaidcomm = getListaIdCommenti()
|
||||||
var idref=comments.Id
|
var idref = comments.Id
|
||||||
if(tmplistaidcomm.length && tmplistaidcomm.includes(idref)){
|
if (tmplistaidcomm.length && tmplistaidcomm.includes(idref)) {
|
||||||
var noteCard = $('<div class="card card-body border-success well well-sm mx-1 mb-1 mt-0 p-0" id="noteCard' + id + '_' + pos +'"'+ ' name= "'+idref+'">');
|
var noteCard = $('<div class="card card-body border-success well well-sm mx-1 mb-1 mt-0 p-0" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
var noteCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 p-0 border-lida08" id="noteCard' + id + '_' + pos +'"'+ ' name= "'+idref+'">');
|
var noteCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 p-0 border-lida08" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
|
||||||
|
|
||||||
var collapseCardBody = $('<div class="card-body px-0 py-1 mx-3 my-0 border-top rounded" >');
|
var collapseCardBody = $('<div class="card-body px-0 py-1 mx-3 my-0 border-top rounded" >');
|
||||||
var divCampiSingoli = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
var divCampiSingoli = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
||||||
//createNoteHeader(noteCard, comments, id, pos, cantica, parcid, saveVersoCitazione);
|
//createNoteHeader(noteCard, comments, id, pos, cantica, parcid, saveVersoCitazione);
|
||||||
|
@ -1190,7 +1190,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function createModuleCommentatore(collapse, commento, num, id, pos) {
|
function createModuleCommentatore(collapse, commento, num, id, pos) {
|
||||||
|
|
||||||
let tmpcomm = commento
|
let tmpcomm = commento
|
||||||
let jsonCommento = JSON.parse(tmpcomm.replaceAll("'", '"').replaceAll("+", '"'));
|
let jsonCommento = JSON.parse(tmpcomm.replaceAll("'", '"').replaceAll("+", '"'));
|
||||||
/*var minLength = (($('#displaynote').width() / ($('#Test').width() / 32)) * 2 * 1.63);*/
|
/*var minLength = (($('#displaynote').width() / ($('#Test').width() / 32)) * 2 * 1.63);*/
|
||||||
var divContent = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
var divContent = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
||||||
|
@ -1198,9 +1198,9 @@ $(document).ready(function() {
|
||||||
var nota = '';
|
var nota = '';
|
||||||
var lenmod = 0
|
var lenmod = 0
|
||||||
for (var el in jsonCommento) {
|
for (var el in jsonCommento) {
|
||||||
|
|
||||||
var tmpcc=JSON.parse(jsonCommento[el])
|
var tmpcc = JSON.parse(jsonCommento[el])
|
||||||
console.log(' el '+tmpcc)
|
console.log(' el ' + tmpcc)
|
||||||
var urlCommento = tmpcc["Commento"];
|
var urlCommento = tmpcc["Commento"];
|
||||||
|
|
||||||
var esitoCommento = tmpcc.Rapporto;
|
var esitoCommento = tmpcc.Rapporto;
|
||||||
|
@ -1284,8 +1284,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
var id = cid.split('_').at(-1)
|
var id = cid.split('_').at(-1)
|
||||||
for (const [keyt, value] of Object.entries(commentsSQL)) {
|
for (const [keyt, value] of Object.entries(commentsSQL)) {
|
||||||
if (keyt == id || keyt.startsWith(id+'-')) {
|
if (keyt == id || keyt.startsWith(id + '-')) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1301,9 +1301,9 @@ $(document).ready(function() {
|
||||||
function numberOfCommentsJson(cid) {
|
function numberOfCommentsJson(cid) {
|
||||||
var cntc = 0
|
var cntc = 0
|
||||||
|
|
||||||
var id=cid.split('_').at(-1)
|
var id = cid.split('_').at(-1)
|
||||||
for (const keyt in commentsSQL){
|
for (const keyt in commentsSQL) {
|
||||||
if (keyt==id) {
|
if (keyt == id) {
|
||||||
cntc = commentsSQL[keyt].length
|
cntc = commentsSQL[keyt].length
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -1469,20 +1469,20 @@ $(document).ready(function() {
|
||||||
//manageMM (cantoDisplayed)
|
//manageMM (cantoDisplayed)
|
||||||
//var currPage = 0;
|
//var currPage = 0;
|
||||||
//var latestPhraseId = "";
|
//var latestPhraseId = "";
|
||||||
var telive=getListaRis()
|
var telive = getListaRis()
|
||||||
for (var ve of telive) {
|
for (var ve of telive) {
|
||||||
//let idve = ve
|
//let idve = ve
|
||||||
$(ve).removeClass("mark ")
|
$(ve).removeClass("mark ")
|
||||||
minim.contents().find(ve).removeClass("mark ")
|
minim.contents().find(ve).removeClass("mark ")
|
||||||
}
|
}
|
||||||
const tmplistaidcomm=getListaIdCommenti()
|
const tmplistaidcomm = getListaIdCommenti()
|
||||||
for (var idco of tmplistaidcomm){
|
for (var idco of tmplistaidcomm) {
|
||||||
//$('[name="' + cantica + 'Canto ' + k + '"]')
|
//$('[name="' + cantica + 'Canto ' + k + '"]')
|
||||||
$('[name="' + idco + '"]').removeClass('border-success ')
|
$('[name="' + idco + '"]').removeClass('border-success ')
|
||||||
}
|
}
|
||||||
cleanListaRis()
|
cleanListaRis()
|
||||||
drawMinimap(cantoDisplayed, true)
|
drawMinimap(cantoDisplayed, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*function manageMM(name) {
|
/*function manageMM(name) {
|
||||||
|
@ -1507,14 +1507,14 @@ $(document).ready(function() {
|
||||||
unitaRicerca = 'forma'
|
unitaRicerca = 'forma'
|
||||||
else
|
else
|
||||||
unitaRicerca = jsonQuery['unitaRicerca']
|
unitaRicerca = jsonQuery['unitaRicerca']
|
||||||
if (unitaRicerca=='riferimento'){
|
if (unitaRicerca == 'riferimento') {
|
||||||
var esprLR=jsonQuery.EsprLogicaRif
|
var esprLR = jsonQuery.EsprLogicaRif
|
||||||
if(esprLR.length && esprLR.length==1){
|
if (esprLR.length && esprLR.length == 1) {
|
||||||
listaRisultatiCommenti=queryRiferimenti(jsonQuery[esprLR[0].trim()], cantoDisplayed)
|
listaRisultatiCommenti = queryRiferimenti(jsonQuery[esprLR[0].trim()], cantoDisplayed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
listaRisultatiCommenti=queryRiferimentimul(jsonQuery, cantoDisplayed)
|
listaRisultatiCommenti = queryRiferimentimul(jsonQuery, cantoDisplayed)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1906,15 +1906,12 @@ $(document).ready(function() {
|
||||||
|
|
||||||
//alert(query)
|
//alert(query)
|
||||||
$("#loader").fadeIn(300);
|
$("#loader").fadeIn(300);
|
||||||
//$("#searchcomm2").prop("disabled", true);
|
|
||||||
//$("#searchcomm2").html('<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span> Searching...');
|
|
||||||
try {
|
try {
|
||||||
var seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
var seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
$("#loader").fadeOut(300);
|
$("#loader").fadeOut(300);
|
||||||
//$("#searchcomm2").prop("disabled", false);
|
|
||||||
//$("#searchcomm2").html('<span class="" role="status" aria-hidden="true"></span> Search');
|
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1927,7 +1924,7 @@ $(document).ready(function() {
|
||||||
var cantica = 'Nessuna'
|
var cantica = 'Nessuna'
|
||||||
var canto = 'Canto 0'
|
var canto = 'Canto 0'
|
||||||
//var numverso=0
|
//var numverso=0
|
||||||
var pos=0
|
var pos = 0
|
||||||
seachbBindingsStream.on('data', (binding) => {
|
seachbBindingsStream.on('data', (binding) => {
|
||||||
|
|
||||||
//cantica
|
//cantica
|
||||||
|
@ -1981,6 +1978,16 @@ $(document).ready(function() {
|
||||||
resultsInCantica.push(cantica);
|
resultsInCantica.push(cantica);
|
||||||
resultsInCanto.push(cantica + canto)
|
resultsInCanto.push(cantica + canto)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//cambiare!
|
||||||
|
for (var ip=1; ip<10; ip++){
|
||||||
|
if (binding.has('pos'+ip)){
|
||||||
|
var tp=binding.get('pos'+ip).value;
|
||||||
|
if (!result.has(tp))
|
||||||
|
result.add(tp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//cambiare!
|
||||||
if (unitaRicerca != 'frase' && pos == -1) {
|
if (unitaRicerca != 'frase' && pos == -1) {
|
||||||
unitaRicerca = 'frase'
|
unitaRicerca = 'frase'
|
||||||
}
|
}
|
||||||
|
@ -2027,7 +2034,7 @@ $(document).ready(function() {
|
||||||
//if (!resSent.has(fraseItems[0] + '-' + fraseItems[3])) {
|
//if (!resSent.has(fraseItems[0] + '-' + fraseItems[3])) {
|
||||||
let tmpocc = fraseItems.slice(-1)
|
let tmpocc = fraseItems.slice(-1)
|
||||||
|
|
||||||
if (resClauses.filter(clocc => clocc == tmpocc[0]).length == 0 || tmpocc[0]=='') {
|
if (resClauses.filter(clocc => clocc == tmpocc[0]).length == 0 || tmpocc[0] == '') {
|
||||||
resClauses.push(tmpocc[0]);
|
resClauses.push(tmpocc[0]);
|
||||||
//resSent.add(fraseItems[0] + '-' + fraseItems[3]+'-'+fraseItems[1] + '-' + fraseItems[2]);
|
//resSent.add(fraseItems[0] + '-' + fraseItems[3]+'-'+fraseItems[1] + '-' + fraseItems[2]);
|
||||||
resSentence.add(fraseItems[1] + '-' + fraseItems[2]);
|
resSentence.add(fraseItems[1] + '-' + fraseItems[2]);
|
||||||
|
@ -2135,8 +2142,8 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tempr.forEach(y => listaClausoleRisultatoContesti.push(listaClausoleRisultato.filter(x => (x.split('-')[0] == y) && x.split('-').length > 1)))
|
tempr.forEach(y => listaClausoleRisultatoContesti.push(listaClausoleRisultato.filter(x => (x.split('-')[0] == y) && x.split('-').length > 1)))
|
||||||
}
|
}
|
||||||
|
|
||||||
//aggiunge badge con totale risultati accanto alle cantiche
|
//aggiunge badge con totale risultati accanto alle cantiche
|
||||||
|
|
||||||
var totResultN = showBadgeInCantica(resultsInCantica)
|
var totResultN = showBadgeInCantica(resultsInCantica)
|
||||||
|
@ -2155,18 +2162,18 @@ $(document).ready(function() {
|
||||||
showBadgeInCanto(resultsInCanto)
|
showBadgeInCanto(resultsInCanto)
|
||||||
|
|
||||||
console.log('badge end...')
|
console.log('badge end...')
|
||||||
//calcolo numero dei contesti
|
//calcolo numero dei contesti
|
||||||
countResultContexts()
|
countResultContexts()
|
||||||
$("#loader").fadeOut(300);
|
$("#loader").fadeOut(300);
|
||||||
// mostra lista risultati
|
// mostra lista risultati
|
||||||
//$.manageResultList(0, showOffset);
|
//$.manageResultList(0, showOffset);
|
||||||
$("#cantica0").trigger("click");
|
$("#cantica0").trigger("click");
|
||||||
|
|
||||||
});
|
});
|
||||||
//var queryExecuted = true;
|
//var queryExecuted = true;
|
||||||
//$(cantoDisplayed).attr('style', 'display: d-flex;');
|
//$(cantoDisplayed).attr('style', 'display: d-flex;');
|
||||||
/* $("#cantica0").trigger("click");
|
/* $("#cantica0").trigger("click");
|
||||||
$("#vistaFrasi").css("display", "none");*/
|
$("#vistaFrasi").css("display", "none");*/
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
|
@ -109,8 +109,8 @@ WHERE {
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
||||||
//Query per advanced search con obiettivo = 'Frase'
|
//Query per advanced search con obiettivo = 'Frase'
|
||||||
const clausetargetquery = `
|
const clausetargetquery = `
|
||||||
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
||||||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
||||||
PREFIX olires: <https://dantenetwork.it/ontology/olires/current/>
|
PREFIX olires: <https://dantenetwork.it/ontology/olires/current/>
|
||||||
|
@ -127,8 +127,8 @@ WHERE {
|
||||||
ecrm:P148i_is_component_of ?canto.
|
ecrm:P148i_is_component_of ?canto.
|
||||||
?cl syntit:hasClauseType ?clatype;
|
?cl syntit:hasClauseType ?clatype;
|
||||||
syntit:hasClauseFunction ?clafun.
|
syntit:hasClauseFunction ?clafun.
|
||||||
?seocc olires:occurrenceOf ?sentence;
|
#?seocc olires:occurrenceOf ?sentence;
|
||||||
olires:occursInRegion ?frag.
|
# olires:occursInRegion ?frag.
|
||||||
?claocc olires:occurrenceOf ?cl;
|
?claocc olires:occurrenceOf ?cl;
|
||||||
olires:occursInRegion ?fragcl.
|
olires:occursInRegion ?fragcl.
|
||||||
?fragcl olires:fragmentRegionFrom ?clfr;
|
?fragcl olires:fragmentRegionFrom ?clfr;
|
||||||
|
@ -137,15 +137,15 @@ WHERE {
|
||||||
?canto ecrm:P102_has_title ?t_canto;
|
?canto ecrm:P102_has_title ?t_canto;
|
||||||
olires:hasNumber ?num.
|
olires:hasNumber ?num.
|
||||||
?cantica ecrm:P102_has_title ?t_cantica;
|
?cantica ecrm:P102_has_title ?t_cantica;
|
||||||
olires:hasStructuralComponent ?canto.
|
olires:hasStructuralComponent ?canto.
|
||||||
BIND(CONCAT(STR(?clafun), ';') AS ?clafunction)
|
BIND(CONCAT(STR(?clafun), ';') AS ?clafunction)
|
||||||
BIND(STR(?clatype) AS ?clt)
|
BIND(STR(?clatype) AS ?clt)
|
||||||
FILTER (?clto > ?pos && ?clfr<?pos) .
|
#FILTER (?clto > ?pos && ?clfr<?pos) .
|
||||||
}`
|
}`
|
||||||
|
|
||||||
//bindConcatStatement
|
//bindConcatStatement
|
||||||
const clausetarget_functionbind=
|
const clausetarget_functionbind =
|
||||||
`{
|
`{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
"termType": "Variable",
|
"termType": "Variable",
|
||||||
|
@ -157,9 +157,9 @@ WHERE {
|
||||||
"args": []
|
"args": []
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
//clauseTypeBindConcatStatement
|
//clauseTypeBindStatement
|
||||||
const clausetarget_typebind=
|
const clausetarget_typebind =
|
||||||
`{
|
`{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
"termType": "Variable",
|
"termType": "Variable",
|
||||||
|
@ -167,19 +167,19 @@ WHERE {
|
||||||
},
|
},
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "operation",
|
"type": "operation",
|
||||||
"operator": "concat",
|
"operator": "",
|
||||||
"args": []
|
"args": []
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
*/
|
*/
|
||||||
//clausePosCoalesceStatement
|
//clausePosCoalesceStatement
|
||||||
const clausetarget_coalesce=
|
const clausetarget_coalesce =
|
||||||
`{
|
`{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
"termType": "Variable",
|
"termType": "Variable",
|
||||||
|
@ -192,6 +192,46 @@ WHERE {
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
const clausepos_filter=`
|
||||||
|
{
|
||||||
|
"type": "filter",
|
||||||
|
"expression": {
|
||||||
|
"type": "operation",
|
||||||
|
"operator": "&&",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"type": "operation",
|
||||||
|
"operator": ">",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"termType": "Variable",
|
||||||
|
"value": "clto"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"termType": "Variable",
|
||||||
|
"value": "pos_"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "operation",
|
||||||
|
"operator": "<",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"termType": "Variable",
|
||||||
|
"value": "clfr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"termType": "Variable",
|
||||||
|
"value": "pos_"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
//Query per advanced search con obiettivo = 'Periodo'
|
//Query per advanced search con obiettivo = 'Periodo'
|
||||||
const sentencetargetquery = `
|
const sentencetargetquery = `
|
||||||
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
||||||
|
@ -219,13 +259,13 @@ SELECT (?t_canto as ?Canto) (?t_cantica as ?Cantica) ?sentence ?clfr ?clto ?claf
|
||||||
olires:hasNumber ?num.
|
olires:hasNumber ?num.
|
||||||
?cantica ecrm:P102_has_title ?t_cantica;
|
?cantica ecrm:P102_has_title ?t_cantica;
|
||||||
olires:hasStructuralComponent ?canto.
|
olires:hasStructuralComponent ?canto.
|
||||||
#BIND(concat(str(?clatype1),";", str(?clatype2)) AS ?clatype)
|
#BIND((str(?clatype1),";", str(?clatype2)) AS ?clatype)
|
||||||
#BIND(COALESCE(?posgen,-1) AS ?pos)
|
#BIND(COALESCE(?posgen,-1) AS ?pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
const sentencetargetstatement_posCoalesce=JSON.parse(`{
|
const sentencetargetstatement_posCoalesce = JSON.parse(`{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
"termType": "Variable",
|
"termType": "Variable",
|
||||||
|
@ -253,8 +293,8 @@ const sentencetargetstatement_posCoalesce=JSON.parse(`{
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
|
|
||||||
const sentencetarget_functionbind=
|
const sentencetarget_functionbind =
|
||||||
`
|
`
|
||||||
{
|
{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
|
@ -269,8 +309,8 @@ const sentencetarget_functionbind=
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const sentencetarget_occbind=
|
const sentencetarget_occbind =
|
||||||
`
|
`
|
||||||
{
|
{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
|
@ -285,8 +325,8 @@ const sentencetarget_occbind=
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const sentencetarget_posbind=
|
const sentencetarget_posbind =
|
||||||
`
|
`
|
||||||
{
|
{
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"variable": {
|
"variable": {
|
||||||
|
@ -361,8 +401,8 @@ const sentencetarget_morphgroup = `{"type": "group",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const sentencetarget_morphgroup_short = `{"type": "group",
|
const sentencetarget_morphgroup_short = `{"type": "group",
|
||||||
"patterns": [{"type": "bgp",
|
"patterns": [{"type": "bgp",
|
||||||
"triples": [
|
"triples": [
|
||||||
{"subject": {"termType": "Variable","value": "fa"},
|
{"subject": {"termType": "Variable","value": "fa"},
|
||||||
|
@ -388,31 +428,31 @@ const sentencetarget_morphgroup = `{"type": "group",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const sentencetarget_posVariable=`{
|
const sentencetarget_posVariable = `{
|
||||||
"termType": "Variable",
|
"termType": "Variable",
|
||||||
"value": "pos"
|
"value": "pos"
|
||||||
}`
|
}`
|
||||||
|
|
||||||
const lemma_writtenrepresentation = `{"subject": {"termType": "Variable", "value":"cf"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#writtenRep"}, "object": {"termType": "Variable", "value": "lm"}}`
|
const lemma_writtenrepresentation = `{"subject": {"termType": "Variable", "value":"cf"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#writtenRep"}, "object": {"termType": "Variable", "value": "lm"}}`
|
||||||
const lemma_canonicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#canonicalForm"}, "object": {"termType": "Variable", "value": "cf"}}`
|
const lemma_canonicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#canonicalForm"}, "object": {"termType": "Variable", "value": "cf"}}`
|
||||||
const lemma_lexicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#lexicalForm"},
|
const lemma_lexicalform = `{"subject": {"termType": "Variable", "value":"lent"}, "predicate": {"termType":"NamedNode", "value": "http://www.w3.org/ns/lemon/ontolex#lexicalForm"},
|
||||||
"object": {"termType": "Variable", "value": "form"}}`
|
"object": {"termType": "Variable", "value": "form"}}`
|
||||||
|
|
||||||
const occurrenceof_form=`{"subject": {"termType": "Variable","value": "fa"},
|
const occurrenceof_form = `{"subject": {"termType": "Variable","value": "fa"},
|
||||||
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
|
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
|
||||||
"object": {"termType": "Variable","value": "form"}}`
|
"object": {"termType": "Variable","value": "form"}}`
|
||||||
const clauseocc_hascomponent_formocc=`{"subject": {"termType": "Variable","value": "cloccu"},
|
const clauseocc_hascomponent_formocc = `{"subject": {"termType": "Variable","value": "cloccu"},
|
||||||
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P148_has_component"},
|
"predicate": {"termType": "NamedNode","value": "http://erlangen-crm.org/current/P148_has_component"},
|
||||||
"object": {"termType": "Variable","value": "fa"}}`
|
"object": {"termType": "Variable","value": "fa"}}`
|
||||||
|
|
||||||
const occurrenceof_clause=`{"subject": {"termType": "Variable","value": "cloccu"},
|
const occurrenceof_clause = `{"subject": {"termType": "Variable","value": "cloccu"},
|
||||||
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
|
"predicate": {"termType": "NamedNode","value": "https://dantenetwork.it/ontology/olires/current/occurrenceOf"},
|
||||||
"object": {"termType": "Variable","value": "cl"}}`
|
"object": {"termType": "Variable","value": "cl"}}`
|
||||||
|
|
||||||
//DEFAULT QUERY PER SPARQL EDITOR
|
//DEFAULT QUERY PER SPARQL EDITOR
|
||||||
|
|
||||||
const defaultEditorQuery=`# ESEMPIO: i periodi della Commedia con una frase con tipo sintattico 'Subordinata Causale'
|
const defaultEditorQuery = `# ESEMPIO: i periodi della Commedia con una frase con tipo sintattico 'Subordinata Causale'
|
||||||
|
|
||||||
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
||||||
PREFIX syntit: <https://dantenetwork.it/ontology/syntit/current/>
|
PREFIX syntit: <https://dantenetwork.it/ontology/syntit/current/>
|
||||||
|
@ -430,5 +470,4 @@ WHERE {
|
||||||
olires:hasStructuralComponent ?q_canto.
|
olires:hasStructuralComponent ?q_canto.
|
||||||
} order by ?Cantica ?Canto`
|
} order by ?Cantica ?Canto`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -150,14 +150,14 @@ function getFraseContext(fraseids, numversi = 3) {
|
||||||
|
|
||||||
for (i = startindex; i < listaforme.length; i++) {
|
for (i = startindex; i < listaforme.length; i++) {
|
||||||
var tmpos = listaforme[i].split('_')[2]
|
var tmpos = listaforme[i].split('_')[2]
|
||||||
|
|
||||||
if (parseInt(tmpos) == parseInt(fraseid.split('-')[2])) {
|
if (parseInt(tmpos) == parseInt(fraseid.split('-')[2])) {
|
||||||
pos = i;
|
pos = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log (fraseid +" - " + parseInt(fraseid.split('-')[2])+ ' - '+pos)
|
console.log(fraseid + " - " + parseInt(fraseid.split('-')[2]) + ' - ' + pos)
|
||||||
|
|
||||||
var pos2 = pos
|
var pos2 = pos
|
||||||
|
|
||||||
if (fraseids.length > 1)
|
if (fraseids.length > 1)
|
||||||
|
@ -367,8 +367,8 @@ function getStatements() {
|
||||||
var theguiQ = ''
|
var theguiQ = ''
|
||||||
var multipleCondSpQuery = ''
|
var multipleCondSpQuery = ''
|
||||||
var bindConcatStatement = ''
|
var bindConcatStatement = ''
|
||||||
var clauseTypeBindConcatStatement=''
|
var clauseTypeBindConcatStatement = ''
|
||||||
var clausePosCoalesceStatement=''
|
var clausePosCoalesceStatement = ''
|
||||||
var occBindConcatStatement = ''
|
var occBindConcatStatement = ''
|
||||||
var posBindConcatStatement = ''
|
var posBindConcatStatement = ''
|
||||||
|
|
||||||
|
@ -377,25 +377,25 @@ var filters = []
|
||||||
var unionop = `{"union": {"type": "union", "patterns":[]}, "bgp": {"type": "bgp", "triples":[]}, "group": {"type": "group", "patterns":[]}}`
|
var unionop = `{"union": {"type": "union", "patterns":[]}, "bgp": {"type": "bgp", "triples":[]}, "group": {"type": "group", "patterns":[]}}`
|
||||||
|
|
||||||
|
|
||||||
|
var idtoken = 0;
|
||||||
|
|
||||||
function parseJsonClause(op, tokens, nowhere) {
|
function parseJsonClause(op, tokens, nowhere) {
|
||||||
//alert(op)
|
//alert(op)
|
||||||
var idp = -1
|
var idp = -1
|
||||||
if (nowhere[0].type == 'filter' && nowhere[0].expression.args[0].value == 'Rappresentazione') {
|
|
||||||
|
/*if (nowhere[0].type != null && nowhere[0].type == 'filter' && nowhere[0].expression.args[0].value == 'Rappresentazione') {
|
||||||
//nowhere.splice(0, 1)
|
//nowhere.splice(0, 1)
|
||||||
nowhere.splice(0, 2)
|
nowhere.splice(0, 2)
|
||||||
}
|
}*/
|
||||||
if (op.trim() == 'OR') {
|
if (op.trim() == 'OR') {
|
||||||
|
|
||||||
//nowhere.splice(1, 0, JSON.parse(unionop)['union'])
|
|
||||||
nowhere.splice(0, 0, JSON.parse(unionop)['union'])
|
nowhere.splice(0, 0, JSON.parse(unionop)['union'])
|
||||||
|
nowhere.splice(1, 0, clausePosCoalesceStatement)
|
||||||
idp = 0
|
idp = 0
|
||||||
}
|
}
|
||||||
if (op.trim() == 'AND') {
|
if (op.trim() == 'AND') {
|
||||||
|
|
||||||
//nowhere.splice(1, 0, JSON.parse(unionop)['group'])
|
|
||||||
nowhere.splice(0, 0, JSON.parse(unionop)['group'])
|
nowhere.splice(0, 0, JSON.parse(unionop)['group'])
|
||||||
//idp = 1
|
|
||||||
idp = 0
|
idp = 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -403,12 +403,12 @@ function parseJsonClause(op, tokens, nowhere) {
|
||||||
te_op = tokens[mtoken]
|
te_op = tokens[mtoken]
|
||||||
if ('TERM' in te_op) {
|
if ('TERM' in te_op) {
|
||||||
cond = theguiQ[te_op['TERM']]
|
cond = theguiQ[te_op['TERM']]
|
||||||
|
idtoken += 1;
|
||||||
multipleCondSpQuery = buildStatementClause(cond, multipleCondSpQuery, -1, nowhere[idp].patterns, mtoken)
|
multipleCondSpQuery = buildStatementClause(cond, multipleCondSpQuery, -1, nowhere[idp].patterns, idtoken, op.trim())
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
parseJsonClause(Object.keys(te_op)[0], te_op[Object.keys(te_op)[0]], nowhere.at(-1).patterns)
|
parseJsonClause(Object.keys(te_op)[0], te_op[Object.keys(te_op)[0]], nowhere[0].patterns)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,20 +422,24 @@ function buildSPQuery(guiquery) {
|
||||||
var SparqlParser = sparqljs.Parser;
|
var SparqlParser = sparqljs.Parser;
|
||||||
var spqparser = new SparqlParser();
|
var spqparser = new SparqlParser();
|
||||||
multipleCondSpQuery = spqparser.parse(ontoSparqlQueryMultCond);
|
multipleCondSpQuery = spqparser.parse(ontoSparqlQueryMultCond);
|
||||||
|
bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
||||||
|
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
|
||||||
|
posBindConcatStatement = JSON.parse(sentencetarget_posbind);
|
||||||
|
clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
|
||||||
|
|
||||||
if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
||||||
multipleCondSpQuery = spqparser.parse(clausetargetquery);
|
multipleCondSpQuery = spqparser.parse(clausetargetquery);
|
||||||
clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
|
//clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (theguiQ['unitaRicerca'] == 'periodo') {//Multiple Conditions
|
if (theguiQ['unitaRicerca'] == 'periodo') {//Multiple Conditions
|
||||||
multipleCondSpQuery = spqparser.parse(sentencetargetquery);
|
multipleCondSpQuery = spqparser.parse(sentencetargetquery);
|
||||||
bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
/*bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
||||||
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
|
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
|
||||||
posBindConcatStatement = JSON.parse(sentencetarget_posbind);
|
posBindConcatStatement = JSON.parse(sentencetarget_posbind);*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var parser = peg.generate(hdnquerygrammar);
|
var parser = peg.generate(hdnquerygrammar);
|
||||||
var test = guiquery['EsprLogica'].join(" ");
|
var test = guiquery['EsprLogica'].join(" ");
|
||||||
|
@ -444,21 +448,21 @@ function buildSPQuery(guiquery) {
|
||||||
var clauses = parser.parse(test);
|
var clauses = parser.parse(test);
|
||||||
//here get clauses
|
//here get clauses
|
||||||
var jsonclauses = JSON.parse(clauses)
|
var jsonclauses = JSON.parse(clauses)
|
||||||
|
idtoken = 0
|
||||||
for (const ck of Object.keys(jsonclauses)) {
|
for (const ck of Object.keys(jsonclauses)) {
|
||||||
parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where)
|
parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where)
|
||||||
|
|
||||||
|
/*if (ck.trim()=='OR' && (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso')) {
|
||||||
|
multipleCondSpQuery.where.push(clausePosCoalesceStatement)
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
/*if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
||||||
|
|
||||||
multipleCondSpQuery.where.push(clausePosCoalesceStatement)
|
multipleCondSpQuery.where.push(clausePosCoalesceStatement)
|
||||||
/*if (posBindConcatStatement['expression']['args'].length) {
|
|
||||||
multipleCondSpQuery.where.push(posBindConcatStatement)
|
|
||||||
multipleCondSpQuery.variables.push(JSON.parse(sentencetarget_posVariable))
|
|
||||||
//multipleCondSpQuery.where.push(sentencetargetstatement_posCoalesce)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}*/
|
||||||
if (theguiQ['unitaRicerca'] == 'periodo') {
|
if (theguiQ['unitaRicerca'] == 'periodo') {
|
||||||
multipleCondSpQuery.where.push(bindConcatStatement)
|
multipleCondSpQuery.where.push(bindConcatStatement)
|
||||||
multipleCondSpQuery.where.push(occBindConcatStatement)
|
multipleCondSpQuery.where.push(occBindConcatStatement)
|
||||||
|
@ -474,19 +478,19 @@ function buildSPQuery(guiquery) {
|
||||||
}
|
}
|
||||||
//preprocess multiple conditions query
|
//preprocess multiple conditions query
|
||||||
|
|
||||||
function processMultipleCond(rawquery){
|
function processMultipleCond(rawquery) {
|
||||||
for (var pc of rawquery['EsprLogica']){
|
for (var pc of rawquery['EsprLogica']) {
|
||||||
if (pc.startsWith('Clausola')){
|
if (pc.startsWith('Clausola')) {
|
||||||
//console.log(rawquery[pc])
|
//console.log(rawquery[pc])
|
||||||
if ((rawquery[pc]['typeSyntax0'].trim() != 'all' || rawquery[pc]['functionSyntax'].trim() != 'all') &&
|
if ((rawquery[pc]['typeSyntax0'].trim() != 'all' || rawquery[pc]['functionSyntax'].trim() != 'all') &&
|
||||||
rawquery[pc]['typeGramm0'].trim() == 'all') {//solo filtro sintattico
|
rawquery[pc]['typeGramm0'].trim() == 'all') {//solo filtro sintattico
|
||||||
rawquery[pc]["TipoClausola"]="Sintattico"
|
rawquery[pc]["TipoClausola"] = "Sintattico"
|
||||||
}
|
}
|
||||||
if ((rawquery[pc]['typeSyntax0'].trim() == 'all' && rawquery[pc]['functionSyntax'].trim() == 'all') &&
|
if ((rawquery[pc]['typeSyntax0'].trim() == 'all' && rawquery[pc]['functionSyntax'].trim() == 'all') &&
|
||||||
rawquery[pc]['typeGramm0'].trim() != 'all') {//solo filtro grammaticale
|
rawquery[pc]['typeGramm0'].trim() != 'all') {//solo filtro grammaticale
|
||||||
rawquery[pc]["TipoClausola"]="Grammaticale"
|
rawquery[pc]["TipoClausola"] = "Grammaticale"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rawquery
|
return rawquery
|
||||||
|
@ -505,11 +509,11 @@ function buildSQ(stquery) {
|
||||||
console.log(stquery)
|
console.log(stquery)
|
||||||
|
|
||||||
if (stquery['QueryAvanzata'] == 1 && stquery['EsprLogica'] != null && stquery['EsprLogica'].length > 1) {
|
if (stquery['QueryAvanzata'] == 1 && stquery['EsprLogica'] != null && stquery['EsprLogica'].length > 1) {
|
||||||
var processedquery=processMultipleCond(stquery)
|
var processedquery = processMultipleCond(stquery)
|
||||||
buildSPQuery(processedquery)
|
buildSPQuery(processedquery)
|
||||||
return multipleCondSpQuery;
|
return multipleCondSpQuery;
|
||||||
}
|
}
|
||||||
var clausolaS='Clausola0'
|
var clausolaS = 'Clausola0'
|
||||||
if (stquery['QueryAvanzata'] == 1 && stquery['EsprLogica'] != null && stquery['EsprLogica'] != '' && stquery['EsprLogica'].length == 1) {
|
if (stquery['QueryAvanzata'] == 1 && stquery['EsprLogica'] != null && stquery['EsprLogica'] != '' && stquery['EsprLogica'].length == 1) {
|
||||||
clause = stquery['EsprLogica']
|
clause = stquery['EsprLogica']
|
||||||
|
|
||||||
|
@ -588,7 +592,7 @@ function buildSQ(stquery) {
|
||||||
|
|
||||||
}
|
}
|
||||||
if (stquery[clause]['queryText'].trim() != "")
|
if (stquery[clause]['queryText'].trim() != "")
|
||||||
clausolaS=clause
|
clausolaS = clause
|
||||||
}
|
}
|
||||||
//Simple query
|
//Simple query
|
||||||
|
|
||||||
|
@ -672,7 +676,7 @@ function getFiltroContestoJson(datiContesto) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
function buildStatementClause(clause, parsedquery, whereind, theplace, token, op) {
|
||||||
//
|
//
|
||||||
var tmpgroup = ''
|
var tmpgroup = ''
|
||||||
if (clause['TipoClausola'] == "Sintattico") {
|
if (clause['TipoClausola'] == "Sintattico") {
|
||||||
|
@ -762,8 +766,9 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
||||||
"value": "pos`+ token + `"
|
"value": "pos`+ token + `"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}`
|
}`
|
||||||
if (theguiQ['unitaRicerca'] == 'periodo'){
|
|
||||||
|
if (theguiQ['unitaRicerca'] == 'periodo') {
|
||||||
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
|
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
|
||||||
tmppos = `{"termType": "Literal",
|
tmppos = `{"termType": "Literal",
|
||||||
"value": ";",
|
"value": ";",
|
||||||
|
@ -775,15 +780,26 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
||||||
}`
|
}`
|
||||||
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
|
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
tmppos = `{
|
||||||
tmppos=`{
|
"termType": "Variable",
|
||||||
"termType": "Variable",
|
"value": "pos`+ token + `"
|
||||||
"value": "pos`+ token + `"
|
}`
|
||||||
}`
|
if (op == 'OR') {
|
||||||
clausePosCoalesceStatement['expression']['args'].push(JSON.parse(tmppos))
|
clausePosCoalesceStatement['expression']['args'].push(JSON.parse(tmppos))
|
||||||
|
var orfilter=clausepos_filter.replaceAll("pos_", "pos")
|
||||||
|
if (!parsedquery['where'].includes(JSON.parse(orfilter)))
|
||||||
|
parsedquery['where'].push(JSON.parse(orfilter))
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
parsedquery['variables'].push(JSON.parse(tmppos))
|
||||||
|
var andfilter=clausepos_filter.replaceAll("pos_", "pos"+ token)
|
||||||
|
parsedquery['where'].push(JSON.parse(andfilter))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpgroup = JSON.parse(tmpg)
|
tmpgroup = JSON.parse(tmpg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
value: defaultEditorQuery
|
value: defaultEditorQuery
|
||||||
},
|
},
|
||||||
requestConfig : {
|
requestConfig : {
|
||||||
endpoint : "https://hdnlab1.isti.cnr.it/fuseki/commedia/query"
|
endpoint : "https://lida.dantenetwork.it/fuseki/commedia/query"
|
||||||
},
|
},
|
||||||
copyEndpointOnNewTab : false,
|
copyEndpointOnNewTab : false,
|
||||||
resizeable : true,
|
resizeable : true,
|
||||||
|
|
|
@ -937,91 +937,91 @@ WHERE {
|
||||||
<h5>Esempi di query sulla struttura</h5>
|
<h5>Esempi di query sulla struttura</h5>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_1)'>
|
1 <a href="#" class="link-info" onClick='writeQuery(query_1)'>
|
||||||
Versetti in cui compare una forma.</a>
|
Versetti in cui compare una forma.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_2)'>Versetti
|
2 <a href="#" class="link-info" onClick='writeQuery(query_2)'>Versetti
|
||||||
in cui compaiono parole che iniziano con una stringa.</a>
|
in cui compaiono parole che iniziano con una stringa.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_11)'>Le
|
3 <a href="#" class="link-info" onClick='writeQuery(query_11)'>Le
|
||||||
parole più frequenti in un libro.</a>
|
parole più frequenti in un libro.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_3)'>Versetti
|
4 <a href="#" class="link-info" onClick='writeQuery(query_3)'>Versetti
|
||||||
che si ripetono più volte.</a>
|
che si ripetono più volte.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_15)'>Le
|
5 <a href="#" class="link-info" onClick='writeQuery(query_15)'>Le
|
||||||
parole che compaiono in due libri, con il numero di occorrenze.</a>
|
parole che compaiono in due libri, con il numero di occorrenze.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_12)'>Le
|
6 <a href="#" class="link-info" onClick='writeQuery(query_12)'>Le
|
||||||
parole di un libro, che non compaiono in un altro libro.</a>
|
parole di un libro, che non compaiono in un altro libro.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<h5>Esempi di query sul 'livello linguistico'</h5>
|
<h5>Esempi di query sul 'livello linguistico'</h5>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_4)'>Cerco
|
7 <a href="#" class="link-info" onClick='writeQuery(query_4)'>Cerco
|
||||||
in un libro le forme associate ad un lemma.</a>
|
in un libro le forme associate ad un lemma.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_5)'>Cerco
|
8 <a href="#" class="link-info" onClick='writeQuery(query_5)'>Cerco
|
||||||
in tutta l'opera le forme associate ad un lemma.</a>
|
in tutta l'opera le forme associate ad un lemma.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_8)'>Cerco
|
9 <a href="#" class="link-info" onClick='writeQuery(query_8)'>Cerco
|
||||||
i verbi (lila:verb) presenti in un libro.</a>
|
i verbi (lila:verb) presenti in un libro.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-info" onClick='writeQuery(query_17)'>I verbi più frequenti in un libro.</a>
|
10 <a href="#" class="link-info" onClick='writeQuery(query_17)'>I verbi più frequenti in un libro.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_6)'>Cerco
|
11 <a href="#" class="link-danger" onClick='writeQuery(query_6)'>Cerco
|
||||||
i versetti di un libro in cui una parola in una specifica
|
i versetti di un libro in cui una parola in una specifica
|
||||||
posizione abbia categoria grammaticale 'lila:verb' (query
|
posizione abbia categoria grammaticale 'lila:verb' (query
|
||||||
distribuita sul dataset di LiLa).</a>
|
distribuita sul dataset di LiLa).</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_14)'>Cerco
|
12 <a href="#" class="link-danger" onClick='writeQuery(query_14)'>Cerco
|
||||||
i versetti di un libro in cui compaiano due parole consecutive
|
i versetti di un libro in cui compaiano due parole consecutive
|
||||||
che hanno rispettivamente categoria grammaticale 'lila:verb' e
|
che hanno rispettivamente categoria grammaticale 'lila:verb' e
|
||||||
'lila:noun'</a>
|
'lila:noun'</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_19)'>
|
13 <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'.
|
Le occorrenze delle categorie verbali (lila:POS) delle prime 4 parole dei versetti del libro 'Genesis'.
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_18)'>
|
14 <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'.
|
TEST! Le occorrenze delle categorie verbali (lila:POS) nelle sequenze di 4 parole nei versetti del libro 'Genesi'.
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_13)'>Cerco
|
15 <a href="#" class="link-danger" onClick='writeQuery(query_13)'>Cerco
|
||||||
le forme derivate da un lemma secondo le regole definite
|
le forme derivate da un lemma secondo le regole definite
|
||||||
dall'ontologia "Word Formation Latin" (WFL)</a>
|
dall'ontologia "Word Formation Latin" (WFL)</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_7)'>Termini
|
16 <a href="#" class="link-danger" onClick='writeQuery(query_7)'>Termini
|
||||||
con la stessa radice basati sulla proprieta lila:hasBase del
|
con la stessa radice basati sulla proprieta lila:hasBase del
|
||||||
lemma cercato.</a>
|
lemma cercato.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_16)'>Cerca
|
17 <a href="#" class="link-danger" onClick='writeQuery(query_16)'>Cerca
|
||||||
le forme associate ai lemmi appartenenti ad un SynSet della
|
le forme associate ai lemmi appartenenti ad un SynSet della
|
||||||
risorsa Latin WordNet pubblicata su LiLa</a>
|
risorsa Latin WordNet pubblicata su LiLa</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_9)'>Cerco
|
18 <a href="#" class="link-danger" onClick='writeQuery(query_9)'>Cerco
|
||||||
i verbi (lila:Verb) presenti in un libro e per ciascun lemma
|
i verbi (lila:Verb) presenti in un libro e per ciascun lemma
|
||||||
visualizzo la definizione nel dizionario Lewis & Short.</a>
|
visualizzo la definizione nel dizionario Lewis & Short.</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" class="link-danger" onClick='writeQuery(query_10)'>Cerco
|
19 <a href="#" class="link-danger" onClick='writeQuery(query_10)'>Cerco
|
||||||
in un capitolo di un libro le forme che hanno una particolare
|
in un capitolo di un libro le forme che hanno una particolare
|
||||||
stringa nella definizione del dizionario Lewis & Short.</a>
|
stringa nella definizione del dizionario Lewis & Short.</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in New Issue