var link = thisUrlParams.link;
prefixes = queryManager['prefixes']['all'];
queryURL = prefixes + (queryManager['querySchedaOpera']['queryInfo']).replace('{URI}', link);
doJsonQuery(queryURL).done(function(data) { handle_OAdata(data); });
queryPro = prefixes + (queryManager['querySchedaOpera']['queryProduction']).replace('{URI}', link);
doJsonQuery(queryPro).done(function(data) { handle_Production(data); });
queryBib = prefixes + (queryManager['querySchedaOpera']['queryBibliography']).replace('{URI}', link);
doJsonQuery(queryBib).done(function(data) { handle_Bibliography(data); });
queryPic = prefixes + (queryManager['querySchedaOpera']['queryPicture']).replace('{URI}', link);
doJsonQuery(queryPic).done(function(data) { handle_Picture(data); });
querySc = prefixes + (queryManager['querySchedaOpera']['querySchedeStoriche']).replace('{URI}', link);
doJsonQuery(querySc).done(function(data) { handle_SchedeStoriche(data); });
var img_pic = "";
var img_cat = "";
var img_sc = "";
function handle_OAdata(json) {
console.log(json['results']['bindings']);
$.each(
json['results']['bindings'],
function (index, value) {
var graph = value['graph']['value'];
var label = value['label']['value'];
var uri = value['uri']['value'];
var title = "";
var type = "";
var current_owner = "";
var current_location = "";
var subject = "";
var dimensions = "";
var materials = "";
var condition = "";
var note = "";
var identifier = "";
var unit = "";
var inscription = "";
var src_picture = "";
var picture = "";
var dataset = get_dataset_name(graph);
if (value.hasOwnProperty('title')) {
$("#SGTT").css("display", "flex");
title = value['title']['value'];
}
if (value.hasOwnProperty('identifier')) {
$("#NCT").css("display", "flex");
identifier = value['identifier']['value'];
}
if (value.hasOwnProperty('type')) {
$("#OGTD").css("display", "flex");
type = "
";
}
if (value.hasOwnProperty('current_owner')) {
$("#LDCN").css("display", "flex");
current_owner = "";
}
if (value.hasOwnProperty('current_location')) {
$("#LDCS").css("display", "flex");
current_location = value['current_location']['value'];
}
if (value.hasOwnProperty('unit')) {
unit = value['unit']['value'];
}
if (value.hasOwnProperty('subject')) {
$("#SGTI").css("display", "flex");
subject = value['subject']['value'];
}
if (value.hasOwnProperty('dimensions')) {
if (value['dimensions']['value'] != "") {
$("#MIS").css("display", "flex");
dimensions = value['dimensions']['value'];
}
}
if (value.hasOwnProperty('condition')) {
$("#STCC").css("display", "flex");
condition = value['condition']['value'];
}
if (value.hasOwnProperty('note')) {
$("#NSC").css("display", "flex");
note = value['note']['value'];
}
if (value.hasOwnProperty('iscrizione')) {
$("#ISCR").css("display", "flex");
inscription = value['iscrizione']['value'];
}
if (value.hasOwnProperty('uriSubjectPer')) {
var givenName = value['personName']['value'];
var surname = value['personSurname']['value'];
var patronymic = value['personPatronymic']['value'];
var name = givenName + " " + patronymic + " " + titleCase(surname);
subject += "
";
}
if (value.hasOwnProperty('Materials')) {
if (value['Materials']['value'] != "") {
$("#MTC").css("display", "flex");
mm = value['Materials']['value'];
mat = mm.split("
");
for (i in mat) {
slice = mat[i].split("; ");
/*materials += "" + slice[1] + "
";*/
materials += "";
}
}
}
var Buttons = '
\
\
\
';
var subjects = document.getElementsByClassName("subject");
for (i in subjects) {
subjects[i].innerHTML = subject;
}
document.getElementById("grafo").innerHTML = dataset;
document.getElementById("nome_oggetto").innerHTML = label;
document.getElementById("identifier").innerHTML = identifier;
document.getElementById("type").innerHTML = type;
document.getElementById("owner").innerHTML = current_owner;
document.getElementById("dimensions").innerHTML = dimensions + unit;
document.getElementById("materials").innerHTML = materials;
document.getElementById("condition").innerHTML = condition;
document.getElementById("description").innerHTML = note;
document.getElementById("inscription").innerHTML = inscription;
document.getElementById("link_buttons").innerHTML = Buttons;
});
}
function handle_Picture(json) {
console.log(json['results']['bindings']);
var picture = "";
const tavole = [];
$.each(
json['results']['bindings'],
function (index, value) {
var src_picture = value['picture']['value'];
var tipo = "";
if (value.hasOwnProperty('type')) {
tipo = value['type']['value'];
}
let tv = [src_picture, tipo];
tavole.push(tv);
src_picture = value['picture']['value'];
picture += ' \

\
';
});
var front_pic = "";
if (tavole.length > 1) {
for (i in tavole) {
if (tavole[i][1] == "Tavola d'insieme") {
front_pic = tavole[i][0];
}
}
} else {
front_pic = tavole[0][0];
}
img_pic = "img/mpp_img/" + front_pic;
document.getElementById("image_artwork_min").innerHTML = picture;
document.getElementById("expandedImg").src = "img/mpp_img/" + front_pic;
}
function get_dataset_name(graph) {
var string = "Scheda Opera d'Arte";
if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/martini") {
string = string + " / Collezione Martini";
}
else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale") {
string = string + " / Collezione Ospedale";
}
else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/datini") {
string = string + " / Collezione Datini";
}
else {
string = string;
}
return (string);
}
function handle_Production(json) {
console.log(json['results']['bindings']);
$.each(
json['results']['bindings'],
function (index, value) {
var partecipants = "";
var teche = "";
var time = "";
var client = "";
var artist = "";
var artist_name = "";
if (value.hasOwnProperty('techniques')) {
if (value['techniques']['value'] != "") {
$("#MTC").css("display", "flex");
tt = value['techniques']['value'];
tec = tt.split("
");
for (i in tec) {
slice = tec[i].split("; ");
/*teche += "" + slice[1] + "
";*/
teche += "";
}
}
}
if (value.hasOwnProperty('Partecipants')) {
pp = value['Partecipants']['value'];
people = pp.split("
");
for (i in people) {
slice = people[i].split("; ");
if (slice[2] == "Committente") {
$("#CMM").css("display", "flex");
client += slice[1];
} else {
$("#AUT").css("display", "flex");
artist_name += slice[1];
artist += "
";
}
}
}
if (value.hasOwnProperty('time') && (value['time']['value'] != "")) {
$("#DT").css("display", "flex");
time = value['time']['value'];
}
var authors = document.getElementsByClassName("author");
for (i in authors) {
authors[i].innerHTML = artist;
}
var dates = document.getElementsByClassName("date");
for (i in dates) {
dates[i].innerHTML = time;
}
document.getElementById("technique").innerHTML = teche;
document.getElementById("client").innerHTML = client;
});
}
function handle_Bibliography(json) {
console.log(json['results']['bindings']);
var Biblio = "";
var bibCit = "";
const bibArray = [];
var catImg = "";
$.each(
json['results']['bindings'],
function (index, value) {
var bib = value['bibliography']['value'];
var pages = "";
if (value.hasOwnProperty('pages')) {
pages = value['pages']['value'];
}
if (value.hasOwnProperty('catalog')) {
if (value['catalog']['value'] != "") {
bibCit = value['bibliography']['value'];
cc = value['catalog']['value'];
cat = cc.split(", ");
for (i in cat) {
var marchini = cat[i].replace(".jpg", " (1).jpg");
img_cat = "img/MPP_marchini_stampa/" + marchini;
catImg += ' \

\
';
}
}
}
var book = bib + " " + pages;
bibArray.push(book);
});
console.log(catImg);
bibArray.sort();
for (k in bibArray) {
Biblio += '' + bibArray[k] + '';
}
document.getElementById("bibliography").innerHTML = Biblio;
document.getElementById("catalog_description").innerHTML = bibCit;
if (catImg == "") {
$("#btn_catalogo").css("display", "none");
} else {
document.getElementById("image_catalog_min").innerHTML = catImg;
}
}
function handle_SchedeStoriche(json) {
console.log(json['results']['bindings']);
var schede = "";
$.each(
json['results']['bindings'],
function (index, value) {
var scheda = value['scheda']['value'];
img_sc = "img/mpp_img/" + scheda;
schede += ' \

\
';
});
if (schede == "") {
$("#btn_schedastorica").css("display", "none");
} else {
document.getElementById("image_scheda_min").innerHTML = schede;
}
}
function show_OA(){
document.getElementById("OA_info").style.display = "block";
document.getElementById("catalogo_info").style.display = "none";
document.getElementById("scheda_info").style.display = "none";
document.getElementById("image_artwork_min").style.display = "block";
document.getElementById("image_catalog_min").style.display = "none";
document.getElementById("image_scheda_min").style.display = "none";
document.getElementById("img_title").innerHTML = "Opera";
document.getElementById("expandedImg").src = img_pic;
}
function show_CAT(){
document.getElementById("OA_info").style.display = "none";
document.getElementById("catalogo_info").style.display = "block";
document.getElementById("scheda_info").style.display = "none";
document.getElementById("image_artwork_min").style.display = "none";
document.getElementById("image_catalog_min").style.display = "block";
document.getElementById("image_scheda_min").style.display = "none";
document.getElementById("img_title").innerHTML = "Catalogo";
document.getElementById("expandedImg").src = img_cat;
}
function show_INV(){
document.getElementById("OA_info").style.display = "none";
document.getElementById("catalogo_info").style.display = "none";
document.getElementById("scheda_info").style.display = "block";
document.getElementById("image_artwork_min").style.display = "none";
document.getElementById("image_catalog_min").style.display = "none";
document.getElementById("image_scheda_min").style.display = "block";
document.getElementById("img_title").innerHTML = "Scheda Storica";
document.getElementById("expandedImg").src = img_sc;
}