Ver Fonte

Add mark image

Alessia há 1 ano atrás
pai
commit
03a1a68967
3 ficheiros alterados com 85 adições e 16 exclusões
  1. 12 3
      Persona.html
  2. 47 13
      js/people.js
  3. 26 0
      js/query/queryMMO.js

+ 12 - 3
Persona.html

@@ -303,9 +303,18 @@
 									</div>
 								</div>
 
-								<div class="col-3" style="display:none;">
-									<div class="row" id="contrassegno"></div>
-									<div class="row">Contrassegno</div>
+								<div class="col-3" id="mark_image" style="display:none;">
+									<div class="row">
+										<div class="col">
+											<div class="row">
+												<div id="contrassegno" class="col"></div>
+											</div>
+											<div class="row">
+												<div class="col" id="nome_contrassegno"></div>
+											</div>
+										</div>
+									</div>
+									
 								</div> 
 
 							</div>

+ 47 - 13
js/people.js

@@ -323,6 +323,18 @@ OPTIONAL {?uri_sede owl:sameAs ?uri_place . \
 } \
 }"
 
+queryContrassegni = prefixes + " SELECT DISTINCT ?contrassegno ?image \
+WHERE { \
+VALUES ?uri {<" + thisUrlParams.link + ">} \
+?event crm:P141_assigned ?uri ; \
+crm:P140_assigned_attribute_to ?uri_contrassegno . \
+?uri_contrassegno crm:P2_has_type 'Contrassegno'; \
+rdfs:label ?contrassegno . \
+?uri_image crm:P138_represents ?uri_contrassegno ; \
+crm:P1_is_identified_by ?uri_id . \
+?uri_id rdfs:label ?image . \
+} "
+
 queryURL = prepareQueryURL(query);
 
 queryOt = prepareQueryURL(queryOtherDoc);
@@ -345,6 +357,8 @@ queryCom = prepareQueryURL(queryCompagnia);
 
 queryEv = prepareQueryURL(queryEventi);
 
+queryCon = prepareQueryURL(queryContrassegni);
+
 response = $.ajax({
 
     url: query,
@@ -456,6 +470,16 @@ responseEv = $.ajax({
   error: function (e) {}
 });
 
+responseEv = $.ajax({
+
+  url: queryCon,
+  dataType: "json",
+  success: function (data){
+    handle_Contrassegni(data);
+  },
+  error: function (e) {}
+});
+
 
 var labelName = "";
 
@@ -1068,22 +1092,32 @@ function handle_Compagnia(json) {
       }
 
   });
-      
 
-  var workPlace_button = "";
+}
 
-  if (uri_place != "") {
-    workPlace_button = '<button type="button" id="' + uri_place + 
-    '" class="luogo btn btn-default" alt="luogo" ><i class="far fa-map"></i><p class="btn-text">Scheda Luogo</p></button>';
-  } else {
-    workPlace_button = '<button class="btn btn-default" type="button" onclick="schedaASPO(' + uri_sede 
-    + ')"><i class="fa fa-link" aria-hidden="true">	<p class="btn-text">Link</p></i></button>';
-  }
+function handle_Contrassegni(json) {
 
-  document.getElementById("society").innerHTML = denominazione;
-  document.getElementById("workPlace").innerHTML = sede;
-  document.getElementById("workPlace_btn").innerHTML = workPlace_button;
-      
+  var id_image = "";
+  var name_image = "";
+
+  $.each(
+    json['results']['bindings'],
+    function (index, value) {
+      if (value.hasOwnProperty('image')) {
+        $("#mark_image").css("display", "flex");
+        id_image = value['image']['value'];
+      }
+      if (value.hasOwnProperty('contrassegno')) {
+        name_image = value['contrassegno']['value'];
+      }
+
+  });
+  
+  var Image = '<img style="width:100%;" src="img/contrassegni/' + id_image + '" />'
+
+  document.getElementById("contrassegno").innerHTML = Image;
+  document.getElementById("nome_contrassegno").innerHTML = name_image;
+     
 }
 
 function handle_Letters(json) {

+ 26 - 0
js/query/queryMMO.js

@@ -0,0 +1,26 @@
+prefixes = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
+PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
+PREFIX owl: <http://www.w3.org/2002/07/owl#> \
+PREFIX schema: <http://schema.org/> \
+PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
+PREFIX person: <http://www.w3.org/ns/person#> \
+PREFIX time: <https://www.w3.org/TR/owl-time#> "
+
+SELECT ?subject ?property ?object ?label
+WHERE{
+?subject rdfs:label ?label .
+?label bif:contains "Fondo".
+FILTER (CONTAINS(?label, "6000256"))
+?subject ?property ?object .
+}
+LIMIT 10000
+
+queryIdentificatore = prefixes + " SELECT DISTINCT ?g ?subject ?label ?identifier \
+WHERE {GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
+?subject rdfs:label ?label . \
+?subject crm:P1_is_identified_by ?uri_identifier . \
+?uri_identifier rdfs:label ?identifier ; \
+crm:P2_has_type 'Segnatura' . \
+FILTER (CONTAINS(?identifier, " + word + ")) \
+}"