OA.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. function handle_OAdata(json) {
  8. console.log(json['results']['bindings']);
  9. $.each(
  10. json['results']['bindings'],
  11. function (index, value) {
  12. var graph = value['graph']['value'];
  13. var label = value['label']['value'];
  14. var uri = value['uri']['value'];
  15. var title = "";
  16. var type = "";
  17. var current_owner = "";
  18. var current_location = "";
  19. var subject = "";
  20. var dimensions = "";
  21. var materials = "";
  22. var condition = "";
  23. var note = "";
  24. var identifier = "";
  25. var unit = "";
  26. var inscription = "";
  27. var dataset = get_dataset_name(graph);
  28. if (value.hasOwnProperty('title')) {
  29. $("#SGTT").css("display", "flex");
  30. title = value['title']['value'];
  31. }
  32. if (value.hasOwnProperty('identifier')) {
  33. $("#NCT").css("display", "flex");
  34. identifier = value['identifier']['value'];
  35. }
  36. if (value.hasOwnProperty('type')) {
  37. $("#OGTD").css("display", "flex");
  38. type = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriType']['value'] + "'>" +
  39. value['type']['value'] + "</a></div></div>";
  40. }
  41. if (value.hasOwnProperty('current_owner')) {
  42. $("#LDCN").css("display", "flex");
  43. current_owner = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriOwner']['value'] + "'>" +
  44. value['current_owner']['value'] + "</a></div></div>";
  45. }
  46. if (value.hasOwnProperty('current_location')) {
  47. $("#LDCS").css("display", "flex");
  48. current_location = value['current_location']['value'];
  49. }
  50. if (value.hasOwnProperty('unit')) {
  51. unit = value['unit']['value'];
  52. }
  53. if (value.hasOwnProperty('subject')) {
  54. $("#SGTI").css("display", "flex");
  55. subject = value['subject']['value'];
  56. }
  57. if (value.hasOwnProperty('dimensions')) {
  58. if (value['dimensions']['value'] != "") {
  59. $("#MIS").css("display", "flex");
  60. dimensions = value['dimensions']['value'];
  61. }
  62. }
  63. if (value.hasOwnProperty('condition')) {
  64. $("#STCC").css("display", "flex");
  65. condition = value['condition']['value'];
  66. }
  67. if (value.hasOwnProperty('note')) {
  68. $("#NSC").css("display", "flex");
  69. note = value['note']['value'];
  70. }
  71. if (value.hasOwnProperty('iscrizione')) {
  72. $("#ISCR").css("display", "flex");
  73. inscription = value['iscrizione']['value'];
  74. }
  75. if (value.hasOwnProperty('uriSubjectPer')) {
  76. subject += "<br /><div class='d-flex'><div class='mr-3'><a href='" + value['uriSubjectPer']['value'] + "'>" +
  77. value['subject_person']['value'] + "</a></div><div class='d-flex ml-auto'><div class='persona btn-icon' style='cursor:pointer' id='" +
  78. value['uriSubjectPer']['value'] + "'><i class='fa fa-user'></i><p class='btn-text'>PERSONA</p></div></div></div></div>";
  79. }
  80. if (value.hasOwnProperty('Materials')) {
  81. if (value['Materials']['value'] != "") {
  82. $("#MTC").css("display", "flex");
  83. mm = value['Materials']['value'];
  84. mat = mm.split("<br />");
  85. for (i in mat) {
  86. slice = mat[i].split("; ");
  87. /*materials += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
  88. materials += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
  89. slice[1] + "</a></div>";
  90. }
  91. }
  92. }
  93. var Buttons = '<button title="Apri risorsa originale" class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
  94. <i class="fas fa-external-link-alt" aria-hidden="true"></i></button> \
  95. <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> \
  96. <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> \
  97. <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>';
  98. document.getElementById("grafo").innerHTML = dataset;
  99. document.getElementById("nome_oggetto").innerHTML = label;
  100. document.getElementById("identifier").innerHTML = identifier;
  101. document.getElementById("type").innerHTML = type;
  102. document.getElementById("owner").innerHTML = current_owner;
  103. document.getElementById("subject").innerHTML = subject;
  104. document.getElementById("dimensions").innerHTML = dimensions + unit;
  105. document.getElementById("materials").innerHTML = materials;
  106. document.getElementById("condition").innerHTML = condition;
  107. document.getElementById("description").innerHTML = note;
  108. document.getElementById("inscription").innerHTML = inscription;
  109. document.getElementById("link_buttons").innerHTML = Buttons;
  110. });
  111. }
  112. function get_dataset_name(graph) {
  113. var string = "Scheda Opera d'Arte";
  114. if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/martini") {
  115. string = string + " / Collezione Martini";
  116. }
  117. else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale") {
  118. string = string + " / Collezione Ospedale";
  119. }
  120. else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/datini") {
  121. string = string + " / Collezione Datini";
  122. }
  123. else {
  124. string = string;
  125. }
  126. return (string);
  127. }
  128. function handle_Production(json) {
  129. console.log(json['results']['bindings']);
  130. $.each(
  131. json['results']['bindings'],
  132. function (index, value) {
  133. var partecipants = "";
  134. var teche = "";
  135. var time = "";
  136. var client = "";
  137. var artist = "";
  138. var artist_name = "";
  139. if (value.hasOwnProperty('techniques')) {
  140. if (value['techniques']['value'] != "") {
  141. $("#MTC").css("display", "flex");
  142. tt = value['techniques']['value'];
  143. tec = tt.split("<br />");
  144. for (i in tec) {
  145. slice = tec[i].split("; ");
  146. /*teche += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
  147. teche += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
  148. slice[1] + "</a></div>";
  149. }
  150. }
  151. }
  152. if (value.hasOwnProperty('Partecipants')) {
  153. pp = value['Partecipants']['value'];
  154. people = pp.split("<br />");
  155. for (i in people) {
  156. slice = people[i].split("; ");
  157. if (slice[2] == "Committente") {
  158. $("#CMM").css("display", "flex");
  159. client += slice[1];
  160. } else {
  161. $("#AUT").css("display", "flex");
  162. artist_name += slice[1];
  163. artist += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
  164. slice[1] + "</a></div><div class='d-flex ml-auto'><div class='persona btn-icon' style='cursor:pointer' id='" +
  165. slice[0] + "'><i class='fa fa-user'></i><p class='btn-text'>PERSONA</p></div></div></div></div>";
  166. }
  167. }
  168. }
  169. if (value.hasOwnProperty('time') && (value['time']['value'] != "")) {
  170. $("#DT").css("display", "flex");
  171. time = value['time']['value'];
  172. }
  173. document.getElementById("technique").innerHTML = teche;
  174. document.getElementById("date").innerHTML = time;
  175. document.getElementById("artist").innerHTML = artist;
  176. document.getElementById("client").innerHTML = client;
  177. });
  178. }
  179. function show_OA(){
  180. document.getElementById("OA_info").style.display = "block";
  181. document.getElementById("catalogo_info").style.display = "none";
  182. document.getElementById("scheda_info").style.display = "none";
  183. document.getElementById("image_artwork").style.display = "block";
  184. document.getElementById("image_catalog").style.display = "none";
  185. document.getElementById("image_scheda").style.display = "none";
  186. document.getElementById("img_title").innerHTML = "Opera";
  187. }
  188. function show_CAT(){
  189. document.getElementById("OA_info").style.display = "none";
  190. document.getElementById("catalogo_info").style.display = "block";
  191. document.getElementById("scheda_info").style.display = "none";
  192. document.getElementById("image_artwork").style.display = "none";
  193. document.getElementById("image_catalog").style.display = "block";
  194. document.getElementById("image_scheda").style.display = "none";
  195. document.getElementById("img_title").innerHTML = "Catalogo";
  196. }
  197. function show_INV(){
  198. document.getElementById("OA_info").style.display = "none";
  199. document.getElementById("catalogo_info").style.display = "none";
  200. document.getElementById("scheda_info").style.display = "block";
  201. document.getElementById("image_artwork").style.display = "none";
  202. document.getElementById("image_catalog").style.display = "none";
  203. document.getElementById("image_scheda").style.display = "block";
  204. document.getElementById("img_title").innerHTML = "Scheda Storica";
  205. }