var link = thisUrlParams.link;
prefixes = queryManager['prefixes']['all'];
query = prefixes + (queryManager['querySchedaPersona']['queryInfo']).replace('{URI}', link);
doJsonQuery(query).done(function(data) { handle_data(data); });
queryURL = prefixes + (queryManager['querySchedaPersona']['query']).replace('{URI}', link);
doJsonQuery(queryURL).done(function(data) { handle_map(data); });
queryEx = prefixes + (queryManager['querySchedaPersona']['queryLetters']).replace('{URI}', link);
doJsonQuery(queryEx).done(function(data) { handle_Letters(data); });
queryOA = prefixes + (queryManager['querySchedaPersona']['queryOpere']).replace('{URI}', link);
doJsonQuery(queryOA).done(function(data) { handle_Artwork(data); });
queryOt = prefixes + (queryManager['querySchedaPersona']['queryOtherDoc']).replace('{URI}', link);
doJsonQuery(queryOt).done(function(data) { handle_Other_Documents(data); });
queryGt = prefixes + (queryManager['querySchedaPersona']['queryGettatelliEv']).replace('{URI}', link);
doJsonQuery(queryGt).done(function(data) { handle_Gettatelli(data); });
queryInfoGt = prefixes + (queryManager['querySchedaPersona']['queryInfoGettatelli']).replace('{URI}', link);
doJsonQuery(queryInfoGt).done(function(data) { handle_InfoGettatelli(data); });
queryRel = prefixes + (queryManager['querySchedaPersona']['queryRelazioni']).replace('{URI}', link);
doJsonQuery(queryRel).done(function(data) { handle_Relazioni(data); });
queryRelIn = prefixes + (queryManager['querySchedaPersona']['queryRelazioniInverse']).replace('{URI}', link);
doJsonQuery(queryRelIn).done(function(data) { handle_RelazioniInverse(data); });
queryCom = prefixes + (queryManager['querySchedaPersona']['queryCompagnia']).replace('{URI}', link);
doJsonQuery(queryCom).done(function(data) { handle_Compagnia(data); });
queryEv = prefixes + (queryManager['querySchedaPersona']['queryEventi']).replace('{URI}', link);
doJsonQuery(queryEv).done(function(data) { handle_Events(data); });
queryCon = prefixes + (queryManager['querySchedaPersona']['queryContrassegni']).replace('{URI}', link);
doJsonQuery(queryCon).done(function(data) { handle_Contrassegni(data); });
queryRif = prefixes + (queryManager['querySchedaPersona']['queryRiferimenti']).replace('{URI}', link);
doJsonQuery(queryRif).done(function(data) { handle_Riferimenti(data); });
queryOcc = prefixes + (queryManager['querySchedaPersona']['queryOccupazione']).replace('{URI}', link);
doJsonQuery(queryOcc).done(function(data) { handle_Occupations(data); });
var labelName = "";
function handle_data(json) {
var graph = "";
var label = "";
if ("givenName" in json.results.bindings) {
givenName = value['givenName']['value'];
}
$.each(
json['results']['bindings'],
function (index, value) {
var graph = value['graph']['value'];
var uri = value['uri']['value'];
var label = value['label']['value'];
var name = value['name']['value'];
var givenName = "";
var familyName = "";
var alias = "";
var gender = "";
var patronymic = "";
var occupation = "";
var relative2 = "";
var relative3 = "";
var identifier = "";
var id_type = "";
var birth_date = "";
var birth_place = "";
var death_date = "";
var death_place = "";
var qualification = "";
var group = "";
var type = "";
var provenence = "";
var variants = "";
if ((value.hasOwnProperty('identifier')) && (value.hasOwnProperty('id_type'))) {
$("#identifier").css("display", "flex");
identifier = value['identifier']['value'];
id_type = value['id_type']['value'];
}
if (value.hasOwnProperty('givenName')) {
$("#givenName").css("display", "flex");
givenName = value['givenName']['value'];
}
if (value.hasOwnProperty('familyName')) {
$("#familyName").css("display", "flex");
familyName = value['familyName']['value'].toLowerCase();
familyName = familyName.charAt(0).toUpperCase() + familyName.slice(1);
}
if (value.hasOwnProperty('alias')) {
$("#aliasName").css("display", "flex");
alias = value['alias']['value'];
}
if (value.hasOwnProperty('gender')) {
$("#gender").css("display", "flex");
gender = value['gender']['value'];
}
if (value.hasOwnProperty('patronymic')) {
$("#patronymic").css("display", "flex");
patronymic = value['patronymic']['value'];
}
if (value.hasOwnProperty('provenienza')) {
$("#PlaceProvenence").css("display", "flex");
provenence = value['provenienza']['value'];
}
if (value.hasOwnProperty('occupation')) {
$("#occupation").css("display", "flex");
occupation = value['occupation']['value'];
}
if (value.hasOwnProperty('relative2')) {
relative2 = value['relative2']['value'];
}
if (value.hasOwnProperty('relative3')) {
relative3 = value['relative3']['value'];
}
if (value.hasOwnProperty('qualification')) {
$("#honorific").css("display", "flex");
qualification = value['qualification']['value'];
}
if (value.hasOwnProperty('person_type')) {
$("#type").css("display", "flex");
type = value['person_type']['value'];
}
if (value.hasOwnProperty('Birth_Date')) {
$("#BirthDate").css("display", "flex");
birth_date = value['Birth_Date']['value'];
}
if (value.hasOwnProperty('Birth_Place')) {
$("#BirthPlace").css("display", "flex");
birth_place = value['Birth_Place']['value'];
}
if (value.hasOwnProperty('Death_Date')) {
$("#DeathDate").css("display", "flex");
death_date = value['Death_Date']['value'];
}
if (value.hasOwnProperty('Death_Place')) {
$("#DeathPlace").css("display", "flex");
death_place = value['Death_Place']['value'];
}
if (value.hasOwnProperty('group')) {
$("#groups").css("display", "flex");
group = value['group']['value'];
}
if (value.hasOwnProperty('variants')) {
if (value['variants']['value'] != "| ") {
alert(value['variants']['value']);
$("#otherNames").css("display", "flex");
let strings = value['variants']['value'];
variants = strings.split(";");
}
}
var dataset = get_dataset_name(graph);
var second_name = patronymic;
if (relative2 != "") {
second_name = second_name + " " + relative2;
}
if (relative3 != "") {
second_name = second_name + " " + relative3;
}
if (familyName != "") {
second_name = second_name + " " + familyName;
}
var first_name = "";
if ((givenName != "") || (second_name != "") || (provenence != "")) {
first_name = givenName + " " + second_name + " " + provenence;
} else {
first_name = name;
}
first_name = first_name.replace(",", "");
first_name = titleCase(first_name);
name = titleCase(name);
givenName = titleCase(givenName);
var name_string = "";
if (variants.length>0) {
for (var i=0; i" + chunk[1] + " ";
}
}
labelName = first_name;
var Buttons = ' \
\
\
\
';
var id_snippet = "" + id_type + ":
" + identifier + "
";
document.getElementById("grafo").innerHTML = dataset;
document.getElementById("nome_persona").innerHTML = first_name;
document.getElementById("nome").innerHTML = name;
document.getElementById("genere").innerHTML = gender;
document.getElementById("nome_proprio").innerHTML = givenName;
document.getElementById("nome_famiglia").innerHTML = familyName;
document.getElementById("patronimico").innerHTML = second_name.replace("di ", "");
document.getElementById("provenienza").innerHTML = provenence;
document.getElementById("identifier").innerHTML = id_snippet;
document.getElementById("alias").innerHTML = alias;
document.getElementById("tipologia").innerHTML = type;
document.getElementById("variants").innerHTML = name_string;
document.getElementById("qualifica").innerHTML = qualification;
document.getElementById("occupazione").innerHTML = occupation;
document.getElementById("data_nascita").innerHTML = birth_date;
document.getElementById("data_morte").innerHTML = death_date;
document.getElementById("luogo_nascita").innerHTML = birth_place;
document.getElementById("luogo_morte").innerHTML = death_place;
document.getElementById("gruppi_appartenenza").innerHTML = group;
document.getElementById("link_buttons").innerHTML = Buttons;
const collection = document.getElementsByClassName("PN");
for (var i=0; iScheda Oggetto
';
}
document.getElementById("scheda_anagrafica").innerHTML = card;
document.getElementById("btn_scheda").innerHTML = button_obj;
}
function handle_Gettatelli(json) {
//console.log(json);
var generic = "";
var find = "";
var reunite = "";
var adoption = "";
$.each(
json['results']['bindings'],
function (index, value) {
var event_type = value['event_type']['value'];
var data = value['time_span']['value'];
if (event_type == "Evento generico") {
$("#generic_event").css("display", "flex");
generic = data;
}
else if (event_type == "Ritrovamento") {
$("#find_event").css("display", "flex");
find = data;
}
else if (event_type == "Ricongiungimento") {
$("#reunion_event").css("display", "flex");
reunite = data;
}
else if (event_type == "Adozione") {
$("#adoption_event").css("display", "flex");
adoption = data;
}
});
document.getElementById("anno").innerHTML = generic;
document.getElementById("ritrovamento").innerHTML = find;
document.getElementById("ricongiungimento").innerHTML = reunite;
document.getElementById("adozione").innerHTML = adoption;
}
function handle_Relazioni(json) {
//console.log(json);
var Relazioni = "";
const myArray = []
$.each(
json['results']['bindings'],
function (index, value) {
var tipo = value['relation_type']['value'];
var uri_person = value['uri_person']['value'];
var nome = value['name']['value'];
var principale = "";
var givenName = "";
var familyName = "";
var patronymic = "";
var provenence = "";
if (value.hasOwnProperty('givenName')) {
givenName = value['givenName']['value'];
}
if (value.hasOwnProperty('note')) {
principale = " principale";
}
if (value.hasOwnProperty('familyName')) {
familyName = value['familyName']['value'].toLowerCase();
familyName = familyName.charAt(0).toUpperCase() + familyName.slice(1)
}
if (value.hasOwnProperty('patronymic')) {
patronymic = value['patronymic']['value'];
}
if (value.hasOwnProperty('provenienza')) {
provenence = value['provenienza']['value'];
}
var type = tipo.charAt(0).toUpperCase() + tipo.slice(1) + principale;
if ((type == "Socio") || (type == "Socio principale")) {
type = "Società ";
}
if (type == "Mano lettera") {
type = "Altre collaborazioni"
}
var first_name = "";
if ((givenName != "") || (patronymic != "") || (familyName != "") || (provenence != "")) {
first_name = givenName + " " + patronymic + " " + familyName + " " + provenence;
} else {
first_name = nome;
}
myArray.push([type, first_name, uri_person]);
});
const checkRel = [];
for (var i=0; i", type).replace("", id);
return htmlCode;
}
function createColRelazione(text, link) {
htmlCode = '\
\
\
\
\
\
Scheda Persona
\
\
\
\
\
'.replace("", text).replace("", link);
return htmlCode;
}
function handle_Events(json) {
let events = {};
var i = 0;
$.each(
json['results']['bindings'],
function (index, value) {
var event_type = value['event_type']['value'];
var role = value['role']['value'];
var uri_document = value['uri_document']['value'];
var document = value['document']['value'];
var time_span = "";
var uri_place1 = "";
var uri_place2 = "";
var uri_place3 = "";
var uri_place4 = "";
var place1 = "";
var place2 = "";
var place3 = "";
var place4 = "";
var coords1 = "";
var coords2 = "";
var coords3 = "";
var coords4 = "";
if (value.hasOwnProperty('time_span')) {
time_span = value['time_span']['value'];
}
if (value.hasOwnProperty('uri_place')) {
uri_place1 = value['uri_place']['value'];
}
if (value.hasOwnProperty('coords')) {
coords1 = value['coords']['value'];
}
if (value.hasOwnProperty('place')) {
place1 = value['place']['value'];
place1 = titleCase(place1);
}
if (value.hasOwnProperty('uri_place2')) {
uri_place2 = value['uri_place2']['value'];
}
if (value.hasOwnProperty('coords2')) {
coords2 = value['coords2']['value'];
}
if (value.hasOwnProperty('place2')) {
place2 = value['place2']['value'];
place2 = titleCase(place2);
}
if (value.hasOwnProperty('uri_place3')) {
uri_place3 = value['uri_place3']['value'];
}
if (value.hasOwnProperty('coords3')) {
coords3 = value['coords3']['value'];
}
if (value.hasOwnProperty('place3')) {
place3 = value['place3']['value'];
place3 = titleCase(place3);
}
if (value.hasOwnProperty('uri_place4')) {
uri_place4 = value['uri_place4']['value'];
}
if (value.hasOwnProperty('coords4')) {
coords4 = value['coords4']['value'];
}
if (value.hasOwnProperty('place4')) {
place4 = value['place4']['value'];
place4 = titleCase(place4);
}
let cells = {"evento": event_type, "ruolo": role, "data": time_span, "uri_documento": uri_document, "documento": document, "uri_luogo1": uri_place1, "luogo1": place1, "coords1": coords1, "uri_luogo2": uri_place2, "luogo2": place2, "coords2": coords2, "uri_luogo3": uri_place3, "luogo3": place3, "coords3": coords3, "uri_luogo4": uri_place4, "luogo4": place4, "coords4": coords4};
events[i] = cells;
i++;
});
var thead = '' +
'Evento ' +
'Ruolo ' +
'Data ' +
'Luogo ' +
'Documento ' +
' ';
var EventsTable = thead;
EventsTable += '';
console.log(events);
for (i in events) {
console.log(events);
var sniPlace = "";
var sniPlace1 = "";
var sniPlace2 = "";
var sniPlace3 = "";
var sniPlace4 = "";
if (events[i]['coords1'] != "") {
sniPlace1 = '' + events[i]['luogo1'] + ' ';
} else {
sniPlace1 = events[i]['luogo1'];
}
if (events[i]['coords2'] != "") {
sniPlace2 = '' + events[i]['luogo2'] + ' ';
} else {
sniPlace2 = events[i]['luogo2'];
}
if (events[i]['coords3'] != "") {
sniPlace3 = '' + events[i]['luogo3'] + ' ';
} else {
sniPlace3 = events[i]['luogo3'];
}
if (events[i]['coords4'] != "") {
sniPlace4 = '' + events[i]['luogo4'] + ' ';
} else {
sniPlace4 = events[i]['luogo4'];
}
if (sniPlace1 != "") {
sniPlace = sniPlace1;
}
if (sniPlace2 != "") {
sniPlace = sniPlace + " < " + sniPlace2;
}
if (sniPlace3 != "") {
sniPlace = sniPlace + " < " + sniPlace3;
}
if (sniPlace4 != "") {
sniPlace = sniPlace + " < " + sniPlace4;
}
EventsTable += '' +
'' + events[i]['evento'] + ' ' +
'' + events[i]['ruolo'] + ' ' +
'' + events[i]['data'] + ' ' +
'' + sniPlace + ' ' +
'' + events[i]['documento'] + ' ' +
' ';
}
EventsTable += ' ';
if (Object.keys(events).length != 0) {
document.getElementById("res_events").innerHTML = EventsTable;
} else {
var eventIcon = " \
\
\
\
\
\
Nessun evento trovato
\
";
document.getElementById("res_events_container").style.display = "none";
document.getElementById("res_events_no_res").innerHTML = eventIcon;
}
}
function handle_Compagnia(json) {
//console.log(json);
var denominazione = "";
var sede = "";
var uri_sede = "";
var uri_place = "";
$.each(
json['results']['bindings'],
function (index, value) {
if (value.hasOwnProperty('denomination')) {
$("#type_society").css("display", "flex");
denominazione = value['denomination']['value'];
}
if (value.hasOwnProperty('uri_place')) {
$("#sede").css("display", "flex");
uri_place = value['uri_place']['value'];
}
if (value.hasOwnProperty('uri_sede')) {
$("#sede").css("display", "flex");
uri_sede = value['uri_sede']['value'];
}
if (value.hasOwnProperty('sede')) {
sede = value['sede']['value'];
}
});
}
function handle_Contrassegni(json) {
console.log(json);
var id_image = "";
var name_image = "";
var uri = "";
$.each(
json['results']['bindings'],
function (index, value) {
if (value.hasOwnProperty('image')) {
$("#mark_image").css("display", "block");
id_image = value['image']['value'];
}
if (value.hasOwnProperty('contrassegno')) {
name_image = value['contrassegno']['value'];
}
uri = value['uri_image']['value'];
});
var Image = ' '
document.getElementById("contrassegno").innerHTML = Image;
document.getElementById("nome_contrassegno").innerHTML = titleCase(name_image);
}
function handle_Letters(json) {
//console.log(json);
const send = [];
const receive = [];
var i=0;
var j=0;
$.each(
json['results']['bindings'],
function (index, value) {
type = value['type']['value'];
uri = value['document_uri']['value'];
title = value['document_name']['value'];
segnatura = value['segnatura']['value'];
var data = "";
var InfObj = "";
if (value.hasOwnProperty('time_span')) {
data = value['time_span']['value'];
}
if (value.hasOwnProperty('InfObj')) {
InfObj = value['InfObj']['value'];
}
if (type == "Invio") {
send.push([uri, title, segnatura, data, InfObj]);
i++;
} else {
receive.push([uri, title, segnatura, data, InfObj]);
j++;
}
});
var Send_Letters = "";
var Receive_Letters = "";
//POPULATE SEND LETTERS BOX
for (var i=0; i'+ send[i][1] + '';
object_type = "lettera";
infObject_button += 'Scheda Lettera
';
} else {
letter = ''+ send[i][1] + ' ';
object_type = "object";
infObject_button += 'Scheda Oggetto
';
}
if (send[i][2] != "") {
letter = letter + " Segnatura: " + send[i][2];
}
if (send[i][3] != "") {
letter = letter + " Data: " + send[i][3];
}
letter = letter + '
';
Send_Letters += ''+ letter +
'
' + infObject_button +
'
Citazione
' +
'
Hyperlink
' +
'
Lod
';
}
//POPULATE RECEIVE LETTERS BOX
for (var i=0; i'+ receive[i][1] + '';
object_type = "lettera";
infObject_button += 'Scheda Lettera
';
} else {
letter = ''+ receive[i][1] + ' ';
object_type = "object";
infObject_button += 'Scheda Oggetto
';
}
if (receive[i][2] != "") {
letter = letter + " Segnatura: " + receive[i][2];
}
if (receive[i][3] != "") {
letter = letter + " Data: " + receive[i][3];
}
letter = letter + '
';
Receive_Letters += ''+ letter +
'
' + infObject_button +
'
Citazione
' +
'
Hyperlink
' +
'
Lod
';
}
document.getElementById("l_send").innerHTML = send.length;
document.getElementById("l_receive").innerHTML = receive.length;
document.getElementById("letters_send").innerHTML = Send_Letters;
document.getElementById("letters_receive").innerHTML = Receive_Letters;
if (send.length==0) {
var messaggio = "Nessun risultato trovato
";
document.getElementById("letters_send").innerHTML = messaggio;
}
if (receive.length==0) {
var messaggio = "Nessun risultato trovato
";
document.getElementById("letters_receive").innerHTML = messaggio;
}
}
function handle_Artwork(json) {
//console.log(json);
const oa = [];
$.each(
json['results']['bindings'],
function (index, value) {
uri = value['subject']['value'];
label = value['label']['value'];
nct = value['nct']['value'];
var data = "";
if (value.hasOwnProperty('time_span')) {
data = value['time_span']['value'];
}
oa.push([uri, label, nct, data]);
});
var Artworks = "";
for (var i=0; i' + oa[i][1] + ' NCT: ' + oa[i][2];
if (oa[i][3] != "") {
artwork = artwork + " Data: " + oa[i][3];
}
var object_button = 'Scheda Opera d\'Arte
';
Artworks += '' +
'
' + object_button +
'
Citazione
' +
'
Hyperlink
' +
'
Lod
';
}
document.getElementById("n_oa").innerHTML = oa.length;
document.getElementById("object_oa").innerHTML = Artworks;
if (oa.length==0) {
var messaggio = "Nessun risultato trovato
";
document.getElementById("object_oa").innerHTML = messaggio;
}
}
function handle_Other_Documents(json) {
//console.log(json);
const doc = [];
$.each(
json['results']['bindings'],
function (index, value) {
uri = value['document']['value'];
label = value['label']['value'];
var data = "";
var id = "";
if (value.hasOwnProperty('time_span')) {
data = value['time_span']['value'];
}
if (value.hasOwnProperty('id')) {
id = value['id']['value'];
}
doc.push([uri, label, id, data]);
});
var Documents = "";
for (var i=0; i'+ doc[i][1] + '';
var object_button = 'Scheda Oggetto
';
if (doc[i][2] != "") {
paper = paper + " Segnatura: " + doc[i][2];
}
if (doc[i][3] != "") {
paper = paper + " Data: " + doc[i][3];
}
paper = paper + '
';
Documents += ''+ paper +
'
' + object_button +
'
Citazione
' +
'
Hyperlink
' +
'
Lod
';
}
document.getElementById("n_ass").innerHTML = doc.length;
document.getElementById("other_documents").innerHTML = Documents;
if (doc.length==0) {
var messaggio = "Nessun risultato trovato
";
document.getElementById("other_documents").innerHTML = messaggio;
}
}
function handle_Riferimenti(json) {
var uri_same = "";
$.each(
json['results']['bindings'],
function (index, value) {
if (value.hasOwnProperty('uri_same')) {
$("#REF").css("display", "flex");
uri_same += '' + value['uri_same']['value'] + ' ';
}
});
console.log(uri_same);
document.getElementById("same_as").innerHTML = uri_same;
}
function handle_Occupations(json) {
var OW = "";
$.each(
json['results']['bindings'],
function (index, value) {
var occupation = "";
var worklocation = "";
if (value.hasOwnProperty('occupation')) {
$("#workHistory").css("display", "flex");
occupation = titleCase(value['occupation']['value']);
}
if (value.hasOwnProperty('worklocation')) {
worklocation = " presso " + titleCase(value['worklocation']['value']);
}
OW += occupation + " " + worklocation + " ";
});
document.getElementById("jobs").innerHTML = OW;
}
function handle_map(json) {
//console.log(json);
const locations = [];
const place_names = [];
const place_events = [];
const luoghi = [];
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'];
var evento = value['tipo']['value'];
var count = value['count']['value'];
place_events.push([uri, evento, count]);
if (!place_names.includes(uri)) {
place_names.push(uri);
const coordinates = coord.split(", ");
loc.push(uri);
label = titleCase(label);
loc.push(label);
myPlaces += "";
loc.push(coordinates[0]);
lat += parseInt(coordinates[0]);
loc.push(coordinates[1]);
long += parseInt(coordinates[1].replace(/^(\.)/,"0.").replace("-.", "-0."));
locations.push(loc);
i++;
}
});
for (var k=0; k";
for (var k=3; k" + dix + " occorrenze ";
}
var marker = new L.Marker(new L.LatLng(a[1], a[2]), { title: title });
marker.bindPopup(title);
markers.addLayer(marker);
markerList.push(marker);
}
}
populate();
map.addLayer(markers);
$('.clickPlace').on('click', function(){
// parse lat and lng from the divs data attribute
var latlng = $(this).data().point.split(',');
var lat = latlng[0];
var lng = latlng[1];
var zoom = 10;
// set the view
map.setView([lat, lng], zoom);
});
}
function exchangeLetter(tipo, mittente, uri_mittente, destinatario, uri_destinatario) {
var params = tipo + ";" + mittente + ";" + uri_mittente + ";" + destinatario + ";" + uri_destinatario;
window.open("results.html?params="+ params);
}