Merge branch 'master' of https://gitea-s2i2s.isti.cnr.it/concordia/LiDa_Search.git
This commit is contained in:
commit
f82577225b
|
@ -1,9 +1,10 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis} from './dataMgr.js';
|
||||
import { getJsonQuery, emptyStructCard } from './script_5.0.js';
|
||||
import {resetGraphStr} from './syntgraph_5.0.js'
|
||||
import { getVersiConCitazioni, queryRiferimenti} from './dataMgr.js';
|
||||
|
||||
|
||||
export var resetResult;
|
||||
export var lsentid;
|
||||
|
@ -15,6 +16,8 @@ var vistaRiferimenti = true
|
|||
export var listaPeriodiRisultato;
|
||||
export var listaClausoleRisultato;
|
||||
export var numeroContesti;
|
||||
export var cantoDisplayed;
|
||||
const cantobadgeclass = 'badge badge-outline-warning badge-pill'
|
||||
const hdnNamespace = 'http://dantenetwork.it/data/commedia/'
|
||||
const syntitNamespace = 'https://dantenetwork.it/ontology/syntit/current/'
|
||||
|
||||
|
@ -31,7 +34,7 @@ $(document).ready(function() {
|
|||
}
|
||||
const dialogaltri = 'diaAltri'
|
||||
var listaClausoleRisultatoContesti = []
|
||||
const cantobadgeclass = 'badge badge-outline-warning badge-pill'
|
||||
|
||||
|
||||
const sparqlGenerator = sparqljs.Generator;
|
||||
const myEngine = new Comunica.QueryEngine();
|
||||
|
@ -52,7 +55,7 @@ $(document).ready(function() {
|
|||
const openSTag = "{"
|
||||
const closeSTag = "}"
|
||||
|
||||
var cantoDisplayed = "#InfernoCanto_1";
|
||||
cantoDisplayed = "#InfernoCanto_1";
|
||||
|
||||
var prevCantoDisplayed = "#InfernoCanto_1";
|
||||
var contextLength = 3;
|
||||
|
@ -551,7 +554,10 @@ $(document).ready(function() {
|
|||
//$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
|
||||
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
||||
|
||||
|
||||
var telive=getListaRis()
|
||||
for (var tel of telive){
|
||||
$(tel).addClass("mark ")
|
||||
}
|
||||
|
||||
drawMinimap("#" + $(this).attr('name').replace(" ", "_"), false)
|
||||
|
||||
|
@ -656,6 +662,8 @@ $(document).ready(function() {
|
|||
|
||||
return (cantica + '_' + mcanto.split('_')[1])
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loadPeriodo(idperiodo) {
|
||||
|
||||
|
@ -694,24 +702,6 @@ $(document).ready(function() {
|
|||
return false
|
||||
}
|
||||
|
||||
/*function loadFrase(idperiodo, funzionefrase) {
|
||||
|
||||
if (!isPeriodoInCanto(idperiodo, cantoDisplayed))
|
||||
return
|
||||
|
||||
$(cantoDisplayed).find(' .' + idperiodo).each(function() {
|
||||
var pstp = $(this).attr('class').split(" ")[1]
|
||||
|
||||
if (pstp.trim() == funzionefrase)
|
||||
$(this).css('color', colorssp(mapsynttypestopalette[pstp]));
|
||||
})
|
||||
|
||||
minim.contents().find(' .' + idperiodo).each(function() {
|
||||
var mpstp = $(this).attr('class').split(" ")[1]
|
||||
if (mpstp.trim() == funzionefrase)
|
||||
$(this).css('color', colorssp(mapsynttypestopalette[mpstp]));
|
||||
})
|
||||
}*/
|
||||
|
||||
function loadClausola(idperiodo, funzionefrase, fromn, ton) {
|
||||
|
||||
|
@ -897,6 +887,8 @@ $(document).ready(function() {
|
|||
if (canto.length == 1)
|
||||
canto = '0' + canto
|
||||
//commentsJson = getVersiConCitazioniJson(cantica, canto)
|
||||
|
||||
|
||||
var mresult =await getVersiConCitazioni(cantica, canto)
|
||||
|
||||
commentsSQL= Object.groupBy(mresult, ({ VersoCitazione }) => VersoCitazione);
|
||||
|
@ -919,7 +911,7 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
drawMinimap("#" + idminimap, false)
|
||||
console.log (commentsSQL)
|
||||
//console.log (commentsSQL)
|
||||
}
|
||||
|
||||
|
||||
|
@ -1500,7 +1492,15 @@ $(document).ready(function() {
|
|||
//manageMM (cantoDisplayed)
|
||||
//var currPage = 0;
|
||||
//var latestPhraseId = "";
|
||||
var telive=getListaRis()
|
||||
for (var ve of telive) {
|
||||
let idve = ve
|
||||
$(ve).removeClass("mark ")
|
||||
minim.contents().find(ve).removeClass("mark ")
|
||||
}
|
||||
cleanListaRis()
|
||||
drawMinimap(cantoDisplayed, true)
|
||||
|
||||
}
|
||||
|
||||
/*function manageMM(name) {
|
||||
|
@ -1526,7 +1526,7 @@ $(document).ready(function() {
|
|||
else
|
||||
unitaRicerca = jsonQuery['unitaRicerca']
|
||||
if (unitaRicerca=='riferimenti'){
|
||||
queryRiferimenti(jsonQuery.Riferimento100)
|
||||
var mres=queryRiferimenti(jsonQuery.Riferimento100, cantoDisplayed)
|
||||
return
|
||||
}
|
||||
console.log("got json query, unita ricerca: " + unitaRicerca)
|
||||
|
@ -1632,17 +1632,6 @@ $(document).ready(function() {
|
|||
|
||||
|
||||
|
||||
//manage sentence and clauses
|
||||
|
||||
/* function showSentenceStructure(sentence) {
|
||||
|
||||
sid = '.' + sentence.toString()
|
||||
//console.log(sid)
|
||||
$(sid).addClass('text-info font-italic')
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
function resetSentenceStructure(sentence) {
|
||||
$(" ." + sentence).removeClass('text-info font-italic')
|
||||
|
@ -1735,6 +1724,10 @@ $(document).ready(function() {
|
|||
|
||||
}
|
||||
}
|
||||
/*var telive=getListaRis()
|
||||
for (var tel of telive){
|
||||
$(tel).addClass("mark ")
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
|
148
js/dataMgr.js
148
js/dataMgr.js
|
@ -1,12 +1,15 @@
|
|||
import * as duckdb from 'https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.29.0/+esm';
|
||||
|
||||
|
||||
//import * as arrow from 'https://cdn.skypack.dev/apache-arrow@9'
|
||||
|
||||
|
||||
var rif_commentatori=[];
|
||||
var rif_autori=[];
|
||||
var rif_areetematiche=[];
|
||||
var rif_fonti=[];
|
||||
|
||||
var rif_commentatori = [];
|
||||
var rif_autori = [];
|
||||
var rif_areetematiche = [];
|
||||
var rif_fonti = [];
|
||||
var listaidversi = []
|
||||
const cantobadgeclassBis = 'badge badge-outline-warning badge-pill'
|
||||
|
||||
const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
|
||||
|
||||
|
@ -14,7 +17,7 @@ const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
|
|||
const bundle = await duckdb.selectBundle(JSDELIVR_BUNDLES);
|
||||
|
||||
const worker_url = URL.createObjectURL(
|
||||
new Blob([`importScripts("${bundle.mainWorker}");`], {type: 'text/javascript'})
|
||||
new Blob([`importScripts("${bundle.mainWorker}");`], { type: 'text/javascript' })
|
||||
);
|
||||
|
||||
// Instantiate the asynchronus version of DuckDB-wasm
|
||||
|
@ -24,7 +27,7 @@ const db = new duckdb.AsyncDuckDB(logger, worker);
|
|||
await db.instantiate(bundle.mainModule, bundle.pthreadWorker);
|
||||
URL.revokeObjectURL(worker_url);
|
||||
|
||||
console.log ('datamgr init done')
|
||||
console.log('datamgr init done')
|
||||
|
||||
|
||||
//await db.registerFileURL('remote.parquet', 'http://localhost:8000/js/data/riferimenti_3.parquet', DuckDBDataProtocol.HTTP, false);
|
||||
|
@ -40,76 +43,74 @@ await conn.query(`
|
|||
SELECT * FROM "https://lida.dantenetwork.it/js/data/riferimenti_3.parquet";
|
||||
`);
|
||||
|
||||
var table=await conn.query(`
|
||||
var table = await conn.query(`
|
||||
select distinct Aut from riferimenti order by Aut COLLATE NOCASE;
|
||||
`);
|
||||
const result = table.toArray().map((row) => row.toJSON());
|
||||
rif_autori=result.map((x) => x['Aut']);
|
||||
rif_autori = result.map((x) => x['Aut']);
|
||||
//console.log(rif_autori)
|
||||
|
||||
|
||||
var table=await conn.query(`
|
||||
var table = await conn.query(`
|
||||
select distinct Com from riferimenti;
|
||||
`);
|
||||
const result2 = table.toArray().map((row) => row.toJSON());
|
||||
rif_commentatori=result2.map((x) => x['Com']);
|
||||
rif_commentatori = result2.map((x) => x['Com']);
|
||||
|
||||
|
||||
|
||||
/*rif_commentatori.sort((a, b) => {
|
||||
var sre= (a.replace(/^\D+/g, '')-b.replace(/^\D+/g, ''))
|
||||
console.log(sre)
|
||||
return sre
|
||||
})*/
|
||||
//console.log(rif_commentatori)
|
||||
|
||||
|
||||
var table=await conn.query(`
|
||||
var table = await conn.query(`
|
||||
select distinct CA from riferimenti order by CA;
|
||||
`);
|
||||
const result3 = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
rif_areetematiche= result3.map((x) => x['CA']);
|
||||
rif_areetematiche = result3.map((x) => x['CA']);
|
||||
|
||||
|
||||
var table1=await conn.query(`
|
||||
select distinct TiFo from riferimenti;
|
||||
var table1 = await conn.query(`
|
||||
select distinct TiFo from riferimenti order by TiFo COLLATE NOCASE;
|
||||
`);
|
||||
const result4 = table1.toArray().map((row) => row.toJSON());
|
||||
rif_fonti=result4.map((x) => x['TiFo']);
|
||||
rif_fonti = result4.map((x) => x['TiFo']);
|
||||
|
||||
//console.log(rif_fonti)
|
||||
await conn.close();
|
||||
|
||||
console.log('done')
|
||||
export function getListaRis(){
|
||||
return listaidversi;
|
||||
}
|
||||
export function cleanListaRis(){
|
||||
listaidversi=[];
|
||||
}
|
||||
export function getFontiS() {
|
||||
|
||||
|
||||
return rif_fonti
|
||||
}
|
||||
|
||||
export function getAreeTematicheS() {
|
||||
|
||||
|
||||
return rif_areetematiche
|
||||
}
|
||||
|
||||
export function getAutoriFontiCitazioniS() {
|
||||
|
||||
|
||||
return rif_autori
|
||||
}
|
||||
|
||||
export function getCommentatoriS() {
|
||||
|
||||
|
||||
return rif_commentatori
|
||||
}
|
||||
|
||||
export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
||||
|
||||
|
||||
//let citcantiche = ['Inferno', 'Purgatorio', 'Paradiso']
|
||||
if (canticapar == '') {
|
||||
return
|
||||
}
|
||||
const tconn = await db.connect();
|
||||
var table=await tconn.query(`
|
||||
const tconn = await db.connect();
|
||||
var table = await tconn.query(`
|
||||
select Ann as Annotazione, Com as Commentario, FrN as frammentoNota, AC as AutoreCitazione,
|
||||
F as FonteCitazione, LF as LuogoFonteCitazione, NF as NotaFonteCitazione,
|
||||
TF as TestoFonteCitazione, UF as URLFonteCitazione, NaRi as NaturaRiferimento,
|
||||
|
@ -120,49 +121,82 @@ export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
|||
from riferimenti
|
||||
where Cantica='${canticapar}' and Canto='${cantopar}' order by verso;
|
||||
`);
|
||||
|
||||
|
||||
var result4 = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
|
||||
|
||||
|
||||
await tconn.close();
|
||||
return result4
|
||||
|
||||
|
||||
}
|
||||
export async function queryRiferimenti(filtro){
|
||||
if(filtro==null){
|
||||
export async function queryRiferimenti(filtro, cid) {
|
||||
if (filtro == null) {
|
||||
return
|
||||
}
|
||||
console.log(filtro)
|
||||
const tconn= await db.connect();
|
||||
var querytl='select Cantica, Canto, Verso from riferimenti'
|
||||
var queryfi=' where '
|
||||
if (filtro.Commentatore!=null && filtro.Commentatore.trim()!='all')
|
||||
queryfi+="Com='"+filtro.Commentatore.trim()+"'"
|
||||
const tconn = await db.connect();
|
||||
var querytl = 'select Cantica, Canto, Verso from riferimenti'
|
||||
var queryfi = ' where '
|
||||
if (filtro.Commentatore != null && filtro.Commentatore.trim() != 'all')
|
||||
queryfi += "Com='" + filtro.Commentatore.trim() + "'"
|
||||
else
|
||||
queryfi+="Com like '%'"
|
||||
if (filtro.Autore_Fonte!=null && filtro.Autore_Fonte.trim()!='all')
|
||||
queryfi+=" and Aut='"+filtro.Autore_Fonte.trim()+"'"
|
||||
queryfi += "Com like '%'"
|
||||
if (filtro.Autore_Fonte != null && filtro.Autore_Fonte.trim() != 'all')
|
||||
queryfi += " and Aut='" + filtro.Autore_Fonte.trim() + "'"
|
||||
if (filtro.Fonte != null && filtro.Fonte.trim() != 'all')
|
||||
queryfi += " and TiFo='" + filtro.Fonte.trim() + "'"
|
||||
|
||||
var rs= await tconn.query(querytl+queryfi)
|
||||
if (filtro.Area_Tematica != null && filtro.Area_Tematica.trim() != 'all')
|
||||
queryfi += " and CA='" + filtro.Area_Tematica.trim() + "'"
|
||||
|
||||
if (filtro.Tipo_Riferimento != null && filtro.Tipo_Riferimento.trim() != 'all')
|
||||
queryfi += " and NaRi='" + filtro.Tipo_Riferimento.trim().toUpperCase() + "'"
|
||||
|
||||
var rs = await tconn.query(querytl + queryfi)
|
||||
var result4 = rs.toArray().map((row) => row.toJSON());
|
||||
|
||||
|
||||
await tconn.close();
|
||||
var resxcantica= Object.groupBy(result4, ({ Cantica }) => Cantica);
|
||||
for (var cantica in resxcantica){
|
||||
var resxcantica = Object.groupBy(result4, ({ Cantica }) => Cantica);
|
||||
|
||||
listaidversi=[]
|
||||
var numcid = cid.split('_')[1]
|
||||
for (var cantica in resxcantica) {
|
||||
var $nctags = $(' .navig-canto')
|
||||
console.log(resxcantica[cantica].length)
|
||||
var i=1;
|
||||
if (cantica=='Purgatorio')
|
||||
i=2
|
||||
if (cantica=='Paradiso')
|
||||
i=3
|
||||
var i = 1;
|
||||
if (cantica == 'Purgatorio')
|
||||
i = 2
|
||||
if (cantica == 'Paradiso')
|
||||
i = 3
|
||||
var spanbadgecantica = $('<span />');
|
||||
spanbadgecantica.attr('class', 'badge badge-warning badge-pill mx-2');
|
||||
spanbadgecantica.append(resxcantica[cantica].length)
|
||||
spanbadgecantica.appendTo($('#cantica' + i + '-badge'))
|
||||
console.log(spanbadgecantica)
|
||||
|
||||
var tmp = resxcantica[cantica]
|
||||
var resxcanto = Object.groupBy(tmp, ({ Canto }) => Canto);
|
||||
for (var canto in resxcanto) {
|
||||
var tmpv = resxcanto[canto]
|
||||
var spanbadge = $('<span />');
|
||||
spanbadge.attr('class', cantobadgeclassBis);
|
||||
spanbadge.append(resxcanto[canto].length)
|
||||
if (canto.startsWith('0')) {
|
||||
canto = canto.replace('0', '')
|
||||
}
|
||||
spanbadge.appendTo($nctags.filter('[name="' + cantica + 'Canto ' + canto + '"]'))
|
||||
for (const tmpvi of tmpv) {
|
||||
let myveid = '#' + cantica + '_Canto_' + canto + '_' + tmpvi.Verso.split('-')[0]
|
||||
//console.log(myveid)
|
||||
listaidversi.push(myveid)
|
||||
if (cid.includes(cantica) && numcid == canto)
|
||||
$(myveid).addClass("mark ")
|
||||
}
|
||||
|
||||
}
|
||||
drawMinimap(cid, true)
|
||||
|
||||
}
|
||||
/*console.log(resxcantica)*/
|
||||
return
|
||||
|
||||
return listaidversi
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import commarc from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/index.js";*/
|
||||
import {Runtime, Library, Inspector} from "https://lida.dantenetwork.it/node_modules/commarcdiag/runtime.js";
|
||||
import commarc from "https://lida.dantenetwork.it/node_modules/commarcdiag/index.js";
|
||||
import {formaClass, lisid, lsentid, vistaPeriodi, listaPeriodiRisultato, listaClausoleRisultato} from "./browseMgr_5.0.js"
|
||||
import {formaClass, lisid, lsentid, vistaPeriodi, listaPeriodiRisultato, listaClausoleRisultato, cantoDisplayed} from "./browseMgr_5.0.js"
|
||||
import { fillStructCard, emptyStructCard } from "./script_5.0.js";
|
||||
|
||||
const iframe = document.getElementsByClassName("minimap__content");
|
||||
|
|
Loading…
Reference in New Issue