filtri contesto, in progress
This commit is contained in:
parent
7f920b036b
commit
f2addc279a
|
@ -29,17 +29,19 @@
|
|||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
font-family: -apple-system, BlinkMacSystemFont, “Helvetica Neue”,
|
||||
font-family: "Bracciolini", "Spectral", -apple-system, BlinkMacSystemFont, “Helvetica Neue”,
|
||||
“Segoe UI”, “Roboto”, “Oxygen”, “Ubuntu”, “Cantarell”,
|
||||
“Fira Sans”, “Droid Sans”,
|
||||
sans-serif;
|
||||
“Fira Sans”, “Droid Sans”, sans-serif;
|
||||
}
|
||||
|
||||
#displaycanto span:hover {
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
||||
.canto {
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -345,6 +345,9 @@ $(" ."+formaClass).hover(function(idx, element) {
|
|||
|
||||
elencoVersi.appendTo(elencoRisutati);
|
||||
}
|
||||
//add listeners
|
||||
addFormListeners()
|
||||
|
||||
$("#vistaFrasi").attr('style', 'display: d-flex;');
|
||||
|
||||
});
|
||||
|
@ -429,6 +432,32 @@ $(" ."+formaClass).hover(function(idx, element) {
|
|||
|
||||
//Utility functions
|
||||
|
||||
function addFormListeners(){
|
||||
|
||||
$(" ." + formaClass).each(function(idx, element) {
|
||||
var ele = $(element);
|
||||
ele.tooltip({
|
||||
content: (function() { return formatTTContent(ele.attr('title'), ele.attr('class').split(' ')[1]); }),
|
||||
classes: { "ui-tooltip": 'Nik_dropdown-content' },
|
||||
close: function(event, ui) { $(".ui-helper-hidden-accessible").remove(); },
|
||||
create: function(ev, ui) { $(this).data("ui-tooltip").liveRegion.remove(); },
|
||||
hide: false,
|
||||
show: false
|
||||
|
||||
});
|
||||
ele.hover(function(idx, element) {
|
||||
|
||||
sentenceId = $(this).attr('class').split(' ')[0].split('_')
|
||||
var tmplisid = sentenceId[0] + '_' + sentenceId[1] + '_' + sentenceId[3]
|
||||
lsentid = $(this).attr('class').split(' ')[0]
|
||||
lisid = tmplisid
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getCantica(numeroCantica){
|
||||
|
||||
switch (numeroCantica){
|
||||
|
@ -747,7 +776,7 @@ $(" ."+formaClass).hover(function(idx, element) {
|
|||
titolocanto.append(cantica + ", " + canto)
|
||||
divcanto.attr('class', 'canto')
|
||||
divcanto.css("display", "none")
|
||||
//divcanto.attr('style', 'display:none')
|
||||
|
||||
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
||||
titolocanto.appendTo(divcanto)
|
||||
divcanto.appendTo('#displaycanto')
|
||||
|
|
|
@ -4,32 +4,7 @@
|
|||
import {Runtime, Library, Inspector} from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/runtime.js";
|
||||
import commarc from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/index.js";
|
||||
|
||||
//import {Runtime, Library, Inspector} from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/runtime.js";
|
||||
//import commarc from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/index.js";
|
||||
|
||||
//const synttypes=["princ", "subord I","subord II","subord III","coord", "coord I", "coord II","subord IV","subord V","parent",
|
||||
// "coord III", "pcoord", "coord 0", "subord VI", "coord IV", "coord V", "pcoord I","subord VII"]
|
||||
|
||||
//var clausecolors=d3.scaleOrdinal(d3.schemeSet1).domain(synttypes)
|
||||
|
||||
/*const maptypes={"Ma": "princ", "SubI": "subord I", "SubII": "subord II", "SubIII": "subord III", "Co": "coord",
|
||||
"CoI": "coord I", "CoII": "coord II", "SubIV": "subord IV", "SubV": "subord V", "ParentethicalClause": "parent",
|
||||
"CoIII": "coord III", "ParentheticalCo":"pcoord", "PseudoCo": "oord 0", "SubVI": "subord VI" , "CoIV": "coord IV",
|
||||
"CoV": "coord V", "ParentheticalCoI": "pcoord I", "SubVII": "subord VII"}
|
||||
*/
|
||||
//const structpalette=d3.quantize(d3.interpolateHcl("#4d4193", "#60c96e"), 18)
|
||||
|
||||
/*const maptypestopalette={"Ma": 0, "SubI": 1, "SubII": 3, "SubIII": 4, "Co": 5,
|
||||
"CoI": 9, "CoII": 10, "SubIV": 5, "SubV": 6, "ParentethicalClause": 17,
|
||||
"CoIII": 11, "ParentheticalCo":14, "PseudoCo": 16, "SubVI": 7 , "CoIV": 12,
|
||||
"CoV": 13, "ParentheticalCoI": 15, "SubVII": 8}
|
||||
|
||||
var colorssp = d3.scaleQuantize()
|
||||
.domain([0,17])
|
||||
.range(["#3288bd", "#66c2a5", "#e41a1c", "#4daf4a", "#984ea3", "#d53e4f", "#f46d43", "#ABDDA4",
|
||||
"#E6F598", "#FFFFBF", "#FEE08B", "#FDAE61", "#F46D43",
|
||||
"#D53E4F", "#9E0142", "#e377c2", "#7f7f7f", "#bcbd22"]);
|
||||
*/
|
||||
const runtime1 = new Runtime(new Library(name => {
|
||||
console.log('name' +name)
|
||||
switch (name) {
|
||||
|
@ -39,8 +14,6 @@ const runtime1 = new Runtime(new Library(name => {
|
|||
}));
|
||||
|
||||
|
||||
|
||||
|
||||
document.addEventListener("dblclick", function(e){
|
||||
const target = e.target.closest("."+formaClass);
|
||||
|
||||
|
@ -62,23 +35,28 @@ document.addEventListener("dblclick", function(e){
|
|||
|
||||
sentence[i].classList.remove('font-weight-normal');
|
||||
}
|
||||
getDimensionsDiv()
|
||||
if (tmpsent==lsentid)
|
||||
|
||||
if (tmpsent==lsentid){
|
||||
getDimensionsDiv()
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var main=runtime1.module(commarc, name => {
|
||||
|
||||
if (name === "sentenceStructArcs")
|
||||
if (name === "sentenceStructArcs") {
|
||||
return new Inspector(document.querySelector("#displayinfo"));
|
||||
}
|
||||
});
|
||||
main.redefine('width', 648);
|
||||
main.redefine('height', 500);
|
||||
|
||||
|
||||
//main.redefine("links", d3.csv("https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/files/parsint_mod_completo_pre_new_4.csv", d3.autoType));
|
||||
|
||||
if (lisid!=''){
|
||||
|
||||
console.log('here graph '+lisid+' '+lsentid)
|
||||
main.redefine('width', 540);
|
||||
main.redefine("lisid", lisid);
|
||||
var collection = document.getElementsByClassName(lsentid);
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
|
@ -99,6 +77,7 @@ document.addEventListener("dblclick", function(e){
|
|||
|
||||
//collection[i].style.removeProperty('color');
|
||||
}
|
||||
getDimensionsDiv()
|
||||
}
|
||||
else
|
||||
return
|
||||
|
|
42
js/utils.js
42
js/utils.js
|
@ -322,7 +322,7 @@ function getFormaContext(formaid) {
|
|||
contextitem['cantica'] = cantica;
|
||||
contextitem['posizione'] = tmpform[2];
|
||||
contextitem['catg'] = tmpform[4];
|
||||
contextitem['periodo'] = cantica + '_' + tmpform[1] + '_' + tmpform[5];
|
||||
contextitem['periodo'] = cantica + '_' + tmpform[1] + '_s_' + tmpform[5];
|
||||
contextitem['funzperiodo'] = tmpform[6];
|
||||
context.push(contextitem);
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ function getFormaContext(formaid) {
|
|||
}
|
||||
|
||||
//restituisce la query per ottenere tutti i versi di una cantica: NON USATA: RIMUOVERE
|
||||
|
||||
/*
|
||||
function versiCantica(cantica) {
|
||||
var SparqlParser = sparqljs.Parser;
|
||||
var parser = new SparqlParser();
|
||||
|
@ -341,7 +341,7 @@ function versiCantica(cantica) {
|
|||
return (parsedqVersiCantica)
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
// the basic initial query is parsed RIMUOVERE
|
||||
|
||||
function gimmespq() {
|
||||
|
@ -496,7 +496,9 @@ function buildSQ(stquery) {
|
|||
if (stquery['Clausola0']['opzioni_testo'] == 'prefisso') {
|
||||
strval = "^" + searchtext.trim();
|
||||
}
|
||||
//COMPLETARE con regexp
|
||||
|
||||
var filtroContesto=getFiltroContesto(JSON.parse(stquery['Clausola0']['contesto']));
|
||||
|
||||
|
||||
parsedquery.where[0].expression.args[1].value = strval;
|
||||
if (stquery['Clausola0']['lemma_forma'] == 'lemma')
|
||||
|
@ -510,6 +512,22 @@ function buildSQ(stquery) {
|
|||
|
||||
return (parsedquery)
|
||||
|
||||
}
|
||||
|
||||
//Filtro Contesto
|
||||
|
||||
function getFiltroContesto(datiContesto){
|
||||
var cantica=0;
|
||||
for (contestoCantica of datiContesto){
|
||||
cantica++;
|
||||
for (const [index, element] of contestoCantica.entries()) {
|
||||
if(element==1)
|
||||
console.log('Cantica '+cantica+', Canto '+(parseInt(index)+1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function buildStatementClause(clause, parsedquery, whereind, theplace) {
|
||||
|
@ -629,8 +647,6 @@ function buildClause(clause, parsedquery, whereind) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
if (clause['typeGramm0'] != null && clause['typeGramm0'] != "all")
|
||||
if (whereind > -1)
|
||||
//parsedquery.where[whereind].triples.push(JSON.parse(data21)[clause['typeGramm0']]);
|
||||
|
@ -1188,13 +1204,13 @@ var syntgroup = ` {
|
|||
var funzione_clausola =
|
||||
{
|
||||
"princ": "hasClauseFunction:MainClause",
|
||||
"subord i": "hasClauseFunction:SubordinateClause",
|
||||
"subord ii": "",
|
||||
"subord iii": "",
|
||||
"subord iv": "",
|
||||
"subord v": "",
|
||||
"subord vi": "",
|
||||
"subord vii": "",
|
||||
"subord i": "hasClauseFunction:SubordinateClauseI",
|
||||
"subord ii": "hasClauseFunction:SubordinateClauseII",
|
||||
"subord iii": "hasClauseFunction:SubordinateClauseIII",
|
||||
"subord iv": "hasClauseFunction:SubordinateClauseIV",
|
||||
"subord v": "hasClauseFunction:SubordinateClauseV",
|
||||
"subord vi": "hasClauseFunction:SubordinateClauseVI",
|
||||
"subord vii": "hasClauseFunction:SubordinateClauseVII",
|
||||
"coord i": "hasClauseFunction:CoordinateClause",
|
||||
"coord ii": "",
|
||||
"coord iii": "",
|
||||
|
|
Loading…
Reference in New Issue