Parcourir la source

New queries added

Alessia Spadi il y a 1 an
Parent
commit
bf5dd996f4
3 fichiers modifiés avec 85 ajouts et 44 suppressions
  1. 26 8
      js/map.js
  2. 57 34
      js/object.js
  3. 2 2
      object.html

+ 26 - 8
js/map.js

@@ -96,7 +96,8 @@ OPTIONAL {?event_to crm:P4_has_time-span ?uri_ts . \
 
 queryCitazione = prefixes + " SELECT DISTINCT ?segnatura ?document_uri ?document_name SAMPLE(?time_span) AS ?time_span ?InfObj \
 WHERE { \
-<" + thisUrlParams.link + "> crm:P1_is_identified_by ?toponym . \
+VALUES ?uri {<" + thisUrlParams.link + ">} \
+{?uri crm:P1_is_identified_by ?toponym . \
 ?InfObj crm:P67_refers_to ?toponym . \
 ?document_uri crm:P128_carries ?InfObj ; \
 rdfs:label ?document_name . \
@@ -108,6 +109,15 @@ OPTIONAL {?document_uri crm:P25i_moved_by ?event . \
 rdf:type crm:EL2_Send_Letter ; \
 crm:P4_has_time-span ?uri_ts . \
 ?uri_ts rdfs:label ?time_span . } \
+} UNION { \
+?uri owl:sameAs ?place . \
+?event_gt crm:P7_took_place_at ?place . \
+?document_inf crm:P70_documents ?event_gt . \
+?document_uri crm:P128_carries ?document_inf ; \
+crm:P1_is_identified_by ?uriSegnatura ; \
+rdfs:label ?document_name . \
+?uriSegnatura rdfs:label ?segnatura . \
+} \
 } "
 
 queryPersone = prefixes + " SELECT DISTINCT ?role ?range SAMPLE(?name) AS ?label COUNT(?range) AS ?count \
@@ -131,6 +141,14 @@ crm:P14.1_in_the_role_of ?uri_role . \
 ?uri_role rdfs:label ?role . \
 ?range rdfs:label ?lb ; \
 foaf:name ?name . \
+} UNION { \
+<" + thisUrlParams.link + "> owl:sameAs ?place . \
+?event_gt crm:P7_took_place_at ?place ; \
+crm:P01_has_domain ?domain . \
+?domain crm:P02_has_range ?range ; \
+crm:P14.1_in_the_role_of ?uri_role . \
+?uri_role rdfs:label ?role . \
+?range rdfs:label ?name . \
 } \
 } GROUP BY ?role ?range \
 ORDER BY ?label"
@@ -419,13 +437,13 @@ function handle_receive(json) {
           letter = '<div class="col-8"><p><span id="' + received[i][0] + '" class="title_doc lettera">'+ received[i][1] + '</span>';
           object_type = "lettera";
           infObject_button  += '<button type="button" id="' + received[i][4] + 
-          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
+          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Lettera</p></button>';
     } else {
           letter = '<div class="col-8"><p><span id="' + received[i][0] + '" class="title_doc object">'+ received[i][1] + '</span>';
           object_type = "object";
           infObject_button  += '<button type="button" id="' + received[i][0] + 
           '" class="object btn btn-default" alt="oggetto" title="' + received[i][1] + 
-          '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
+          '"><i class="fa fa-book"></i><p class="btn-text">Bene Culturale</p></button>';
     }
 
     if (received[i][2] != "") {
@@ -492,13 +510,13 @@ function handle_send(json) {
           letter = '<div class="col-8"><p><span id="' + sent[i][0] + '" class="title_doc lettera">'+ sent[i][1] + '</span>';
           object_type = "lettera";
           infObject_button  += '<button type="button" id="' + sent[i][4] + 
-          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
+          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Lettera</p></button>';
     } else {
           letter = '<div class="col-8"><p><span id="' + sent[i][0] + '" class="title_doc object">'+ sent[i][1] + '</span>';
           object_type = "object";
           infObject_button  += '<button type="button" id="' + sent[i][0] + 
           '" class="object btn btn-default" alt="oggetto" title="' + sent[i][1] + 
-          '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
+          '"><i class="fa fa-book"></i><p class="btn-text">Bene Culturale</p></button>';
     }
 
     if (sent[i][2] != "") {
@@ -564,13 +582,13 @@ function handle_cit(json) {
           letter = '<div class="col-8"><p><span id="' + citations[i][0] + '" class="title_doc lettera">'+ citations[i][1] + '</span>';
           object_type = "lettera";
           infObject_button  += '<button type="button" id="' + citations[i][4] + 
-          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
+          '" class="lettera btn btn-default" alt="lettera" ><i class="fa fa-envelope"></i><p class="btn-text">Lettera</p></button>';
     } else {
           letter = '<div class="col-8"><p><span id="' + citations[i][0] + '" class="title_doc object">'+ citations[i][1] + '</span>';
           object_type = "object";
           infObject_button  += '<button type="button" id="' + citations[i][0] + 
           '" class="object btn btn-default" alt="oggetto" title="' + citations[i][1] + 
-          '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
+          '"><i class="fa fa-book"></i><p class="btn-text">Bene Culturale</p></button>';
     }
 
     if (citations[i][2] != "") {
@@ -650,7 +668,7 @@ function handle_persons(json) {
       Person += '<div class="row res"><div class="col-8">' +
       '<p><span id="' + people[i][0] + '" class="title_doc persona">'+ people[i][1] + '</span><br />' + info + '</p></div>' +
       '<div class="col d-flex align-items-start justify-content-end"><button type="button" id="' + people[i][0] + '" class="persona btn btn-default" alt="persona" title="' +
-      people[i][1] + '"><i class="fa fa-user"></i><p class="btn-text">Scheda Persona</p></button>' +
+      people[i][1] + '"><i class="fa fa-user"></i><p class="btn-text">Persona</p></button>' +
       '<button type="button" value="Persona" id="' + people[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>' +
       /*DA QUI HYPERLINK ->*/'<button type="button" value="Persona" id="' + people[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
       /*DA QUI LOD ->*/'<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + people[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>';

+ 57 - 34
js/object.js

@@ -106,17 +106,10 @@ OPTIONAL { ?uri crm:P128_carries ?InfObj . \
 GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> {?InfObj rdf:type crm:E73_Information_Object } } \
 } "
 
-queryPersone = prefixes + " SELECT DISTINCT ?uri_person ?name ?p_type ?note \
+queryPersone = prefixes + " SELECT DISTINCT ?uri_person ?name (group_concat(distinct ?p_type ; separator=', ') as ?types) ?note \
 WHERE { \
 VALUES ?uri {<" + thisUrlParams.link + ">} \
-{?uri crm:P46_is_composed_of ?card . \
-?card crm:P2_has_type 'Scheda anagrafica' . \
-?document crm:P141_assigned ?card ; \
-crm:P67_refers_to ?uri_person . \
-?uri_person foaf:name ?name ; \
-crm:P2_has_type ?person_type . \
-?person_type rdfs:label ?p_type . \
-} UNION { \
+{ \
 ?document crm:P141_assigned ?uri ; \
 crm:P67_refers_to ?uri_person . \
 ?uri_person foaf:name ?name ; \
@@ -129,6 +122,20 @@ crm:P2_has_type ?person_type . \
 crm:P67.1_type ?person_type . \
 OPTIONAL {?uri_person crm:P3_has_note ?note } \
 ?person_type rdfs:label ?p_type . \
+} UNION { \
+OPTIONAL {?uri crm:P46_is_composed_of ?uri_paper . } \
+{?uri_paper crm:P128_carries ?uri_doc } \
+UNION \
+{?uri crm:P128_carries ?uri_doc } \
+?uri_doc crm:P70_documents ?event ; \
+rdfs:label ?document . \
+?uri_obj crm:P128_carries ?uri_doc . \
+?uri_doc rdfs:label ?object . \
+?event crm:P01_has_domain ?domain . \
+?domain crm:P02_has_range ?uri_person ; \
+crm:P14.1_in_the_role_of ?uri_role . \
+?uri_role rdfs:label ?p_type . \
+?uri_person rdfs:label ?name . \
 } \
 }"
 
@@ -180,6 +187,19 @@ crm:P168_place_is_defined_by ?coords; \
 rdfs:label ?place . } \
 }"
 
+queryLuoghiGT = prefixes + " SELECT DISTINCT ?uri_place ?place \
+WHERE {VALUES ?uri {<" + thisUrlParams.link + ">} \
+OPTIONAL {?uri crm:P46_is_composed_of ?uri_paper . } \
+{?uri_paper crm:P128_carries ?uri_doc } \
+UNION \
+{?uri crm:P128_carries ?uri_doc } \
+?uri_doc crm:P70_documents ?event . \
+?event crm:P7_took_place_at ?uri_location . \
+?uri_place owl:sameAs ?uri_location ; \
+crm:P168_place_is_defined_by ?coords; \
+rdfs:label ?place .  \
+}"
+
 queryURL = prepareQueryURL(queryInfo);
 
 queryINF = prepareQueryURL(queryContent);
@@ -192,6 +212,7 @@ queryDOC = prepareQueryURL(queryAssocDocs);
 
 queryCON = prepareQueryURL(queryContrassegni);
 
+queryLG = prepareQueryURL(queryLuoghiGT);
 
 
 response = $.ajax({
@@ -234,12 +255,12 @@ response_people = $.ajax({
   error: function (e) {}
 });
 
-response_contrassegni = $.ajax({
+response_luoghi = $.ajax({
 
-  url: queryCON,
+  url: queryLG,
   dataType: "json",
   success: function (data){
-    handle_contrassegni(data);
+    handle_luoghiDocumento(data);
   },
   error: function (e) {}
 });
@@ -652,8 +673,10 @@ function handle_citedPeople(json) {
         var tipo = "";
         var nota = "";
       
-        if (value.hasOwnProperty('p_type')) {
-          tipo = value['p_type']['value'];
+        if (value.hasOwnProperty('types')) {
+          if (value['types']['value'] != "") {
+            tipo = value['types']['value'];
+          }
         }
         if (value.hasOwnProperty('note')) {
           nota = value['note']['value'];
@@ -668,7 +691,7 @@ function handle_citedPeople(json) {
     for (var i=0; i<people.length; i++) {
       var object = '<div class="col-8"><p><span id="' + people[i][0] + '" class="title_doc persona">'+ people[i][1] + '</span>';
       if (people[i][2] != "") {
-        object = object + "<br />Ruolo: " + people[i][2];
+        object = object + "<br />Citazione nel ruolo di: " + people[i][2];
       }
       if (people[i][3] != "") {
         object = object + "<br />Nota: " + people[i][3];
@@ -696,44 +719,44 @@ function handle_citedPeople(json) {
 
 }
 
-function handle_contrassegni(json) {
+function handle_luoghiDocumento(json) {
 
   console.log(json);
 
-  const cons = [];
+  const places = [];
 
   $.each(
       json['results']['bindings'],
       function (index, value) {
-        var uri = value['uri_contrassegno']['value'];
-        var label = value['contrassegno']['value'];
+        var uri = value['uri_place']['value'];
+        var label = value['place']['value'];
         
-        cons.push([uri, label]);
+        places.push([uri, label]);
         
       });
 
-  var Marks = "";
+  var Luoghi = "";
 
-  for (var i=0; i<cons.length; i++) {
-    var object = '<div class="col-8"><p><span id="' + cons[i][0] + '" class="title_doc object">'+ cons[i][1] + '</span></p></div>';
+  for (var i=0; i<places.length; i++) {
+    var object = '<div class="col-8"><p><span id="' + places[i][0] + '" class="title_doc luogo">'+ places[i][1] + '</span></p></div>';
    
-    var object_button  = '<button type="button" id="' + cons[i][0] + 
-      '" class="object btn btn-default" alt="oggetto" title="' + cons[i][1] + 
-      '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
+    var object_button  = '<button type="button" id="' + places[i][0] + 
+      '" class="luogo btn btn-default" alt="oggetto" title="' + places[i][1] + 
+      '"><i class="fa fa-map"></i><p class="btn-text">luogo</p></button>';
 
-      Marks += '<div class="row res">'+ object + 
+      Luoghi += '<div class="row res">'+ object + 
     '<div class="col d-flex align-items-start justify-content-end">' + object_button +
-    '<button type="button" value="object" id="' + cons[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" id="' + cons[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/?' + cons[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>';
+    '<button type="button" value="luogo" id="' + places[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="luogo" id="' + places[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/?' + places[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_sec").innerHTML = cons.length;
-  document.getElementById("section_documents").innerHTML = Marks;
+  document.getElementById("n_pl").innerHTML = places.length;
+  document.getElementById("section_places").innerHTML = Luoghi;
 
-  if (cons.length==0) {
+  if (places.length==0) {
     var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
-    document.getElementById("section_documents").innerHTML = messaggio;
+    document.getElementById("section_places").innerHTML = messaggio;
   }
   
 }

+ 2 - 2
object.html

@@ -291,11 +291,11 @@
 													<b>Luoghi citati <span id="nome_au" class="PN"></span></b>
 												</div>
 												<div class="col num_res">
-													<span><span id="n_sec"></span> risultati</span>
+													<span><span id="n_pl"></span> risultati</span>
 												</div>
 											</div>
 											<div class="row res_list">
-												<div class="container-fluid" id="section_documents"></div>
+												<div class="container-fluid" id="section_places"></div>
 											</div>
 										</div>
 									</div>