var link = thisUrlParams.link;
prefixes = queryManager['prefixes']['all'];
queryURL = prefixes + (queryManager['querySchedaOggetto']['queryInfo']).replace('{URI}', link);
console.log(queryURL);
doJsonQuery(queryURL).done(function(data) { handle_objectData(data); });
queryINF = prefixes + (queryManager['querySchedaOggetto']['queryContent']).replace('{URI}', link);
doJsonQuery(queryINF).done(function(data) { handle_objectInfo(data); });
queryGT = prefixes + (queryManager['querySchedaOggetto']['queryContrassegni']).replace('{URI}', link);
doJsonQuery(queryGT).done(function(data) { handle_contrassegni(data); });
queryOVI = prefixes + (queryManager['querySchedaOggetto']['queryOviLetter']).replace('{URI}', link);
doJsonQuery(queryOVI).done(function(data) { handle_oviLetter(data); });
queryPERS = prefixes + (queryManager['querySchedaOggetto']['queryPersone']).replace('{URI}', link);
doJsonQuery(queryPERS).done(function(data) { handle_citedPeople(data); });
queryLG = prefixes + (queryManager['querySchedaOggetto']['queryLuoghiGT']).replace('{URI}', link);
doJsonQuery(queryLG).done(function(data) { handle_luoghiDocumento(data); });
queryTR = prefixes + (queryManager['querySchedaOggetto']['queryTree']).replace('{URI}', link);
doJsonQuery(queryTR).done(function(data) { handle_treeview(data, link); });
function handle_objectData(json) {
console.log(json);
$.each(
json['results']['bindings'],
function (index, value) {
var graph = value['graph']['value'];
var label = value['label']['value'];
var uri = value['uri']['value'];
var siglaRegistro = "";
var identifier = "";
var dimensions = "";
var consistence = "";
var materials = "";
var description = "";
var button_ext = "";
var button_owner = "";
var current_owner = "";
var uri_owner = "";
var dates = "";
var uri_composed = "";
var composed = "";
var button_doc = "";
var treeList = "";
var dataset = get_graph_name(graph);
if (value.hasOwnProperty('id')) {
$("#ID").css("display", "flex");
identifier = value['id']['value'];
}
if (value.hasOwnProperty('dimension')) {
$("#dimensione").css("display", "flex");
dimensions = value['dimensions']['value'];
}
if (value.hasOwnProperty('consistency')) {
$("#consistenza").css("display", "flex");
consistence = value['consistency']['value'];
}
if (value.hasOwnProperty('sigla_registro')) {
$("#IDreg").css("display", "flex");
siglaRegistro = value['sigla_registro']['value'];
}
if (value.hasOwnProperty('condition')) {
$("#STCC").css("display", "flex");
condition = value['condition']['value'];
}
if (value.hasOwnProperty('material')) {
$("#materia").css("display", "flex");
materials = value['material']['value'];
}
if (value.hasOwnProperty('uri_owner')) {
$("#current_owner").css("display", "flex");
current_owner = value['owner']['value'];
uri_owner = value['uri_owner']['value'];
}
if (value.hasOwnProperty('time_span')) {
if (value['time_span']['value'] != ""){
$("#time_span_object").css("display", "flex");
dates = value['time_span']['value'];
}
}
if (value.hasOwnProperty('note')) {
$("#notes").css("display", "flex");
description = value['note']['value'];
}
if (value.hasOwnProperty('uri_document')) {
uri_composed = value['uri_document']['value'];
}
if (value.hasOwnProperty('document')) {
//$("#composed").css("display", "flex");
composed = value['document']['value'];
}
if (identifier != "") {
button_ext = '' + identifier + '';
}
if (uri_composed != "") {
/*button_doc = '';
*/
treeList = '
' +
'' + composed + '- ' + label + '
'
}
if (owner != "") {
button_owner = '' + current_owner + '';
}
createHeaderButtons(uri);
document.getElementById("grafo").innerHTML = dataset;
document.getElementById("nome_oggetto").innerHTML = label;
document.getElementById("identifier").innerHTML = button_ext;
document.getElementById("nota").innerHTML = description;
document.getElementById("sigla_registro").innerHTML = siglaRegistro;
document.getElementById("dimensions").innerHTML = dimensions;
document.getElementById("materials").innerHTML = materials;
document.getElementById("consistence").innerHTML = consistence;
document.getElementById("owner").innerHTML = button_owner;
document.getElementById("timeSpan").innerHTML = dates;
document.getElementById("superDoc").innerHTML = composed;
//document.getElementById("btn_superDoc").innerHTML = button_doc;
document.getElementById("link_buttons").innerHTML = Buttons;
document.getElementById("tree").innerHTML = treeList;
});
}
function get_graph_name(graph) {
var dataset = "Object";
if (graph == "http://147.213.76.182:8890/aspo/ospedale") {
dataset = dataset + " / Ospedale";
} else if (graph == "http://147.213.76.182/:8890/aspo/datini") {
dataset = dataset + " / Datini";
} else if (graph == "http://147.213.76.182:8890/aspo/marcovaldi") {
dataset = dataset + " / Marcovaldi";
} else if (graph == "http://147.213.76.182:8890/aspo/gettatelli") {
dataset = dataset + " / Gettatelli";
} else {
dataset = dataset;
}
return dataset;
}
function handle_contrassegni(json) {
console.log(json);
var uri = "";
var graph = "";
var contrassegno = "";
var immagine = "";
var uri_gettatello = "";
var gettatello = "";
var provenienza = "";
var uri_provenienza = "";
var licenza = "";
var provenienza_img = "";
var licenza_img = "";
var Images = "";
let markImg = [];
let imgMark = [];
var tiles = [];
$.each(
json['results']['bindings'],
function (index, value) {
uri = value['uri']['value'];;
contrassegno = value['contrassegno']['value'];
immagine = value['image']['value'];
uri_gettatello = value['uri_person']['value'];
uri_provenienza = value['uri_istituto']['value'];
licenza = value['license']['value'];
provenienza = value['provenienza']['value'];
gettatello = value['gettatello']['value'];
graph = value['g']['value'];
if (immagine != "") {
$("#IMM").css("display", "flex");
var cos_image = "http://restore.ovi.cnr.it/img/contrassegni/" + immagine;
//let imgs = immagine.split("_");
tiles.push({
type: "image",
url: cos_image
});
/*const suffix = ["_a", "_b", "_c", "_a_2", "_a1", "_a2"];
for (var k=0; kPerson
';
document.getElementById('pp_gettatello').innerHTML = gettatello;
document.getElementById('btn_gt').innerHTML = gt_btn;
}
if (uri_provenienza != "") {
$("#PRO_CARD").css("display", "flex");
provenienza_img = '' + provenienza + '';
}
if (licenza != "") {
$("#CC_CARD").css("display", "flex");
licenza_img = '';
}
if (contrassegno != "") {
document.getElementById("nome_oggetto").innerHTML = contrassegno;
}
var Buttons = ' \
\
\
';
var dataset = get_graph_name(graph);
runOpenseadragon(tiles);
document.getElementById("grafo").innerHTML = dataset;
document.getElementById("link_buttons").innerHTML = Buttons;
document.getElementById("provenienza").innerHTML = provenienza_img;
document.getElementById("license").innerHTML = licenza_img;
}
function organizeImages(images) {
console.log(images);
var tiles2 = [];
for (var i=0; i {
if (exists) {
console.log(image);
var tile = {
type: "image",
url: images[i]
};
viewer.add-item(tile);
/*var Image = ' \
\
';
console.log(Image);
$('#images').append(Image);*/
} else {
console.error('Image does not exists.')
}
});
}
function checkIfImageExists(url, callback) {
const img = new Image();
img.src = url;
if (img.complete) {
callback(true);
} else {
img.onload = () => {
callback(true);
};
img.onerror = () => {
callback(false);
};
}
}
function handle_objectInfo(json) {
console.log(json['results']['bindings']);
$.each(
json['results']['bindings'],
function (index, value) {
var title = "";
var type = "";
var subject = "";
if (value.hasOwnProperty('titolo')) {
$("#titolo").css("display", "flex");
title = value['titolo']['value'];
}
if (value.hasOwnProperty('tipo')) {
$("#tipo").css("display", "flex");
type = value['tipo']['value'];
}
if (value.hasOwnProperty('ref')) {
if (value['ref']['value'] != "") {
$("#argomento").css("display", "flex");
subject = value['ref']['value'];
}
}
document.getElementById("title").innerHTML = title;
document.getElementById("type").innerHTML = type;
document.getElementById("subject").innerHTML = subject;
});
}
function handle_oviLetter(json) {
console.log(json['results']['bindings']);
$.each(
json['results']['bindings'],
function (index, value) {
var other_id = "";
var uri = "";
var button_letter = "";
if (value.hasOwnProperty('otherId')) {
$("#IDbis").css("display", "flex");
other_id = value['otherId']['value'];
}
if (value.hasOwnProperty('InfObj')) {
uri = value['InfObj']['value'];
}
if (uri != "") {
button_letter = '';
}
document.getElementById("other_identifier").innerHTML = other_id;
document.getElementById("btn_other_identifier").innerHTML = button_letter;
});
}
function handle_citedPeople(json) {
console.log(json);
const people = [];
$.each(
json['results']['bindings'],
function (index, value) {
var uri = value['uri_person']['value'];
var name = value['name']['value'];
var tipo1 = "";
var tipo2 = "";
var nota = "";
if (value.hasOwnProperty('types')) {
if (value['types']['value'] != "") {
tipo1 = value['types']['value'];
}
}
if (value.hasOwnProperty('types2')) {
if (value['types2']['value'] != "") {
tipo2 = value['types2']['value'];
}
}
if (value.hasOwnProperty('note')) {
nota = value['note']['value'];
}
var tipo = "";
if (tipo2 != "") {
tipo = tipo2;
} else {
tipo = tipo1;
}
people.push([uri, name, tipo, nota]);
});
var Person = "";
for (var i=0; i'+ titleCase(people[i][1]) + '';
if (people[i][2] != "") {
object = object + "
Documented roles: " + people[i][2];
}
if (people[i][3] != "") {
object = object + "
Note: " + people[i][3];
}
object = object + '';
Person += '' + object +
'
' +
'
' +
'
' +
'
';
}
document.getElementById("n_pp").innerHTML = people.length;
document.getElementById("cited_people").innerHTML = Person;
if (people.length==0) {
var messaggio = "No resources for thies query
";
document.getElementById("cited_people").innerHTML = messaggio;
}
}
function handle_treeview(json, uri_subject) {
console.log(json);
var upLevel = "";
var uri_up = "";
var tree_doc = "";
$.each(
json['results']['bindings'],
function (index, value) {
upLevel = value['label']['value'];
uri_up = value['uri']['value'];
var uri = value['uri_document']['value'];
var document = value['document']['value'];
tree_doc += '- ' + document + '
- '
});
if (tree_doc != "") {
var tree_list = '
- ' +
'' + upLevel + '
';
document.getElementById("treeView").innerHTML = tree_list;
}
}
function handle_luoghiDocumento(json) {
console.log(json);
const places = [];
$.each(
json['results']['bindings'],
function (index, value) {
var uri = value['uri_place']['value'];
var label = value['place']['value'];
places.push([uri, label]);
});
var Luoghi = "";
for (var i=0; i'+ places[i][1] + '';
var object_button = '';
Luoghi += ''+ object +
'
' + object_button +
'
' +
'
' +
'
';
}
document.getElementById("n_pl").innerHTML = places.length;
document.getElementById("section_places").innerHTML = Luoghi;
if (places.length==0) {
var messaggio = "No resources for thies query
";
document.getElementById("section_places").innerHTML = messaggio;
}
}
function createDivRelazione(type, id){
htmlCode = '\
\
'.replace("", type).replace("", id);
return htmlCode;
}
function createColRelazione(text, link, tipo, fa, tab, decl) {
htmlCode = '\
\
'.replace("", text).replace("", link).replace("", tipo).replace("