123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197 |
- 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<variants.length; i++) {
- let chunk = variants[i].split("| ");
- name_string = name_string + "<a href='" + chunk[0] + "'>" + chunk[1] + "</a><br />";
- }
- }
- labelName = first_name;
- var Buttons = '<button title="Apri risorsa originale" class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
- <i class="fas fa-external-link-alt" aria-hidden="true"></i></button> \
- <button title="Citazione" type="button" value="object" id="' + uri + '" class="cit btn btn-default" alt="scheda" title="Citazione"><i class="fa fa-quote-right"></i></button> \
- <button title="Permalink" type="button" value="object" id="' + uri + '" class="hyp btn btn-default" alt="scheda" title="Hyperlink"><i class="fa fa-link"></i></button> \
- <a href="http://dev.restore.ovi.cnr.it/lodlive/?' + uri + '" target="_blank"><button type="button" title="Naviga il grafo" class="btn btn-default info" alt="LOD" title="LodLive"><i class="fa fa-share-alt"></i></button></a></div></div>';
- var id_snippet = "<div class='col-sm-4'><span class='label'>" + id_type + ":</span></div><div class='col' id='identificatore'>" + identifier + "</div>";
- 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; i<collection.length; i++) {
- collection[i].innerHTML = first_name;
- }
-
- });
-
- }
- function get_dataset_name(graph) {
- var string = "Scheda Onomastica";
- if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/onomastica") {
- string = string + " / Onomastica Datini";
- }
- else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/authors"){
- string = string + " / Artisti";
- }
- else {
- string = string;
- }
- return (string);
- }
- function handle_InfoGettatelli(json) {
- var card = "";
- var uri_card = "";
- $.each(
- json['results']['bindings'],
- function (index, value) {
- if ((value.hasOwnProperty('uri_card')) && (value.hasOwnProperty('card'))) {
- $("#card").css("display", "flex");
- uri_card = value['uri_card']['value'];
- card = value['card']['value'];
- }
-
- });
- var button_obj = "";
- if (uri_card != "") {
- button_obj = '<button type="button" id="' + uri_card +
- '" class="object btn btn-default" alt="oggetto" title="' + uri_card +
- '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
- }
- 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<myArray.length; i++) {
- var key = myArray[i][0];
- checkRel.push(key);
- }
- var params = [];
- $.each(checkRel, function(i, el){
- if($.inArray(el, params) === -1) params.push(el);
- });
- for (var i=0; i<params.length; i++) {
- var par = params[i];
- var par_id = par.replaceAll(" ", "_");
- var rel = createDivRelazione(par, par_id);
- Relazioni = Relazioni + rel;
- }
- $(Relazioni).insertAfter( "#groups" );
- for (var j=0; j<params.length; j++) {
- var el = params[j];
- var par = el.replaceAll(" ", "_");
- var Colums = "";
- for (var i=0; i<myArray.length; i++) {
- var text = myArray[i][1];
- var link = myArray[i][2];
- var rel = myArray[i][0].replaceAll(" ", "_");
- if (par == rel) {
- var col = createColRelazione(text, link);
- Colums = Colums + col;
- }
- }
- document.getElementById(par).innerHTML = Colums;
- }
- }
- function handle_RelazioniInverse(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 = "";
- var principale = "";
- var givenName = "";
- var familyName = "";
- var patronymic = "";
- var provenence = "";
-
- if (value.hasOwnProperty('name')) {
- nome = value['name']['value'];
- }
- 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 + " di";
- if (type == "Socio di") {
- type = "Soci";
- }
- if (type == "Socio principale di") {
- type = "Intestatario principale";
- }
- if (type == "Mano lettera di") {
- type = "Collaboratori";
- }
- 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<myArray.length; i++) {
- var key = myArray[i][0];
- checkRel.push(key);
- }
- var params = [];
- $.each(checkRel, function(i, el){
- if($.inArray(el, params) === -1) params.push(el);
- });
- for (var i=0; i<params.length; i++) {
- var par = params[i];
- var par_id = par.replaceAll(" ", "_");
- var rel = createDivRelazione(par, par_id);
- Relazioni = Relazioni + rel;
- }
- $(Relazioni).insertAfter( "#groups" );
- for (var j=0; j<params.length; j++) {
- var el = params[j];
- var par = el.replaceAll(" ", "_");
- var Colums = "";
- for (var i=0; i<myArray.length; i++) {
- var text = myArray[i][1];
- var link = myArray[i][2];
- var rel = myArray[i][0].replaceAll(" ", "_");
- if (par == rel) {
- var col = createColRelazione(text, link);
- Colums = Colums + col;
- }
- }
- document.getElementById(par).innerHTML = Colums;
- }
- }
- function createDivRelazione(type, id){
- htmlCode = '\
- <div class="row mb-2"> \
- <div class="col-sm-4"> \
- <span class="label"><RELATIONSHIP></span> \
- </div> \
- <div class="col record_box" id="<ID_RELATIONSHIP>"></div> \
- </div> \
- '.replace("<RELATIONSHIP>", type).replace("<ID_RELATIONSHIP>", id);
- return htmlCode;
- }
- function createColRelazione(text, link) {
- htmlCode = '\
- <div class="row mb-1"> \
- <div class="col"><NAME></div> \
- <div class="col-auto"> \
- <button class="persona btn btn-default" type="button" id="<URI>">\
- <i class="fa fa-user" aria-hidden="true">\
- <p class="btn-text">Scheda Persona</p>\
- </i>\
- </button>\</div> \
- </div>\
- '.replace("<NAME>", text).replace("<URI>", 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 = '<thead id="ev_thead" class="def_res"><tr>' +
- '<th class="col-2">Evento</th>' +
- '<th class="col-2">Ruolo</th>' +
- '<th class="col-2">Data</th>' +
- '<th class="col-3">Luogo</th>' +
- '<th class="col-3">Documento</th>' +
- '</tr></thead>';
- var EventsTable = thead;
- EventsTable += '<tbody>';
- 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 = '<span id="' + events[i]['uri_luogo1'] + '" class="luogo link">' + events[i]['luogo1'] + '</span>';
- } else {
- sniPlace1 = events[i]['luogo1'];
- }
- if (events[i]['coords2'] != "") {
- sniPlace2 = '<span id="' + events[i]['uri_luogo2'] + '" class="luogo link">' + events[i]['luogo2'] + '</span>';
- } else {
- sniPlace2 = events[i]['luogo2'];
- }
- if (events[i]['coords3'] != "") {
- sniPlace3 = '<span id="' + events[i]['uri_luogo3'] + '" class="luogo link">' + events[i]['luogo3'] + '</span>';
- } else {
- sniPlace3 = events[i]['luogo3'];
- }
- if (events[i]['coords4'] != "") {
- sniPlace4 = '<span id="' + events[i]['uri_luogo4'] + '" class="luogo link">' + events[i]['luogo4'] + '</span>';
- } 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 += '<tr class="res">' +
- '<th class="col-2">' + events[i]['evento'] + '</th>' +
- '<th class="col-2">' + events[i]['ruolo'] + '</th>' +
- '<th class="col-2">' + events[i]['data'] + '</th>' +
- '<th class="col-3">' + sniPlace + '</th>' +
- '<th id="' + events[i]['uri_documento'] + '" class="col-3 object link">' + events[i]['documento'] + '</th>' +
- '</tr>';
- }
- EventsTable += '</tbody>';
- if (Object.keys(events).length != 0) {
- document.getElementById("res_events").innerHTML = EventsTable;
- } else {
- var eventIcon = "<div id='map_icon' class='no_info_icon'> \
- <svg width='30' viewBox='0 0 411 404' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> \
- <g id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'> \
- <g id='noun-event-1989064' fill='#000000' fill-rule='nonzero'><path d='M31.55,403.44 L380.46,403.44 C397.304,403.44 410.538,389.331 410.538,372.378 L410.538,166.098 L0.378,166.098 L0.378,372.378 C0.378,389.331 14.706,403.44 31.55,403.44 Z' id='Path'></path><polygon id='Path' points='76.94 0.562 129.44 0.562 129.44 69.468 76.94 69.468'></polygon><path d='M410.53,80.08 C410.53,63.236 397.296,49.783 380.452,49.783 L361.311,49.783 L361.311,82.924 C361.311,90.1428 355.186,95.721 347.967,95.721 L269.655,95.721 C262.4362,95.721 256.202,90.1429 256.202,82.924 L256.202,49.783 L155.582,49.783 L155.582,82.924 C155.582,90.1428 149.457,95.721 142.129,95.721 L63.817,95.721 C56.5982,95.721 50.473,90.1429 50.473,82.924 L50.473,49.783 L31.551,49.783 C14.707,49.783 0.379,63.127 0.379,80.08 L0.379,143.846 L410.539,143.846 L410.53,80.08 Z' id='Path'></path><polygon id='Path' points='282.56 0.562 335.06 0.562 335.06 69.468 282.56 69.468'></polygon></g> \
- </g> \
- </svg> \
- <p>Nessun evento trovato</p> \
- </div>";
- 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 = '<div id="' + uri + '" style="cursor:pointer;" class="object"><img style="width:100%;" src="img/contrassegni/' + id_image + '" /></div>'
- 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.length; i++) {
- var letter = "";
- var infObject_button = "";
- var object_type = "";
- if (send[i][4] != "") {
- letter = '<div class="col-8"><p><span id="' + send[i][0] + '" class="title_doc lettera">'+ send[i][1] + '</span>';
- object_type = "lettera";
- infObject_button += '<button type="button" id="' + send[i][4] +
- '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
- } else {
- letter = '<div class="col-8"><p><span id="' + send[i][0] + '" class="title_doc object">'+ send[i][1] + '</span>';
- object_type = "object";
- infObject_button += '<button type="button" id="' + send[i][0] +
- '" class="object btn btn-default" alt="oggetto" title="' + send[i][1] +
- '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
- }
- if (send[i][2] != "") {
- letter = letter + "<br />Segnatura: " + send[i][2];
- }
- if (send[i][3] != "") {
- letter = letter + "<br />Data: " + send[i][3];
- }
- letter = letter + '</p></div>';
- Send_Letters += '<div class="row res">'+ letter +
- '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
- '<button type="button" value="' + object_type + '" id="' + send[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
- '<button type="button" value="' + object_type + '" id="' + send[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
- '<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + send[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
- }
- //POPULATE RECEIVE LETTERS BOX
- for (var i=0; i<receive.length; i++) {
- var letter = "";
- var infObject_button = "";
- var object_type = "";
- if (receive[i][4] != "") {
- letter = '<div class="col-8"><p><span id="' + receive[i][0] + '" class="title_doc lettera">'+ receive[i][1] + '</span>';
- object_type = "lettera";
- infObject_button += '<button type="button" id="' + receive[i][4] +
- '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
- } else {
- letter = '<div class="col-8"><p><span id="' + receive[i][0] + '" class="title_doc object">'+ receive[i][1] + '</span>';
- object_type = "object";
- infObject_button += '<button type="button" id="' + receive[i][0] +
- '" class="object btn btn-default" alt="oggetto" title="' + receive[i][1] +
- '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
- }
- if (receive[i][2] != "") {
- letter = letter + "<br />Segnatura: " + receive[i][2];
- }
- if (receive[i][3] != "") {
- letter = letter + "<br />Data: " + receive[i][3];
- }
- letter = letter + '</p></div>';
- Receive_Letters += '<div class="row res">'+ letter +
- '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
- '<button type="button" value="' + object_type + '" id="' + receive[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
- '<button type="button" value="' + object_type + '" id="' + receive[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
- '<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + receive[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
- }
- 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 = "<p class='no-results'>Nessun risultato trovato</p>";
- document.getElementById("letters_send").innerHTML = messaggio;
- }
- if (receive.length==0) {
- var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
- 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.length; i++) {
- var artwork = '<a href=' + oa[i][0] + ' target="_blank">' + oa[i][1] + '</a><br />NCT: ' + oa[i][2];
- if (oa[i][3] != "") {
- artwork = artwork + "<br />Data: " + oa[i][3];
- }
- var object_button = '<button type="button" id="' + oa[i][0] +
- '" class="artwork btn btn-default" alt="opera d\'arte" title="' + oa[i][1] +
- '"><i class="fas fa-paint-brush"></i><p class="btn-text">Scheda Opera d\'Arte</p></button>';
- Artworks += '<div class="row res"><div class="col-8"><p>'+ artwork +'</p></div>' +
- '<div class="col d-flex align-items-start justify-content-end">' + object_button +
- '<button value="OA" type="button" id="' + oa[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
- '<button value="OA" type="button" id="' + oa[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
- '<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + oa[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
- }
- document.getElementById("n_oa").innerHTML = oa.length;
- document.getElementById("object_oa").innerHTML = Artworks;
- if (oa.length==0) {
- var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
- 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.length; i++) {
- var paper = '<div class="col-8"><p><span id="' + doc[i][0] + '" class="title_doc object">'+ doc[i][1] + '</span>';
- var object_button = '<button type="button" id="' + doc[i][0] +
- '" class="object btn btn-default" alt="oggetto" title="' + doc[i][1] +
- '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
- if (doc[i][2] != "") {
- paper = paper + "<br />Segnatura: " + doc[i][2];
- }
- if (doc[i][3] != "") {
- paper = paper + "<br />Data: " + doc[i][3];
- }
- paper = paper + '</p></div>';
- Documents += '<div class="row res">'+ paper +
- '<div class="col d-flex align-items-start justify-content-end">' + object_button +
- '<button value="object" type="button" id="' + doc[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
- '<button value="object" type="button" id="' + doc[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
- '<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + doc[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
- }
- document.getElementById("n_ass").innerHTML = doc.length;
- document.getElementById("other_documents").innerHTML = Documents;
- if (doc.length==0) {
- var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
- 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 += '<a href="' + value['uri_same']['value'] + '">' + value['uri_same']['value'] + '</a><br />';
- }
-
- });
- 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 + "<br />";
-
- });
- 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 += "<div class='item-place-person'><div class='clickPlace item-place-person-label' data-point='"+ coordinates + "'>" + label + "</div><div class='item-place-person-action'><div class='luogo' id='" +
- uri + "'><i class='far fa-map' style='cursor:pointer'></i></div></div></div>";
- 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<locations.length; k++) {
- const tempArray = [];
- var nomeLuogo = locations[k][1];
- var lt = locations[k][2];
- var lg = locations[k][3];
- tempArray.push(nomeLuogo);
- tempArray.push(lt);
- tempArray.push(lg);
- for (var y=0; y<place_events.length; y++) {
- var ev = place_events[y][1];
- var number = place_events[y][2]
- var dict = ev + ": " + number;
- if (locations[k][0] == place_events[y][0]) {
- tempArray.push(dict);
- }
- }
- luoghi.push(tempArray);
- }
-
- //console.log(luoghi);
- var latitude = lat/i;
- var longitude = long/i;
- var mapIcon = "<div id='map_icon' class='no_info_icon'> \
- <svg xmlns='http://www.w3.org/2000/svg' width='30' viewBox='0 0 576 512'> \
- <path d='M408 120C408 174.6 334.9 271.9 302.8 311.1C295.1 321.6 280.9 321.6 273.2 311.1C241.1 271.9 168 174.6 168 120C168 53.73 221.7 0 288 0C354.3 0 408 53.73 408 120zM288 152C310.1 152 328 134.1 328 112C328 89.91 310.1 72 288 72C265.9 72 248 89.91 248 112C248 134.1 265.9 152 288 152zM425.6 179.8C426.1 178.6 426.6 177.4 427.1 176.1L543.1 129.7C558.9 123.4 576 135 576 152V422.8C576 432.6 570 441.4 560.9 445.1L416 503V200.4C419.5 193.5 422.7 186.7 425.6 179.8zM150.4 179.8C153.3 186.7 156.5 193.5 160 200.4V451.8L32.91 502.7C17.15 508.1 0 497.4 0 480.4V209.6C0 199.8 5.975 190.1 15.09 187.3L137.6 138.3C140 152.5 144.9 166.6 150.4 179.8H150.4zM327.8 331.1C341.7 314.6 363.5 286.3 384 255V504.3L192 449.4V255C212.5 286.3 234.3 314.6 248.2 331.1C268.7 357.6 307.3 357.6 327.8 331.1L327.8 331.1z'/> \
- </svg> \
- <p>Nessun luogo trovato</p> \
- </div>";
- if (locations.length == 0) {
- $("#people_map").css("display", "none");
- $("#references_persona").css("display", "none");
- document.getElementById("people_map_no_res").innerHTML = mapIcon;
- }
- document.getElementById("list_places_person").innerHTML = myPlaces;
- var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
- cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points © 2012 LINZ',
- cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
- latlng = new L.LatLng(latitude, longitude);
-
- var map = new L.Map('map', {center: latlng, zoom: 5, layers: [cloudmade]});
- mapLink = '<a href="https://openstreetmap.org">OpenStreetMap</a>';
- var markers = new L.MarkerClusterGroup();
- var markerList = [];
- var geo = new L.tileLayer(
- 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '© ' + mapLink + ' Contributors',
- maxZoom: 18,
- }).addTo(map);
- function populate() {
- for (var i = 0; i < luoghi.length; i++) {
- var a = luoghi[i];
- var len = a.length;
- var title = "<h2>" + titleCase(a[0]) + "</h2>";
- for (var k=3; k<len; k++) {
- var dix = a[k].replace("Invio:", "Invio lettere:").replace("Ricezione:", "Ricezione lettere:");
- title = title + "<p style='font-size: 14px;'>" + dix + " occorrenze</p><hr>";
- }
- 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);
- }
|