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); });
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 title = "";
var type = "";
var current_owner = "";
var current_location = "";
var subject = "";
var dimensions = "";
var materials = "";
var condition = "";
var note = "";
var identifier = "";
var unit = "";
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 = "
" +
value['type']['value'] + "
";
}
if (value.hasOwnProperty('current_owner')) {
$("#LDCN").css("display", "flex");
current_owner = "" +
value['current_owner']['value'] + "
";
}
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('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 += "";
}
}
}
document.getElementById("grafo").innerHTML = dataset;
document.getElementById("nome_oggetto").innerHTML = label;
/*document.getElementById("title").innerHTML = title;*/
document.getElementById("identifier").innerHTML = identifier;
document.getElementById("type").innerHTML = type;
document.getElementById("owner").innerHTML = current_owner;
/*document.getElementById("location").innerHTML = current_location;*/
document.getElementById("subject").innerHTML = subject;
document.getElementById("dimensions").innerHTML = dimensions + unit;
document.getElementById("materials").innerHTML = materials;
document.getElementById("condition").innerHTML = condition;
document.getElementById("description").innerHTML = note;
});
}
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')) {
time = value['time']['value'];
}
document.getElementById("technique").innerHTML = teche;
document.getElementById("time").innerHTML = time;
/*document.getElementById("artist_name").innerHTML = artist_name;*/
document.getElementById("artist").innerHTML = artist;
document.getElementById("client").innerHTML = client;
});
}