function handle_Letters(json, mittente, destinatario){
thead = '
\
Documento
\
Data di partenza
\
Data di arrivo
\
Luogo di partenza
\
Luogo di arrivo
\
';
var EventsTable = thead;
$.each(
json['results']['bindings'],
function (index, value) {
var uri_document = "";
var doc = "";
var time_span_from = "";
var time_span_to = "";
var uri_place_from = "";
var place_from = "";
var uri_place_to = "";
var place_to = "";
if(value.hasOwnProperty('uri_document')) {
uri_document = value['uri_document']['value'];
}
if(value.hasOwnProperty('document')) {
doc = value['document']['value'];
}
if(value.hasOwnProperty('time_span_from')) {
time_span_from = value['time_span_from']['value'];
}
if(value.hasOwnProperty('time_span_to')) {
time_span_to = value['time_span_to']['value'];
}
if(value.hasOwnProperty('uri_place_from')) {
uri_place_from = value['uri_place_from']['value'];
}
if(value.hasOwnProperty('place_from')) {
place_from = value['place_from']['value'];
}
if(value.hasOwnProperty('uri_place_to')) {
uri_place_to = value['uri_place_to']['value'];
}
if(value.hasOwnProperty('place_to')) {
place_to = value['place_to']['value'];
}
EventsTable += '
' +
'
' + doc + '
' +
'
' + time_span_from + '
' +
'
' + time_span_to + '
' +
'
' + place_from + '
' +
'
' + place_to + '
' +
'
';
});
document.getElementById("results_table").innerHTML = EventsTable;
document.getElementById("results_title").innerHTML = "Lettere da " + mittente + " a " + destinatario;
}
function handleLemma(json, lemma) {
let anni = [];
thead = '
\
Documento
\
Esplora
\
';
var DocumentsTable = thead;
var i = 0;
var anno = "";
$.each(
json['results']['bindings'],
function (index, value) {
var document = value['document']['value'];
var uri_document = value['uri_document']['value'];
var uri_info = "";
var type = "";
var date = "";
var year = "";
var month = "";
var day = "";
var sigla = "";
var text = "Nessun testo trovato";
var object_button = "";
if(value.hasOwnProperty('uri_infObj')) {
uri_info = value['uri_infObj']['value'];
}
if(value.hasOwnProperty('types')) {
type = value['types']['value'];
}
if(value.hasOwnProperty('time_span')) {
date = value['time_span']['value'];
}
if(value.hasOwnProperty('year')) {
year = value['year']['value'];
}
if(value.hasOwnProperty('month')) {
month = value['month']['value'];
}
if(value.hasOwnProperty('day')) {
day = value['day']['value'];
}
if(value.hasOwnProperty('text')) {
text = value['text']['value'];
}
if(value.hasOwnProperty('sigla')) {
sigla = value['sigla']['value'];
}
if (type.includes("lettera")) {
object_button = '';
} else {
object_button = '';
}
DocumentsTable += '
' +
'
' + document + '
' +
'
' + object_button + '
' +
'
';
var aaaa = "";
if (anno != year) {
anno = year;
aaaa = year;
createYearPoint(aaaa);
}
anni.push(year);
querySigla = prefixes + (queryManager['queryRES']['queryTrovaSigla']).replace('<{SIGLA}>', sigla).replace('<{LEMMA}>', lemma);
doJsonQuery(querySigla).done(function(r) { manageTimeline(r, date, aaaa, month, day, document, uri_document, text); });
let element = [date, year, month, day, document, uri_document, text, uri_info];
createTimelineNode(element);
i++;
});
let uniqueyears = [...new Set(anni)];
var AnniList = "
Anni
";
for (var i=0; i";
}
}
AnniList += "
";
document.getElementById("lemma_buttons").style.display = "flex";
document.getElementById("anni").innerHTML = AnniList;
document.getElementById("results_table").innerHTML = DocumentsTable;
document.getElementById("results_title").innerHTML = titleCase(lemma);
}
function manageTimeline(json, date, year, month, day, document, uri_document, text) {
num = "";
$.each(
json['results']['bindings'],
function (index, value) {
if(value.hasOwnProperty('id')) {
num = value['id']['value'];
}
});
var testo = text;
/*if (num != "") {
var toReplace = "n='" + num + "'";
var toSearch = "[a-z]+";
testo = text.replaceAll(toReplace, "class='highlight'");
let rr = toSearch.replace("numero", num)
let rer = new RegExp(rr);
var pos = text.search(rer);
var searchedString = text.match(rer);
const regex = new RegExp(//);
text.replace(regex, num);
let regE = new RegExp("[0-9]+[]a$|[0-9]+[]" , 'g')
var result = String("la tua stringa").match(regE );
var ss = pos-150;
var ee = pos+150;
var start = 0;
var end = ee;
if (ss<0) {
start = 0;
} else {
start = ss;
}
testo = text.substring(start, end)
console.log([start, end, testo]);
} else {
testo = text;
}*/
}
function createTimelineNode(array) {
var data = array[0];
var anno = array[1];
var mese = array[2];
var giorno = array[3];
var titolo = array[4];
var testo = array[6];
var link = array[5];
var infObj = array[7]
var TimelineNode = '
' +
'
' +
''+ data +'' +
'
' +
'
' +
'' +
'
' +
'
' +
'
' +
'' + titolo + '' +
'
' +
'
' +
'
' + testo + '
' +
'
' +
'
';
document.getElementById("docTimeline").innerHTML += TimelineNode;
}
function createYearPoint(anno) {
var TimelineNode = '
' +
'
' +
'' + anno + '' +
'
';
document.getElementById("docTimeline").innerHTML += TimelineNode;
}
function handle_map(json) {
console.log(json);
const locations = [];
const place_names = [];
var lat = 0;
var long = 0;
var i=0;
var myPlaces = "";
$.each(
json['results']['bindings'],
function (index, value) {
const loc = []
var uri = value['place']['value'];
var label = value['label']['value'];
var coord = value['coordinates']['value'];
const coordinates = coord.split(", ");
loc.push(label);
//myPlaces += "