123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- 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 = '<a title="Apri risorsa originale" href= "' + uri + '">' + identifier + '</a>';
- }
- if (uri_composed != "") {
- /*button_doc = '<button title="Apri risorsa di livello superiore" id="' + uri_composed + '" class="object btn btn-default" type="button" > \
- <i class="fa fa-book" aria-hidden="true"> <p class="btn-text">Livello superiore</p></i></button>';
- */
- treeList = '<li class="upLevel"><span id="' + uri_composed + '" class="object"><i class="fa fa-folder-open"></i>' +
- '<w class="link">' + composed + '</w></span><ul><li><span class="tree_label"><i class="fa fa-file-alt"></i>' + label + '<li></span><ul></li>'
- }
- if (owner != "") {
- button_owner = '<a title="Vai al sito dell\'Istituto" href= "' + uri_owner + '">' + current_owner + '</a>';
- }
- 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>';
- 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 = "Scheda Oggetto";
- if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale") {
- dataset = dataset + " / Ospedale";
- } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/datini") {
- dataset = dataset + " / Datini";
- } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi") {
- dataset = dataset + " / Marcovaldi";
- } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli") {
- dataset = dataset + " / Gettatelli";
- } else {
- dataset = dataset;
- }
- return dataset;
- }
- var tiles = [];
- function handle_contrassegni(json) {
- console.log(json);
- var uri = "";
- var graph = "";
- var contrassegno = "";
- var immagine = "";
- var uri_gettatello = "";
- var gettatello = "";
- var Images = "";
- let markImg = [];
- let imgMark = [];
- $.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'];
- gettatello = value['gettatello']['value'];
- graph = value['g']['value'];
- if (immagine != "") {
- $("#IMM").css("display", "flex");
- var cos_image = "http://restore.ovi.cnr.it/beta/img/contrassegni/" + immagine;
-
- let imgs = immagine.split("_");
- console.log(immagine);
- tiles.push({
- type: "image",
- url: cos_image
- });
- const suffix = ["_a", "_b", "_c", "_a_2", "_a1", "_a2"];
- for (var k=0; k<suffix.length; k++) {
- var image_url = "http://restore.ovi.cnr.it/beta/img/contrassegni/" + imgs[0] + suffix[k] + ".jpg";
- markImg.push(image_url);
- }
- }
-
- });
- if ((gettatello != "") && (uri_gettatello != "")) {
- $("#GT").css("display", "flex");
- var gt_btn = '<button type="button" id="' + uri_gettatello +
- '" class="persona btn btn-default" alt="persona"><i class="fa fa-user"></i><p class="btn-text">Persona</p></button>';
- document.getElementById('pp_gettatello').innerHTML = gettatello;
- document.getElementById('btn_gt').innerHTML = gt_btn;
-
- }
- 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 dataset = get_graph_name(graph);
- runOpenseadragon(tiles);
- document.getElementById("nome_oggetto").innerHTML = contrassegno;
- document.getElementById("grafo").innerHTML = dataset;
- document.getElementById("link_buttons").innerHTML = Buttons;
-
- }
- function organizeImages(images) {
- console.log(images);
- var tiles2 = [];
- for (var i=0; i<images.length; i++) {
- tiles2.push({
- type: "image",
- url: images[i]
- });
- }
-
- runOpenseadragon(tiles2);
- }
- function createImage(image) {
- checkIfImageExists(image, (exists) => {
- if (exists) {
- console.log(image);
- var tile = {
- type: "image",
- url: images[i]
- };
- viewer.add-item(tile);
- /*var Image = '<div class="singleImg"> \
- <img src="' + image + '" alt="contrassegno" style="width:100%" onclick="expandImg(this);"> \
- </div>';
- 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 = '<button type="button" id="' + uri +
- '" class="lettera btn btn-default" alt="lettera"><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
- }
-
- 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<people.length; i++) {
- var object = '<div class="col-8"><p><span id="' + people[i][0] + '" class="title_doc persona">'+ titleCase(people[i][1]) + '</span>';
- if (people[i][2] != "") {
- object = object + "<br />Ruoli documentati: " + people[i][2];
- }
- if (people[i][3] != "") {
- object = object + "<br />Nota: " + people[i][3];
- }
- object = object + '</p></div>';
-
- Person += '<div class="row res">' + object +
- '<div class="col d-flex align-items-start justify-content-end"><button type="button" id="' + people[i][0] + '" class="persona btn btn-default" alt="persona" title="' +
- people[i][1] + '"><i class="fa fa-user"></i><p class="btn-text">Persona</p></button>' +
- '<button type="button" value="Persona" id="' + people[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="Persona" type="button" id="' + people[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/?' + people[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_pp").innerHTML = people.length;
- document.getElementById("cited_people").innerHTML = Person;
-
- if (people.length==0) {
- var messaggio = "<p class='no-results'>Questa ricerca non ha prodotto risultati</p>";
- 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 += '<li class="tree_el"><i class="fa fa-file-alt"></i><span id="' + uri + '" class="tree_seed link object">' + document + '</span><li>'
-
- });
- if (tree_doc != "") {
- var tree_list = '<li class="upLevelTree"><span style="cursor:pointer;" class="caret link"><i class="fa fa-folder-open"></i>' +
- '<w>' + upLevel + '</w></span><ul id="nested" style="display: none;">' + tree_doc + '</ul></li>';
- 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.length; i++) {
- var object = '<div class="col-8"><p><span id="' + places[i][0] + '" class="title_doc luogo">'+ places[i][1] + '</span></p></div>';
-
- var object_button = '<button type="button" id="' + places[i][0] +
- '" class="luogo btn btn-default" alt="oggetto" title="' + places[i][1] +
- '"><i class="fa fa-map"></i><p class="btn-text">luogo</p></button>';
- Luoghi += '<div class="row res">'+ object +
- '<div class="col d-flex align-items-start justify-content-end">' + object_button +
- '<button type="button" value="luogo" id="' + places[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="luogo" id="' + places[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/?' + places[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_pl").innerHTML = places.length;
- document.getElementById("section_places").innerHTML = Luoghi;
- if (places.length==0) {
- var messaggio = "<p class='no-results'>Questa ricerca non ha prodotto risultati</p>";
- document.getElementById("section_places").innerHTML = messaggio;
- }
-
- }
- 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, tipo, fa, tab, decl) {
- htmlCode = '\
- <div class="row"> \
- <div class="col <CLASS>"><NAME></div> \
- <div class="col-auto"> \
- <button class="<TIPO> btn btn-default" type="button" id="<URI>">\
- <i class="<BUTTON>" aria-hidden="true">\
- <p class="btn-text"><TAB></p>\
- </i>\
- </button>\</div> \
- </div>\
- '.replace("<NAME>", text).replace("<URI>", link).replace("<TIPO>", tipo).replace("<BUTTON>", fa).replace("<TAB>", tab).replace("<CLASS>", decl);
- return htmlCode;
- }
- $(document).on("click", ".caret", function (ev) {
- $("#nested").toggle();
- //$("#nested").css("display", "block");
- });
|