OA.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. var link = thisUrlParams.link;
  2. prefixes = queryManager['prefixes']['all'];
  3. queryURL = prefixes + (queryManager['querySchedaOpera']['queryInfo']).replace('{URI}', link);
  4. doJsonQuery(queryURL).done(function(data) { handle_OAdata(data); });
  5. queryPro = prefixes + (queryManager['querySchedaOpera']['queryProduction']).replace('{URI}', link);
  6. doJsonQuery(queryPro).done(function(data) { handle_Production(data); });
  7. queryBib = prefixes + (queryManager['querySchedaOpera']['queryBibliography']).replace('{URI}', link);
  8. doJsonQuery(queryBib).done(function(data) { handle_Bibliography(data); });
  9. queryPic = prefixes + (queryManager['querySchedaOpera']['queryPicture']).replace('{URI}', link);
  10. doJsonQuery(queryPic).done(function(data) { handle_Picture(data); });
  11. querySc = prefixes + (queryManager['querySchedaOpera']['querySchedeStoriche']).replace('{URI}', link);
  12. doJsonQuery(querySc).done(function(data) { handle_SchedeStoriche(data); });
  13. function handle_OAdata(json) {
  14. console.log(json['results']['bindings']);
  15. $.each(
  16. json['results']['bindings'],
  17. function (index, value) {
  18. var graph = value['graph']['value'];
  19. var label = value['label']['value'];
  20. var uri = value['uri']['value'];
  21. var title = "";
  22. var type = "";
  23. var current_owner = "";
  24. var current_location = "";
  25. var subject = "";
  26. var dimensions = "";
  27. var materials = "";
  28. var condition = "";
  29. var note = "";
  30. var identifier = "";
  31. var unit = "";
  32. var inscription = "";
  33. var src_picture = "";
  34. var picture = "";
  35. var dataset = get_dataset_name(graph);
  36. if (value.hasOwnProperty('title')) {
  37. $("#SGTT").css("display", "flex");
  38. title = value['title']['value'];
  39. }
  40. if (value.hasOwnProperty('identifier')) {
  41. $("#NCT").css("display", "flex");
  42. identifier = value['identifier']['value'];
  43. }
  44. if (value.hasOwnProperty('type')) {
  45. $("#OGTD").css("display", "flex");
  46. type = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriType']['value'] + "'>" +
  47. value['type']['value'] + "</a></div></div>";
  48. }
  49. if (value.hasOwnProperty('current_owner')) {
  50. $("#LDCN").css("display", "flex");
  51. current_owner = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriOwner']['value'] + "'>" +
  52. value['current_owner']['value'] + "</a></div></div>";
  53. }
  54. if (value.hasOwnProperty('current_location')) {
  55. $("#LDCS").css("display", "flex");
  56. current_location = value['current_location']['value'];
  57. }
  58. if (value.hasOwnProperty('unit')) {
  59. unit = value['unit']['value'];
  60. }
  61. if (value.hasOwnProperty('subject')) {
  62. $("#SGTI").css("display", "flex");
  63. subject = value['subject']['value'];
  64. }
  65. if (value.hasOwnProperty('dimensions')) {
  66. if (value['dimensions']['value'] != "") {
  67. $("#MIS").css("display", "flex");
  68. dimensions = value['dimensions']['value'];
  69. }
  70. }
  71. if (value.hasOwnProperty('condition')) {
  72. $("#STCC").css("display", "flex");
  73. condition = value['condition']['value'];
  74. }
  75. if (value.hasOwnProperty('note')) {
  76. $("#NSC").css("display", "flex");
  77. note = value['note']['value'];
  78. }
  79. if (value.hasOwnProperty('iscrizione')) {
  80. $("#ISCR").css("display", "flex");
  81. inscription = value['iscrizione']['value'];
  82. }
  83. if (value.hasOwnProperty('uriSubjectPer')) {
  84. var givenName = value['personName']['value'];
  85. var surname = value['personSurname']['value'];
  86. var patronymic = value['personPatronymic']['value'];
  87. var name = givenName + " " + patronymic + " " + titleCase(surname);
  88. subject += "<br /><div class='d-flex'><div class='mr-3'><a href='" + value['uriSubjectPer']['value'] + "'>" +
  89. name + "</a></div><div class='d-flex ml-auto'><div class='persona btn-icon' style='cursor:pointer' id='" +
  90. value['uriSubjectPer']['value'] + "'><i class='fa fa-user'></i><p class='btn-text'>PERSONA</p></div></div></div></div>";
  91. }
  92. if (value.hasOwnProperty('Materials')) {
  93. if (value['Materials']['value'] != "") {
  94. $("#MTC").css("display", "flex");
  95. mm = value['Materials']['value'];
  96. mat = mm.split("<br />");
  97. for (i in mat) {
  98. slice = mat[i].split("; ");
  99. /*materials += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
  100. materials += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
  101. slice[1] + "</a></div>";
  102. }
  103. }
  104. }
  105. if (value.hasOwnProperty('picture')) {
  106. src_picture = value['picture']['value'];
  107. picture = '<div class="col"> \
  108. <img class="viewImage" src="img/mpp_img/' + src_picture + '" onclick="expandImg(this);" /> \
  109. </div>';
  110. }
  111. var Buttons = '<button title="Apri risorsa originale" class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
  112. <i class="fas fa-external-link-alt" aria-hidden="true"></i></button> \
  113. <button title="Citazione" type="button" value="artwork" id="' + uri + '" class="cit btn btn-default" alt="scheda" title="Citazione"><i class="fa fa-quote-right"></i></button> \
  114. <button title="Permalink" type="button" value="artwork" id="' + uri + '" class="hyp btn btn-default" alt="scheda" title="Hyperlink"><i class="fa fa-link"></i></button> \
  115. <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>';
  116. var subjects = document.getElementsByClassName("subject");
  117. for (i in subjects) {
  118. subjects[i].innerHTML = subject;
  119. }
  120. document.getElementById("grafo").innerHTML = dataset;
  121. document.getElementById("nome_oggetto").innerHTML = label;
  122. document.getElementById("identifier").innerHTML = identifier;
  123. document.getElementById("type").innerHTML = type;
  124. document.getElementById("owner").innerHTML = current_owner;
  125. document.getElementById("dimensions").innerHTML = dimensions + unit;
  126. document.getElementById("materials").innerHTML = materials;
  127. document.getElementById("condition").innerHTML = condition;
  128. document.getElementById("description").innerHTML = note;
  129. document.getElementById("inscription").innerHTML = inscription;
  130. document.getElementById("link_buttons").innerHTML = Buttons;
  131. document.getElementById("image_artwork_min").innerHTML = picture;
  132. });
  133. }
  134. function handle_Picture(json) {
  135. console.log(json['results']['bindings']);
  136. var Biblio = "";
  137. var bibCit = "";
  138. const bibArray = [];
  139. var catImg = "";
  140. $.each(
  141. json['results']['bindings'],
  142. function (index, value) {
  143. var bib = value['bibliography']['value'];
  144. var pages = "";
  145. if (value.hasOwnProperty('pages')) {
  146. pages = value['pages']['value'];
  147. }
  148. if (value.hasOwnProperty('catalog')) {
  149. if (value['catalog']['value'] != "") {
  150. bibCit = value['bibliography']['value'];
  151. cc = value['catalog']['value'];
  152. cat = cc.split(", ");
  153. for (i in cat) {
  154. var marchini = cat[i].replace(".jpg", " (1).jpg");
  155. document.getElementById("expandedImg").src = "img/MPP_marchini_stampa/" + marchini;
  156. catImg += '<div class="col"> \
  157. <img class="viewImage" src="img/MPP_marchini_stampa/' + marchini + '" onclick="expandImg(this);" /> \
  158. </div>';
  159. }
  160. }
  161. }
  162. var book = bib + " " + pages;
  163. bibArray.push(book);
  164. });
  165. console.log(catImg);
  166. bibArray.sort();
  167. for (k in bibArray) {
  168. Biblio += '<li>' + bibArray[k] + '</li>';
  169. }
  170. document.getElementById("bibliography").innerHTML = Biblio;
  171. document.getElementById("catalog_description").innerHTML = bibCit;
  172. document.getElementById("image_catalog_min").innerHTML = catImg;
  173. }
  174. function get_dataset_name(graph) {
  175. var string = "Scheda Opera d'Arte";
  176. if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/martini") {
  177. string = string + " / Collezione Martini";
  178. }
  179. else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale") {
  180. string = string + " / Collezione Ospedale";
  181. }
  182. else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/datini") {
  183. string = string + " / Collezione Datini";
  184. }
  185. else {
  186. string = string;
  187. }
  188. return (string);
  189. }
  190. function handle_Production(json) {
  191. console.log(json['results']['bindings']);
  192. $.each(
  193. json['results']['bindings'],
  194. function (index, value) {
  195. var partecipants = "";
  196. var teche = "";
  197. var time = "";
  198. var client = "";
  199. var artist = "";
  200. var artist_name = "";
  201. if (value.hasOwnProperty('techniques')) {
  202. if (value['techniques']['value'] != "") {
  203. $("#MTC").css("display", "flex");
  204. tt = value['techniques']['value'];
  205. tec = tt.split("<br />");
  206. for (i in tec) {
  207. slice = tec[i].split("; ");
  208. /*teche += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
  209. teche += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
  210. slice[1] + "</a></div>";
  211. }
  212. }
  213. }
  214. if (value.hasOwnProperty('Partecipants')) {
  215. pp = value['Partecipants']['value'];
  216. people = pp.split("<br />");
  217. for (i in people) {
  218. slice = people[i].split("; ");
  219. if (slice[2] == "Committente") {
  220. $("#CMM").css("display", "flex");
  221. client += slice[1];
  222. } else {
  223. $("#AUT").css("display", "flex");
  224. artist_name += slice[1];
  225. artist += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
  226. slice[1] + "</a></div><div class='d-flex ml-auto'><div class='persona btn-icon' style='cursor:pointer' id='" +
  227. slice[0] + "'><i class='fa fa-user'></i><p class='btn-text'>PERSONA</p></div></div></div></div>";
  228. }
  229. }
  230. }
  231. if (value.hasOwnProperty('time') && (value['time']['value'] != "")) {
  232. $("#DT").css("display", "flex");
  233. time = value['time']['value'];
  234. }
  235. var authors = document.getElementsByClassName("author");
  236. for (i in authors) {
  237. authors[i].innerHTML = artist;
  238. }
  239. var dates = document.getElementsByClassName("date");
  240. for (i in dates) {
  241. dates[i].innerHTML = time;
  242. }
  243. document.getElementById("technique").innerHTML = teche;
  244. document.getElementById("client").innerHTML = client;
  245. });
  246. }
  247. function handle_Bibliography(json) {
  248. console.log(json['results']['bindings']);
  249. var Biblio = "";
  250. var bibCit = "";
  251. const bibArray = [];
  252. var catImg = "";
  253. $.each(
  254. json['results']['bindings'],
  255. function (index, value) {
  256. var bib = value['bibliography']['value'];
  257. var pages = "";
  258. if (value.hasOwnProperty('pages')) {
  259. pages = value['pages']['value'];
  260. }
  261. if (value.hasOwnProperty('catalog')) {
  262. if (value['catalog']['value'] != "") {
  263. bibCit = value['bibliography']['value'];
  264. cc = value['catalog']['value'];
  265. cat = cc.split(", ");
  266. for (i in cat) {
  267. var marchini = cat[i].replace(".jpg", " (1).jpg");
  268. document.getElementById("expandedImg").src = "img/MPP_marchini_stampa/" + marchini;
  269. catImg += '<div class="col"> \
  270. <img class="viewImage" src="img/MPP_marchini_stampa/' + marchini + '" onclick="expandImg(this);" /> \
  271. </div>';
  272. }
  273. }
  274. }
  275. var book = bib + " " + pages;
  276. bibArray.push(book);
  277. });
  278. console.log(catImg);
  279. bibArray.sort();
  280. for (k in bibArray) {
  281. Biblio += '<li>' + bibArray[k] + '</li>';
  282. }
  283. document.getElementById("bibliography").innerHTML = Biblio;
  284. document.getElementById("catalog_description").innerHTML = bibCit;
  285. document.getElementById("image_catalog_min").innerHTML = catImg;
  286. }
  287. function show_OA(){
  288. document.getElementById("OA_info").style.display = "block";
  289. document.getElementById("catalogo_info").style.display = "none";
  290. document.getElementById("scheda_info").style.display = "none";
  291. document.getElementById("image_artwork_min").style.display = "block";
  292. document.getElementById("image_catalog_min").style.display = "none";
  293. document.getElementById("image_scheda_min").style.display = "none";
  294. document.getElementById("img_title").innerHTML = "Opera";
  295. document.getElementById("expandedImg").src = "img/mpp_img/00000170e848f4658f120b2100c1002b006a007b.jpeg";
  296. }
  297. function show_CAT(){
  298. document.getElementById("OA_info").style.display = "none";
  299. document.getElementById("catalogo_info").style.display = "block";
  300. document.getElementById("scheda_info").style.display = "none";
  301. document.getElementById("image_artwork_min").style.display = "none";
  302. document.getElementById("image_catalog_min").style.display = "block";
  303. document.getElementById("image_scheda_min").style.display = "none";
  304. document.getElementById("img_title").innerHTML = "Catalogo";
  305. }
  306. function show_INV(){
  307. document.getElementById("OA_info").style.display = "none";
  308. document.getElementById("catalogo_info").style.display = "none";
  309. document.getElementById("scheda_info").style.display = "block";
  310. document.getElementById("image_artwork_min").style.display = "none";
  311. document.getElementById("image_catalog_min").style.display = "none";
  312. document.getElementById("image_scheda_min").style.display = "block";
  313. document.getElementById("img_title").innerHTML = "Scheda Storica";
  314. document.getElementById("expandedImg").src = "img/mpp_img/00000171bb65f52199367c7600c1002b006a007b-1.jpg";
  315. }