Alessia Spadi há 2 anos atrás
pai
commit
1f6a2f4e59
2 ficheiros alterados com 145 adições e 22 exclusões
  1. 34 3
      Persona.html
  2. 111 19
      js/people.js

+ 34 - 3
Persona.html

@@ -265,11 +265,18 @@
 										Luoghi collegati a <span id="nome1" class="font-italic PN"></span>
 									</h2>
 								</div>
-
+								
 								<div class="row">
 									<div class="col-9">
 										<div id="people_map">
-											<div id="map"></div>
+											<div id="map">
+												<div id="map_icon" class="no_info_icon">
+													<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
+													<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M408 120C408 174.6 334.9 271.9 302.8 311.1C295.1 321.6 280.9 321.6 273.2 311.1C241.1 271.9 168 174.6 168 120C168 53.73 221.7 0 288 0C354.3 0 408 53.73 408 120zM288 152C310.1 152 328 134.1 328 112C328 89.91 310.1 72 288 72C265.9 72 248 89.91 248 112C248 134.1 265.9 152 288 152zM425.6 179.8C426.1 178.6 426.6 177.4 427.1 176.1L543.1 129.7C558.9 123.4 576 135 576 152V422.8C576 432.6 570 441.4 560.9 445.1L416 503V200.4C419.5 193.5 422.7 186.7 425.6 179.8zM150.4 179.8C153.3 186.7 156.5 193.5 160 200.4V451.8L32.91 502.7C17.15 508.1 0 497.4 0 480.4V209.6C0 199.8 5.975 190.1 15.09 187.3L137.6 138.3C140 152.5 144.9 166.6 150.4 179.8H150.4zM327.8 331.1C341.7 314.6 363.5 286.3 384 255V504.3L192 449.4V255C212.5 286.3 234.3 314.6 248.2 331.1C268.7 357.6 307.3 357.6 327.8 331.1L327.8 331.1z"/>
+													</svg>
+													<p>Nessun luogo trovato</p>
+												</div>
+											</div>
 										</div>
 									</div>
 
@@ -291,7 +298,14 @@
 								<div class="row">
 									<div class="col-9">
 										<div id="person_map" style="background-color: #fff; min-height:300px; margin-left:15px; margin-right:15px;">
-											<div id="myWordCloud"></div>
+											<div id="myWordCloud">
+												<div id="users_icon" class="no_info_icon">
+													<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
+														<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M319.9 320c57.41 0 103.1-46.56 103.1-104c0-57.44-46.54-104-103.1-104c-57.41 0-103.1 46.56-103.1 104C215.9 273.4 262.5 320 319.9 320zM369.9 352H270.1C191.6 352 128 411.7 128 485.3C128 500.1 140.7 512 156.4 512h327.2C499.3 512 512 500.1 512 485.3C512 411.7 448.4 352 369.9 352zM512 160c44.18 0 80-35.82 80-80S556.2 0 512 0c-44.18 0-80 35.82-80 80S467.8 160 512 160zM183.9 216c0-5.449 .9824-10.63 1.609-15.91C174.6 194.1 162.6 192 149.9 192H88.08C39.44 192 0 233.8 0 285.3C0 295.6 7.887 304 17.62 304h199.5C196.7 280.2 183.9 249.7 183.9 216zM128 160c44.18 0 80-35.82 80-80S172.2 0 128 0C83.82 0 48 35.82 48 80S83.82 160 128 160zM551.9 192h-61.84c-12.8 0-24.88 3.037-35.86 8.24C454.8 205.5 455.8 210.6 455.8 216c0 33.71-12.78 64.21-33.16 88h199.7C632.1 304 640 295.6 640 285.3C640 233.8 600.6 192 551.9 192z"/>
+													</svg>
+													<p>Nessuna persona trovata</p>
+												</div>
+											</div>
 										</div>
 									</div>
 
@@ -304,6 +318,7 @@
 
 							<div class="placeholder_container">
 								<div id="placeholder_documenti" class="row" id="references_documents">
+									<p class="section_box col-12">Documenti collegati a <span id="nome3" class="font-italic PN"></span></p>
 									<div class="box_results col-12" id="sent">
 										<div class="inner_results container-fluid">
                                           
@@ -340,6 +355,22 @@
 										</div>
 									</div>
 
+									<div class="box_results col-12" id="others">
+										<div class="inner_results container-fluid">
+											<div class="row def_res">
+												<div class="col">
+													<b>Altri documenti associati a <span id="nome_ass" class="PN"></span></b>
+												</div>
+												<div class="col num_res">
+													<span><span id="n_ass"></span> risultati</span>
+												</div>
+											</div>
+											<div class="row res_list">
+												<div class="container-fluid" id="other_documents"></div>
+											</div>
+										</div>
+									</div>
+
 									<div class="box_results col-12" id="citations">
 										<div class="inner_results container-fluid">
 											<div class="row def_res">

+ 111 - 19
js/people.js

@@ -66,7 +66,21 @@ crm:P27_moved_from ?place_from . \
 owl:sameAs ?place . \
 ?place rdfs:label ?label ; \
 crm:P168_place_is_defined_by ?coordinates . \
-} \
+} UNION { \
+  <" + thisUrlParams.link + "> crm:P100i_died_in ?uri_death . \
+  ?uri_death crm:P7_took_place_at ?uri_place . \
+  ?uri_place rdf:type crm:E53_Place ; \
+  owl:sameAs ?place .  \
+  ?place rdfs:label ?label ;  \
+  crm:P168_place_is_defined_by ?coordinates . \
+  } UNION { \
+    <" + thisUrlParams.link + "> crm:P98i_was_born ?uri_birth . \
+  ?uri_birth crm:P7_took_place_at ?uri_place . \
+  ?uri_place rdf:type crm:E53_Place ; \
+  owl:sameAs ?place . \
+  ?place rdfs:label ?label ;  \
+  crm:P168_place_is_defined_by ?coordinates . \
+  } \
 }"
 
 queryInfo = prefixes + " SELECT DISTINCT ?graph ?label ?identifier ?name ?givenName ?familyName ?alias (GROUP_CONCAT(DISTINCT CONCAT(?variant, '| ', ?otherName) ; SEPARATOR = ';') AS ?variants) ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation (group_concat(distinct ?relative1 ;separator=', ') as ?relatives) ?qualification ?group \
@@ -121,6 +135,19 @@ OPTIONAL {?ev_move crm:P4_has_time-span ?uri_ts . \
 ?uri_ts rdfs:label ?time_span . } \
 }"
 
+queryOtherDoc = prefixes + " SELECT DISTINCT ?document ?label ?id (group_concat(distinct ?time_span ;separator='-') as ?time_span) \
+WHERE {<" + thisUrlParams.link + "> rdf:type crm:E21_Person . \
+?creation crm:P67_refers_to <" + thisUrlParams.link + "> . \
+?document crm:P92i_was_brought_into_existence_by ?creation ; \
+rdfs:label ?label ; \
+crm:P1_is_identified_by ?uri_id . \
+?uri_id rdfs:label ?id ; \
+crm:P2_has_type 'Segnatura' . \
+OPTIONAL {?creation crm:P4_has_time-span ?uri_time_span . \
+?uri_time_span rdfs:label ?time_span . } \
+} \
+GROUP BY ?document ?label ?id "
+
 queryOpere = prefixes + " SELECT DISTINCT ?subject ?label ?nct (group_concat(distinct ?time_span ;separator='-') as ?time_span) \
 WHERE {?subject rdf:type crm:E22_Man-Made_Object ; \
 rdfs:label ?label ; \
@@ -167,6 +194,8 @@ queryURL = prepareQueryURL(query);
 
 queryNet = prepareQueryURL(queryNetwork);
 
+queryOt = prepareQueryURL(queryOtherDoc);
+
 queryOA = prepareQueryURL(queryOpere);
 
 query = prepareQueryURL(queryInfo);
@@ -223,6 +252,15 @@ responseOA = $.ajax({
   error: function (e) {}
 });
 
+responseOt = $.ajax({
+
+  url: queryOt,
+  dataType: "json",
+  success: function (data){
+    handle_Documents(data);
+  },
+  error: function (e) {}
+});
 
 
 function handle_data(json) {
@@ -456,6 +494,7 @@ function handle_Letters(json) {
 
   }
 
+
   //POPULATE RECEIVE LETTERS BOX
 
   for (var i=0; i<receive.length; i++) {
@@ -489,12 +528,12 @@ function handle_Letters(json) {
   document.getElementById("letters_send").innerHTML = Send_Letters;
   document.getElementById("letters_receive").innerHTML = Receive_Letters;
 
-  if (i==0) {
+  if (send.length==0) {
     var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
     document.getElementById("letters_send").innerHTML = messaggio;
   }
 
-  if (j==0) {
+  if (receive.length==0) {
     var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
     document.getElementById("letters_receive").innerHTML = messaggio;
   }
@@ -543,24 +582,64 @@ function handle_Artwork(json) {
     '<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + oa[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>';
   }
 
-    /*if (receive[i][4] != "") {
-          infObject_button  += '<button type="button" id="' + receive[i][4] + 
-          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
-    } else {
-          infObject_button  += '<button type="button" id="' + receive[i][0] + 
-          '" class="object btn btn-default" alt="oggetto" title="' + receive[i][1] + 
-          '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
+  document.getElementById("n_oa").innerHTML = oa.length;
+  document.getElementById("object_oa").innerHTML = Artworks;
+
+  if (oa.length==0) {
+    var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
+    document.getElementById("object_oa").innerHTML = messaggio;
+  }
+
+}
+
+function handle_Documents(json) {
+
+  console.log(json);
+
+  const doc = [];
+
+  $.each(
+      json['results']['bindings'],
+      function (index, value) {
+        uri = value['document']['value'];
+        label = value['label']['value'];
+        id = value['id']['value'];
+        var data = "";
+        
+        if (value.hasOwnProperty('time_span')) {
+            data = value['time_span']['value'];
+        }
+
+        doc.push([uri, label, id, data]);
+        
+      });
+
+  var Documents = "";
+
+  for (var i=0; i<doc.length; i++) {
+    var artwork = '<a href=' + doc[i][0] + ' target="_blank">' + doc[i][1] + '</a><br />Segnatura: ' + doc[i][2];
+    if (doc[i][3] != "") {
+      artwork = artwork + "<br />Data: " + doc[i][3];
     }
 
-    Receive_Letters += '<div class="row res"><div class="col-8"><p>'+ artwork +'</p></div>' + 
-        '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
-        '<button type="button" id="' + receive[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" id="' + receive[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/?' + receive[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>';
-  }*/
+    var object_button  = '<button type="button" id="' + doc[i][0] + 
+      '" class="object btn btn-default" alt="opera d\'arte" title="' + doc[i][1] + 
+      '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
 
-  document.getElementById("n_oa").innerHTML = oa.length;
-  document.getElementById("object_oa").innerHTML = Artworks;
+      Documents += '<div class="row res"><div class="col-8"><p>'+ artwork +'</p></div>' + 
+    '<div class="col d-flex align-items-start justify-content-end">' + object_button +
+    '<button type="button" id="' + doc[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" id="' + doc[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/?' + doc[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_ass").innerHTML = doc.length;
+  document.getElementById("other_documents").innerHTML = Documents;
+
+  if (doc.length==0) {
+    var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
+    document.getElementById("other_documents").innerHTML = messaggio;
+  }
 
 }
 
@@ -599,6 +678,12 @@ function handle_map(json) {
   var latitude = lat/i;
   var longitude = long/i;
 
+  if (locations.length > 0) {
+    $("#map_icon").css("display", "none");
+  } else {
+    $("#references_persona").css("display", "none");
+  }
+
   document.getElementById("list_places_person").innerHTML = myPlaces;
 
 
@@ -704,7 +789,6 @@ function handle_network(json) {
       sum += temp;
       }
     }
-
   
 
   document.getElementById("list_person_network").innerHTML = ArrayNames;
@@ -733,6 +817,7 @@ function handle_network(json) {
 
   // append the svg object to the body of the page
   var svg = d3.select("#myWordCloud").append("svg")
+      .attr("id", "wordcloudNetwork")
       .attr("width", width + margin.left + margin.right)
       .attr("height", height + margin.top + margin.bottom)
       .append("g")
@@ -783,6 +868,13 @@ function handle_network(json) {
                   .attr('font-size', 1)
                   .remove();
     }
+
+    if (words.length > 0) {
+      $("#users_icon").css("display", "none");
+    } else {
+      $("#wordcloudNetwork").css("display", "none");
+      $("#references_network").css("display", "none");
+    }
 }
 
 $(document).on("click", ".luogo", function (ev) {