OA.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 title = "";
  15. var type = "";
  16. var current_owner = "";
  17. var current_location = "";
  18. var subject = "";
  19. var dimensions = "";
  20. var materials = "";
  21. var condition = "";
  22. var note = "";
  23. var identifier = "";
  24. var unit = "";
  25. var dataset = get_dataset_name(graph);
  26. if (value.hasOwnProperty('title')) {
  27. $("#SGTT").css("display", "flex");
  28. title = value['title']['value'];
  29. }
  30. if (value.hasOwnProperty('identifier')) {
  31. $("#NCT").css("display", "flex");
  32. identifier = value['identifier']['value'];
  33. }
  34. if (value.hasOwnProperty('type')) {
  35. $("#OGTD").css("display", "flex");
  36. type = "<div class='d-flex'><div class='mr-3'>" +
  37. value['type']['value'] + "</div><div class='d-flex ml-auto'><div class='mr-3'><a class='btn-icon' target='_blank' href='" +
  38. value['uriType']['value'] + "'><i class='fa fa-bullseye' aria-hidden='true'></i><p class='btn-text'>AAT</p></a></div></div></div></div>";
  39. }
  40. if (value.hasOwnProperty('current_owner')) {
  41. $("#LDCN").css("display", "flex");
  42. current_owner = "<div class='d-flex'><div class='mr-3'>" +
  43. value['current_owner']['value'] + "</div><div class='d-flex ml-auto'><div class='mr-3'><a class='btn-icon' target='_blank' href='" +
  44. value['uriOwner']['value'] + "'><i class='fas fa-external-link-alt' aria-hidden='true'></i><p class='btn-text'>LINK</p></a></div></div></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('Materials')) {
  72. if (value['Materials']['value'] != "") {
  73. $("#MTC").css("display", "flex");
  74. mm = value['Materials']['value'];
  75. mat = mm.split("<br />");
  76. for (i in mat) {
  77. slice = mat[i].split("; ");
  78. /*materials += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
  79. materials += "<div class='d-flex'><div class='mr-3'>" +
  80. slice[1] + "</div><div class='d-flex ml-auto'><div class='mr-3'><a class='btn-icon' target='_blank' href='" +
  81. slice[0] + "'><i class='fa fa-bullseye' aria-hidden='true'></i><p class='btn-text'>AAT</p></a></div></div></div></div>";
  82. }
  83. }
  84. }
  85. document.getElementById("grafo").innerHTML = dataset;
  86. document.getElementById("nome_oggetto").innerHTML = label;
  87. /*document.getElementById("title").innerHTML = title;*/
  88. document.getElementById("identifier").innerHTML = identifier;
  89. document.getElementById("type").innerHTML = type;
  90. document.getElementById("owner").innerHTML = current_owner;
  91. /*document.getElementById("location").innerHTML = current_location;*/
  92. document.getElementById("subject").innerHTML = subject;
  93. document.getElementById("dimensions").innerHTML = dimensions + unit;
  94. document.getElementById("materials").innerHTML = materials;
  95. document.getElementById("condition").innerHTML = condition;
  96. document.getElementById("description").innerHTML = note;
  97. });
  98. }
  99. function get_dataset_name(graph) {
  100. var string = "Scheda Opera d'Arte";
  101. if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/martini") {
  102. string = string + " / Collezione Martini";
  103. }
  104. else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale") {
  105. string = string + " / Collezione Ospedale";
  106. }
  107. else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/datini") {
  108. string = string + " / Collezione Datini";
  109. }
  110. else {
  111. string = string;
  112. }
  113. return (string);
  114. }
  115. function handle_Production(json) {
  116. console.log(json['results']['bindings']);
  117. $.each(
  118. json['results']['bindings'],
  119. function (index, value) {
  120. var partecipants = "";
  121. var teche = "";
  122. var time = "";
  123. var client = "";
  124. var artist = "";
  125. var artist_name = "";
  126. if (value.hasOwnProperty('techniques')) {
  127. if (value['techniques']['value'] != "") {
  128. $("#MTC").css("display", "flex");
  129. tt = value['techniques']['value'];
  130. tec = tt.split("<br />");
  131. for (i in tec) {
  132. slice = tec[i].split("; ");
  133. /*teche += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
  134. teche += "<div class='d-flex'><div class='mr-3'>" +
  135. slice[1] + "</div><div class='d-flex ml-auto'><div class='mr-3'><a class='btn-icon' target='_blank' href='" +
  136. slice[0] + "'><i class='fa fa-bullseye' aria-hidden='true'></i><p class='btn-text'>AAT</p></a></div></div></div></div>";
  137. }
  138. }
  139. }
  140. if (value.hasOwnProperty('Partecipants')) {
  141. pp = value['Partecipants']['value'];
  142. people = pp.split("<br />");
  143. for (i in people) {
  144. slice = people[i].split("; ");
  145. if (slice[2] == "Committente") {
  146. $("#CMM").css("display", "flex");
  147. client += slice[1];
  148. } else {
  149. $("#AUT").css("display", "flex");
  150. artist_name += slice[1];
  151. artist += "<div class='d-flex'><div class='mr-3'>" +
  152. slice[1] + "</div><div class='d-flex ml-auto'><div class='mr-3'><a class='btn-icon' target='_blank' href='" +
  153. slice[0] + "'><i class='fas fa-external-link-alt' aria-hidden='true'></i><p class='btn-text'>LINK</p></a></div><div class='persona btn-icon' style='cursor:pointer' id='" +
  154. slice[0] + "'><i class='fa fa-user'></i><p class='btn-text'>SCHEDA<br />PERSONA</p></div></div></div></div>";
  155. }
  156. }
  157. }
  158. if (value.hasOwnProperty('time')) {
  159. time = value['time']['value'];
  160. }
  161. document.getElementById("technique").innerHTML = teche;
  162. document.getElementById("time").innerHTML = time;
  163. /*document.getElementById("artist_name").innerHTML = artist_name;*/
  164. document.getElementById("artist").innerHTML = artist;
  165. document.getElementById("client").innerHTML = client;
  166. });
  167. }