kora 3 سال پیش
والد
کامیت
771726c011
4فایلهای تغییر یافته به همراه200 افزوده شده و 172 حذف شده
  1. 9 9
      Persona.html
  2. 0 162
      js/people.js
  3. 189 0
      js/people_letters.js
  4. 2 1
      js/word_cloud.js

+ 9 - 9
Persona.html

@@ -17,17 +17,11 @@
 
 	<link href="css/place_people.css" rel="stylesheet">
 
-	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
-	<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
-	<script src="https://d3js.org/d3.v3.min.js"></script>
-	<script src="https://cdn.jsdelivr.net/gh/holtzy/D3-graph-gallery@master/LIB/d3.layout.cloud.js"></script>
 
 	<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.css" />
-	<script src="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.js"></script>
 
 	<link rel="stylesheet" href="js/dist/MarkerCluster.css" />
 	<link rel="stylesheet" href="js/dist/MarkerCluster.Default.css" />
-	<script src="js/dist/leaflet.markercluster-src.js"></script>
 
 	<link href="css/styles.min.css" rel="stylesheet">
 </head>
@@ -559,13 +553,19 @@
 		</div>
 	</footer>
 
+	<!-- SCRIPTS -->
+	<!-- Third-party scripts for the page -->
+	<script src="vendor/jquery/jquery.min.js"></script>
+	<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
+	<script src="https://d3js.org/d3.v3.min.js"></script>
+	<script src="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.js"></script>
+	<script src="js/dist/leaflet.markercluster-src.js"></script>
+	<!-- Third-party scripts for the page -->
 	<script src="js/people.js"></script>
+	<script src="js/people_letters.js"></script>
 	<script src="js/rectangles.js"></script>
 	<script src="js/word_cloud.js"></script>
 
-	<!-- Bootstrap core JavaScript -->
-	<script src="vendor/jquery/jquery.min.js"></script>
-	<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
 </body>
 
 </html>

+ 0 - 162
js/people.js

@@ -180,29 +180,6 @@ OPTIONAL {?uri_person crm:P74_has_current_or_former_residence ?uri_provenienza .
 rdfs:label ?provenienza . } \
 } "
 
-queryLetters = prefixes + " SELECT DISTINCT ?type ?segnatura ?document_uri ?document_name ?time_span ?InfObj \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-{?pc crm:P02_has_range ?uri . \
-} UNION { \
-?group crm:P107_has_current_or_former_member ?uri; \
-    crm:P2_has_type 'Gruppo scrittura lettera' . \
-?pc crm:P02_has_range ?group . \
-} \
-?ev_move crm:P01_has_domain ?pc ; \
-    rdfs:label ?type ; \
-    rdfs:subClassOf ?event . \
-?document_uri crm:P25i_moved_by ?event ; \
-    rdfs:label ?document_name . \
-?document_uri crm:P1_is_identified_by ?uriSegnatura . \
-?uriSegnatura crm:P2_has_type 'Segnatura' ; \
-    rdfs:label ?segnatura . \
-OPTIONAL {GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> {?document_uri crm:P128_carries ?InfObj . \
-?InfObj rdf:type crm:E73_Information_Object} }. \
-OPTIONAL {?ev_move crm:P4_has_time-span ?uri_ts . \
-?uri_ts rdfs:label ?time_span . } \
-}"
-
 queryDocuments = prefixes + " SELECT DISTINCT ?role ?document ?label ?id (group_concat(distinct ?time_span ;separator='-') as ?time_span) \
 WHERE { \
 ?document ?property ?event ; \
@@ -320,8 +297,6 @@ queryOA = prepareQueryURL(queryOpere);
 
 query = prepareQueryURL(queryInfo);
 
-queryEx = prepareQueryURL(queryLetters);
-
 queryGt = prepareQueryURL(queryGettatelliEv);
 
 queryInfoGt = prepareQueryURL(queryInfoGettatelli);
@@ -354,15 +329,6 @@ response = $.ajax({
     error: function (e) {}
 });
 
-responseLet = $.ajax({
-
-    url: queryEx,
-    dataType: "json",
-    success: function (data){
-      handle_Letters(data);
-    },
-    error: function (e) {}
-});
 
 responseOA = $.ajax({
 
@@ -1063,134 +1029,6 @@ function handle_Compagnia(json) {
       
 }
 
-function handle_Letters(json) {
-
-  //console.log(json);
-
-  const send = [];
-  const receive = [];
-
-  var i=0;
-  var j=0;
-
-  $.each(
-      json['results']['bindings'],
-      function (index, value) {
-        type = value['type']['value'];
-        uri = value['document_uri']['value'];
-        title = value['document_name']['value'];
-        segnatura = value['segnatura']['value'];
-        var data = "";
-        var InfObj = "";
-        if (value.hasOwnProperty('time_span')) {
-            data = value['time_span']['value'];
-        }
-        if (value.hasOwnProperty('InfObj')) {
-            InfObj = value['InfObj']['value'];
-        }
-        if (type == "Invio") {
-          send.push([uri, title, segnatura, data, InfObj]);
-          i++;
-        } else {
-          receive.push([uri, title, segnatura, data, InfObj]);
-          j++;
-        }    
-      });
-
-  var Send_Letters = "";
-  var Receive_Letters = "";
-
-  //POPULATE SEND LETTERS BOX
-
-  for (var i=0; i<send.length; i++) {
-    var letter = "";
-    var infObject_button = "";
-    var object_type = "";
-
-    if (send[i][4] != "") {
-          letter = '<div class="col-8"><p><span id="' + send[i][0] + '" class="title_doc lettera">'+ send[i][1] + '</span>';
-          object_type = "lettera";
-          infObject_button  += '<button type="button" id="' + send[i][4] + 
-          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
-    } else {
-          letter = '<div class="col-8"><p><span id="' + send[i][0] + '" class="title_doc object">'+ send[i][1] + '</span>';
-          object_type = "object";
-          infObject_button  += '<button type="button" id="' + send[i][0] + 
-          '" class="object btn btn-default" alt="oggetto" title="' + send[i][1] + 
-          '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
-    }
-
-    if (send[i][2] != "") {
-      letter = letter + "<br />Segnatura: " + send[i][2];
-    }
-    if (send[i][3] != "") {
-      letter = letter + "<br />Data: " + send[i][3];
-    }
-
-    letter = letter + '</p></div>';
-
-    Send_Letters += '<div class="row res">'+ letter + 
-        '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
-        '<button type="button" value="' + object_type + '" id="' + send[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="' + object_type + '" id="' + send[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/?' + send[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>';
-
-  }
-
-
-  //POPULATE RECEIVE LETTERS BOX
-
-  for (var i=0; i<receive.length; i++) {
-    var letter = "";
-    var infObject_button = "";
-    var object_type = "";
-
-    if (receive[i][4] != "") {
-          letter = '<div class="col-8"><p><span id="' + receive[i][0] + '" class="title_doc lettera">'+ receive[i][1] + '</span>';
-          object_type = "lettera";
-          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 {
-          letter = '<div class="col-8"><p><span id="' + receive[i][0] + '" class="title_doc object">'+ receive[i][1] + '</span>';
-          object_type = "object";
-          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>';
-    }
-
-    if (receive[i][2] != "") {
-      letter = letter + "<br />Segnatura: " + receive[i][2];
-    }
-    if (receive[i][3] != "") {
-      letter = letter + "<br />Data: " + receive[i][3];
-    }
-
-    letter = letter + '</p></div>';
-
-    Receive_Letters += '<div class="row res">'+ letter + 
-        '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
-        '<button type="button" value="' + object_type + '" 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" value="' + object_type + '" 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>';
-  }
-
-  document.getElementById("l_send").innerHTML = send.length;
-  document.getElementById("l_receive").innerHTML = receive.length;
-  document.getElementById("letters_send").innerHTML = Send_Letters;
-  document.getElementById("letters_receive").innerHTML = Receive_Letters;
-
-  if (send.length==0) {
-    var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
-    document.getElementById("letters_send").innerHTML = messaggio;
-  }
-
-  if (receive.length==0) {
-    var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
-    document.getElementById("letters_receive").innerHTML = messaggio;
-  }
-
-}
-
 
 function handle_Artwork(json) {
 

+ 189 - 0
js/people_letters.js

@@ -0,0 +1,189 @@
+
+// SPARQL Query text -- 'prefixes' and 'thisUrlParams' defined in people.js; 
+queryLetters = prefixes +
+" SELECT DISTINCT ?type ?segnatura ?document_uri ?document_name ?time_span ?InfObj ?otherPerson" +
+" {" +
+    " VALUES ?uri {<" + thisUrlParams.link + ">} " +
+
+        " {?pc crm:P02_has_range ?uri .}" +
+    " UNION" +
+        " {?group crm:P107_has_current_or_former_member ?uri;" +
+        " crm:P2_has_type 'Gruppo scrittura lettera' ." +
+        " ?pc crm:P02_has_range ?group .}" +
+
+        " {?ev_move crm:P01_has_domain ?pc ;" +
+        " rdfs:label ?type ;" +
+        " rdfs:subClassOf ?event . FILTER regex(?type, 'Invio')" +
+        " ?event ^rdfs:subClassOf ?move_comp ." +
+        " ?move_comp rdfs:label 'Ricezione' ;" +
+            " crm:P01_has_domain ?cob_comp ." +
+        " ?cob_comp crm:P02_has_range ?uri_comp ." +
+        " ?uri_comp rdfs:label ?otherPerson. }" +
+    " UNION" +
+        " {?ev_move crm:P01_has_domain ?pc ;" +
+        " rdfs:label ?type ;" +
+        " rdfs:subClassOf ?event . FILTER regex(?type, 'Ricezione')" +
+        " ?event ^rdfs:subClassOf ?move_comp ." +
+        " ?move_comp rdfs:label 'Ricezione' ;" +
+            " crm:P01_has_domain ?cob_comp ." +
+        " ?cob_comp crm:P02_has_range ?uri_comp ." +
+        " ?uri_comp rdfs:label ?otherPerson. }" +
+    
+    " ?document_uri crm:P25i_moved_by ?event ;" +
+    " rdfs:label ?document_name ." +
+    " ?document_uri crm:P1_is_identified_by ?uriSegnatura ." +
+    " ?uriSegnatura crm:P2_has_type 'Segnatura' ;" +
+    " rdfs:label ?segnatura ." +
+    " OPTIONAL" +
+        " {GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini>" +
+            " {?document_uri crm:P128_carries ?InfObj ." +
+            " ?InfObj rdf:type crm:E73_Information_Object} }." +
+    " OPTIONAL" +
+        " {?ev_move crm:P4_has_time-span ?uri_ts ." +
+        " ?uri_ts rdfs:label ?time_span . }" +
+" }"
+
+
+// 'prepareQueryURL' defined in people.js
+queryEx = prepareQueryURL(queryLetters);
+
+responseLet = $.ajax({
+
+    url: queryEx,
+    dataType: "json",
+    success: function (data){
+      handle_Letters(data);
+    },
+    error: function (e) {}
+});
+
+
+
+function handle_Letters(json) {
+
+    console.log(json);
+  
+    const send = [];
+    const receive = [];
+  
+    var i=0;
+    var j=0;
+  
+    $.each(
+        json['results']['bindings'],
+        function (index, value) {
+          type = value['type']['value'];
+          uri = value['document_uri']['value'];
+          title = value['document_name']['value'];
+          segnatura = value['segnatura']['value'];
+          var data = "";
+          var InfObj = "";
+          if (value.hasOwnProperty('time_span')) {
+              data = value['time_span']['value'];
+          }
+          if (value.hasOwnProperty('InfObj')) {
+              InfObj = value['InfObj']['value'];
+          }
+          if (type == "Invio") {
+            send.push([uri, title, segnatura, data, InfObj]);
+            i++;
+          } else {
+            receive.push([uri, title, segnatura, data, InfObj]);
+            j++;
+          }    
+        });
+  
+    var Send_Letters = "";
+    var Receive_Letters = "";
+  
+    //POPULATE SEND LETTERS BOX
+  
+    for (var i=0; i<send.length; i++) {
+      var letter = "";
+      var infObject_button = "";
+      var object_type = "";
+  
+      if (send[i][4] != "") {
+            letter = '<div class="col-8"><p><span id="' + send[i][0] + '" class="title_doc lettera">'+ send[i][1] + '</span>';
+            object_type = "lettera";
+            infObject_button  += '<button type="button" id="' + send[i][4] + 
+            '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
+      } else {
+            letter = '<div class="col-8"><p><span id="' + send[i][0] + '" class="title_doc object">'+ send[i][1] + '</span>';
+            object_type = "object";
+            infObject_button  += '<button type="button" id="' + send[i][0] + 
+            '" class="object btn btn-default" alt="oggetto" title="' + send[i][1] + 
+            '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
+      }
+  
+      if (send[i][2] != "") {
+        letter = letter + "<br />Segnatura: " + send[i][2];
+      }
+      if (send[i][3] != "") {
+        letter = letter + "<br />Data: " + send[i][3];
+      }
+  
+      letter = letter + '</p></div>';
+  
+      Send_Letters += '<div class="row res">'+ letter + 
+          '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
+          '<button type="button" value="' + object_type + '" id="' + send[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="' + object_type + '" id="' + send[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/?' + send[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>';
+  
+    }
+  
+  
+    //POPULATE RECEIVE LETTERS BOX
+  
+    for (var i=0; i<receive.length; i++) {
+      var letter = "";
+      var infObject_button = "";
+      var object_type = "";
+  
+      if (receive[i][4] != "") {
+            letter = '<div class="col-8"><p><span id="' + receive[i][0] + '" class="title_doc lettera">'+ receive[i][1] + '</span>';
+            object_type = "lettera";
+            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 {
+            letter = '<div class="col-8"><p><span id="' + receive[i][0] + '" class="title_doc object">'+ receive[i][1] + '</span>';
+            object_type = "object";
+            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>';
+      }
+  
+      if (receive[i][2] != "") {
+        letter = letter + "<br />Segnatura: " + receive[i][2];
+      }
+      if (receive[i][3] != "") {
+        letter = letter + "<br />Data: " + receive[i][3];
+      }
+  
+      letter = letter + '</p></div>';
+  
+      Receive_Letters += '<div class="row res">'+ letter + 
+          '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
+          '<button type="button" value="' + object_type + '" 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" value="' + object_type + '" 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>';
+    }
+  
+    document.getElementById("l_send").innerHTML = send.length;
+    document.getElementById("l_receive").innerHTML = receive.length;
+    document.getElementById("letters_send").innerHTML = Send_Letters;
+    document.getElementById("letters_receive").innerHTML = Receive_Letters;
+  
+    if (send.length==0) {
+      var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
+      document.getElementById("letters_send").innerHTML = messaggio;
+    }
+  
+    if (receive.length==0) {
+      var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
+      document.getElementById("letters_receive").innerHTML = messaggio;
+    }
+  
+  }
+  

+ 2 - 1
js/word_cloud.js

@@ -144,7 +144,8 @@ function filterLetters(e){
         responseLet.then(data => {
             
             let lettersJson = data.results.bindings;
-            console.log('AH!', lettersJson[0]);
+            lettersJson = lettersJson.filter(letter => letter.otherPerson.value==name);
+            console.log(lettersJson);
         });
 
     } catch{