Explorar el Código

Simplify query

Alessia hace 2 años
padre
commit
1aa6a57629
Se han modificado 14 ficheros con 868 adiciones y 1839 borrados
  1. 2 1
      Luogo.html
  2. 2 0
      OA.html
  3. 1 0
      Persona.html
  4. 6 137
      js/OA.js
  5. 20 454
      js/map.js
  6. 12 633
      js/object.js
  7. 27 609
      js/people.js
  8. 635 0
      js/query/managerQuery.js
  9. 0 2
      js/results_query.js
  10. 1 1
      js/search.js
  11. 156 0
      js/utilities.js
  12. 2 0
      lettera.html
  13. 2 0
      object.html
  14. 2 2
      results.html

+ 2 - 1
Luogo.html

@@ -317,8 +317,9 @@
 		</div>
 	</footer>
 
+	<script src="js/query/managerQuery.js"></script>
+	<script src="js/utilities.js"></script>
 	<script src="js/map.js"></script>
-	<script src="js/association.js"></script>
 
 	<!-- Bootstrap core JavaScript -->
 	<script src="vendor/jquery/jquery.min.js"></script>

+ 2 - 0
OA.html

@@ -317,6 +317,8 @@
 		</div>
 	</footer>
 
+	<script src="js/query/managerQuery.js"></script>
+	<script src="js/utilities.js"></script>
 	<script src="js/OA.js"></script>
 
 	<!-- Bootstrap core JavaScript -->

+ 1 - 0
Persona.html

@@ -563,6 +563,7 @@
 	</footer>
 
 	<script src="js/query/managerQuery.js"></script>
+	<script src="js/utilities.js"></script>
 	<script src="js/people.js"></script>
 	<script src="js/rectangles.js"></script>
 	<script src="js/word_cloud.js"></script>

+ 6 - 137
js/OA.js

@@ -1,122 +1,12 @@
-// Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
-thisUrlParams = {};
-window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
-    thisUrlParams[key] = value;
-});
-console.log('URL get params: ', thisUrlParams);
+var link = thisUrlParams.link;
 
-// Funzioni per eseguire le queries
-function prepareQueryURL(query){
-    sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
-    sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
-    return sparqlEndpoint + sparqlUrlParams;
-}
-
-function doJsonQuery(query){
-
-    queryURL = prepareQueryURL(query);
-
-    response = $.ajax({//OGGETTO
-
-        url: queryURL,
-        dataType: "json",
-        success: function (data){},
-        error: function (e) {}
-    });
-
-    return response;
-
-}
-
-// Funzioni per raccattare + stringhificare l'output
-queryStringOutput = "";
-function stringifyResponse(val){
-    resultArray = val['results']['bindings'];
-    out = "";
-    for(i = 0; i < resultArray.length; i++){
-        out = out + JSON.stringify(resultArray[i])
-    }
-    queryStringOutput = (queryStringOutput + out).replace("}{",",");
-}
-
-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#>"
-
-queryInfo = prefixes + " SELECT DISTINCT ?graph ?identifier ?label ?title ?uriType ?type ?uriOwner ?current_owner ?current_location ?subject (group_concat(distinct ?value ; separator='x') as ?dimensions) SAMPLE(?unit) AS ?unit (GROUP_CONCAT(DISTINCT CONCAT(?uriMaterial, '; ', ?material) ; SEPARATOR = '<br />') AS ?Materials) ?condition ?note \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-GRAPH ?graph {?uri rdfs:label ?label} \
-OPTIONAL {?uri crm:P3_has_note ?note } \
-?uri crm:P128_carries ?Inf_Obj . \
-OPTIONAL {?Inf_Obj crm:P1_is_identified_by ?uriTitle . \
-?uriTitle rdf:type crm:E35_Title; \
-rdfs:label ?title } \
-OPTIONAL {?Inf_Obj crm:P2_has_type ?uriType . \
-?uriType rdfs:label ?type } \
-OPTIONAL {?uri crm:P43_has_dimension ?uriDimension . \
-?uriDimension crm:P90_has_value ?value; \
-crm:P91_has_unit ?uri_unit . \
-?uri_unit rdfs:label ?unit } \
-OPTIONAL {?uri crm:P1_is_identified_by ?uriIdentifier . \
-?uriIdentifier rdfs:label ?identifier } \
-OPTIONAL {?uri crm:P45_consists_of ?uriMaterial . \
-?uriMaterial rdfs:label ?material } \
-OPTIONAL {?uri crm:P44_has_condition ?uriCondition . \
-?uriCondition crm:P2_has_type ?condition} \
-OPTIONAL {?uri crm:P54_has_current_permanent_location ?current_location } \
-OPTIONAL {?uri crm:P62_depicts ?uriSubject . \
-?uriSubject rdfs:label ?subject; \
-crm:P2_has_type 'Identificazione Iconografica' .} \
-OPTIONAL {?uri crm:P52_has_current_owner ?uriOwner . \
-?uriOwner rdfs:label ?current_owner } \
-}"
-
-queryProduction = prefixes + " SELECT DISTINCT (GROUP_CONCAT(DISTINCT CONCAT(?uriPerson, '; ', ?person, '; ', ?role) ; SEPARATOR = '<br />') AS ?Partecipants) (group_concat(distinct ?time_span ;separator='-') as ?time) (GROUP_CONCAT(DISTINCT CONCAT(?uriTecne, '; ', ?technique) ; SEPARATOR = '<br />') AS ?techniques) \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri crm:P128_carries ?Information_Object . \
-?Information_Object crm:P108i_was_produced_by ?Production . \
-OPTIONAL {?Production crm:P4_has_time-span ?uriTS ; \
-crm:P32_used_general_technique ?uriTecne . \
-?uriTS rdfs:label ?time_span . \
-?uriTecne rdfs:label ?technique} \
-OPTIONAL {?pc crm:P01_has_domain ?Production ; \
-crm:P02_has_range ?uriPerson ; \
-crm:P14.1_in_the_role_of ?uriRole . \
-?uriPerson rdfs:label ?person . \
-?uriRole rdfs:label ?role} \
-}"
+prefixes = queryManager['prefixes']['all'];
 
+queryURL = prefixes + (queryManager['querySchedaOpera']['queryInfo']).replace('{URI}', link);
+doJsonQuery(queryURL).done(function(data) { handle_OAdata(data); });
 
-queryURL = prepareQueryURL(queryInfo);
-
-queryPro = prepareQueryURL(queryProduction);
-
-
-response = $.ajax({
-
-    url: queryURL,
-    dataType: "json",
-    success: function (data){
-      handle_OAdata(data);
-    },
-    error: function (e) {}
-});
-
-response_Pro = $.ajax({
-
-    url: queryPro,
-    dataType: "json",
-    success: function (data){
-    	handle_Production(data);
-    },
-    error: function (e) {}
-});
+queryPro = prefixes + (queryManager['querySchedaOpera']['queryProduction']).replace('{URI}', link);
+doJsonQuery(queryPro).done(function(data) { handle_Production(data); });
 
 
 function handle_OAdata(json) {
@@ -303,24 +193,3 @@ function handle_Production(json) {
       });
   
 }
-
-
-$(document).on("click", ".luogo", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("Luogo.html?link="+this.id);
-    
-
-  });
-
-$(document).on("click", ".persona", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("Persona.html?link="+this.id);
-    
-
-  });

+ 20 - 454
js/map.js

@@ -1,294 +1,33 @@
-// Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
-thisUrlParams = {};
-window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
-    thisUrlParams[key] = value;
-});
-console.log('URL get params: ', thisUrlParams);
-
-// Funzioni per eseguire le queries
-function prepareQueryURL(query){
-    sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
-    sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
-    return sparqlEndpoint + sparqlUrlParams;
-}
-
-function doJsonQuery(query){
-
-    queryURL = prepareQueryURL(query);
+var link = thisUrlParams.link;
 
-    response = $.ajax({//OGGETTO
+prefixes = queryManager['prefixes']['all'];
 
-        url: queryURL,
-        dataType: "json",
-        success: function (data){},
-        error: function (e) {}
-    });
-
-    return response;
-
-}
+queryURL = prefixes + (queryManager['querySchedaLuogo']['query']).replace('{URI}', link);
+doJsonQuery(queryURL).done(function(data) { handle_data(data); });
 
-// Funzioni per raccattare + stringhificare l'output
-queryStringOutput = "";
-function stringifyResponse(val){
-    resultArray = val['results']['bindings'];
-    out = "";
-    for(i = 0; i < resultArray.length; i++){
-        out = out + JSON.stringify(resultArray[i])
-    }
-    queryStringOutput = (queryStringOutput + out).replace("}{",",");
-}
+queryRef = prefixes + (queryManager['querySchedaLuogo']['queryRiferimenti']).replace('{URI}', link);
+doJsonQuery(queryRef).done(function(data) { handle_ref(data); });
 
-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#>"
-
-query = prefixes + " SELECT DISTINCT ?graph ?uri ?name_place ?coordinates {\
-GRAPH ?graph { VALUES ?uri { <" + thisUrlParams.link + "> } \
-?uri crm:P168_place_is_defined_by ?coordinates;\
-rdfs:label ?name_place .\
-}\
-}"
-
-queryRiferimenti = prefixes + " SELECT DISTINCT ?references {\
-<" + thisUrlParams.link + "> owl:sameAs ?references\
-}"
-
-queryToponimi = prefixes + " SELECT DISTINCT ?toponimi {\
-<" + thisUrlParams.link + "> crm:P1_is_identified_by ?uri_toponym .\
-?uri_toponym rdfs:label ?toponimi\
-}"
-
-queryRicezione = prefixes + " SELECT DISTINCT ?segnatura ?document_uri ?document_name ?time_span ?InfObj \
-WHERE { \
-<" + thisUrlParams.link + "> owl:sameAs ?place . \
-?event_to crm:P26_moved_to ?place ; \
-rdf:type crm:EL3_Receive_Letter ; \
-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 {?event_to crm:P4_has_time-span ?uri_ts . \
-?uri_ts rdfs:label ?time_span . } \
-} "
-
-queryInvio = prefixes + " SELECT DISTINCT ?segnatura ?document_uri ?document_name ?time_span ?InfObj \
-WHERE { \
-<" + thisUrlParams.link + "> owl:sameAs ?place . \
-?event_to crm:P27_moved_from ?place ; \
-rdf:type crm:EL2_Send_Letter ; \
-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 {?event_to crm:P4_has_time-span ?uri_ts . \
-?uri_ts rdfs:label ?time_span . } \
-}"
-
-queryCitazione = prefixes + " SELECT DISTINCT ?segnatura ?document_uri ?document_name SAMPLE(?time_span) AS ?time_span ?InfObj \
-WHERE { \
-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 . \
-OPTIONAL {?document_uri crm:P1_is_identified_by ?uriSegnatura . \
-?uriSegnatura crm:P2_has_type 'Segnatura' ; \
-rdfs:label ?segnatura . } \
-OPTIONAL {?document_uri crm:P25i_moved_by ?event . \
-?event_send rdfs:subClassOf ?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 \
-WHERE{ \
-{?place owl:sameAs <" + thisUrlParams.link + "> . \
-?event_to crm:P26_moved_to ?place ; \
-rdf:type crm:EL3_Receive_Letter ; \
-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 ?lb ; \
-foaf:name ?name . \
-} UNION { \
-?place owl:sameAs <" + thisUrlParams.link + "> . \
-?event_to crm:P27_moved_from ?place ; \
-rdf:type crm:EL2_Send_Letter ; \
-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 ?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"
-
-queryCount = prefixes + " SELECT ?place ?label COUNT(?label) AS ?Count \
-WHERE{ \
-?place_to owl:sameAs <" + thisUrlParams.link + "> . \
-?event_to crm:P26_moved_to ?place_to ; \
-rdf:type crm:EL3_Receive_Letter ; \
-rdfs:subClassOf ?event . \
-?event_from rdfs:subClassOf ?event ; \
-rdf:type crm:EL2_Send_Letter ; \
-crm:P27_moved_from ?place . \
-?place rdfs:label ?label \
-} \
-ORDER BY DESC (?Count)"
-
-queryCount2 = prefixes + " SELECT ?place ?label COUNT(?label) AS ?Count \
-WHERE{ \
-?place_from owl:sameAs <" + thisUrlParams.link + "> . \
-?event_from crm:P27_moved_from ?place_from ; \
-rdf:type crm:EL2_Send_Letter ; \
-rdfs:subClassOf ?event . \
-?event_to rdfs:subClassOf ?event ; \
-rdf:type crm:EL2_Send_Letter ; \
-crm:P27_moved_from ?place . \
-?place rdfs:label ?label . \
-} \
-ORDER BY DESC (?Count) "
-
-
-queryURL = prepareQueryURL(query);
-
-queryRef = prepareQueryURL(queryRiferimenti);
-
-queryTopo = prepareQueryURL(queryToponimi);
-
-queryRec = prepareQueryURL(queryRicezione);
-
-querySend = prepareQueryURL(queryInvio);
-
-queryCit = prepareQueryURL(queryCitazione);
-
-queryPer = prepareQueryURL(queryPersone);
-
-queryCon1 = prepareQueryURL(queryCount);
-
-queryCon2 = prepareQueryURL(queryCount2);
-
-
-response = $.ajax({//OGGETTO
-
-    url: queryURL,
-    dataType: "json",
-    success: function (data){
-    	handle_data(data);
-    },
-    error: function (e) {}
-});
-
-
-response_ref = $.ajax({//OGGETTO
-
-    url: queryRef,
-    dataType: "json",
-    success: function (data){
-      handle_ref(data);
-    },
-    error: function (e) {}
-});
-
-response_top = $.ajax({//OGGETTO
-
-    url: queryTopo,
-    dataType: "json",
-    success: function (data){
-      handle_toponym(data);
-    },
-    error: function (e) {}
-});
-
-response_receive = $.ajax({//OGGETTO
-
-    url: queryRec,
-    dataType: "json",
-    success: function (data){
-      handle_receive(data);
-    },
-    error: function (e) {}
-});
-
-response_send = $.ajax({//OGGETTO
-
-    url: querySend,
-    dataType: "json",
-    success: function (data){
-      handle_send(data);
-    },
-    error: function (e) {}
-});
-
-response_cit = $.ajax({//OGGETTO
-
-    url: queryCit,
-    dataType: "json",
-    success: function (data){
-      handle_cit(data);
-    },
-    error: function (e) {}
-});
+queryTopo = prefixes + (queryManager['querySchedaLuogo']['queryToponimi']).replace('{URI}', link);
+doJsonQuery(queryTopo).done(function(data) { handle_toponym(data); });
 
-response_per = $.ajax({//OGGETTO
+queryRec = prefixes + (queryManager['querySchedaLuogo']['queryRicezione']).replace('{URI}', link);
+doJsonQuery(queryRec).done(function(data) { handle_receive(data); });
 
-    url: queryPer,
-    dataType: "json",
-    success: function (data){
-      handle_persons(data);
-    },
-    error: function (e) {}
-});
+querySend = prefixes + (queryManager['querySchedaLuogo']['queryInvio']).replace('{URI}', link);
+doJsonQuery(querySend).done(function(data) { handle_send(data); });
 
-responseCountA = $.ajax({//OGGETTO
+queryCit = prefixes + (queryManager['querySchedaLuogo']['queryCitazione']).replace('{URI}', link);
+doJsonQuery(queryCit).done(function(data) { handle_cit(data); });
 
-    url: queryCon1,
-    dataType: "json",
-    success: function (data){
-      handle_count(data);
-    },
-    error: function (e) {}
-});
+queryPer = prefixes + (queryManager['querySchedaLuogo']['queryPersone']).replaceAll('{URI}', link);
+doJsonQuery(queryPer).done(function(data) { handle_persons(data); });
 
-responseCountP = $.ajax({//OGGETTO
+queryCon1 = prefixes + (queryManager['querySchedaLuogo']['queryCount']).replace('{URI}', link);
+doJsonQuery(queryCon1).done(function(data) { handle_count(data); });
 
-    url: queryCon2,
-    dataType: "json",
-    success: function (data){
-      handle_count2(data);
-    },
-    error: function (e) {}
-});
+queryCon2 = prefixes + (queryManager['querySchedaLuogo']['queryCount2']).replace('{URI}', link);
+doJsonQuery(queryCon2).done(function(data) { handle_count2(data); });
 
 
 function handle_data(json) {
@@ -876,176 +615,3 @@ function open_riferimenti() {
     document.getElementById("topo").style.display = "none";
     document.getElementById("rif").style.display = "block";
 }
-
-function open_collegamenti() {
-
-    document.getElementById("references").style.display = "flex";
-    document.getElementById("statistiche").style.display = "none";
-    document.getElementById("regole_associazione").style.display = "none";
-}
-
-function open_statistiche() {
-
-    document.getElementById("references").style.display = "none";
-    document.getElementById("statistiche").style.display = "flex";
-    document.getElementById("regole_associazione").style.display = "none";
-}
-
-function open_correlazioni() {
-
-    document.getElementById("references").style.display = "none";
-    document.getElementById("statistiche").style.display = "none";
-    document.getElementById("regole_associazione").style.display = "flex";
-}
-
-/*
-var header = document.getElementById("ref_buttons");
-var btns = header.getElementsByClassName("btn");
-for (var i = 0; i < btns.length; i++) {
-  btns[i].addEventListener("click", function() {
-  var current = document.getElementsByClassName("active");
-  current[0].className = current[0].className.replace(" active", "");
-  this.className += " active";
-  });
-}
-*/
-
-//out = "";
-//for(i = 0; i < resultArray.length; i++){
- //   out = out + JSON.stringify(resultArray[i])
-//}
-//queryStringOutput = (queryStringOutput + out).replace("}{",",");
-
-
-/*
-
-var locations = [
-  ["LOCATION_1", 11.8166, 122.0942],
-  ["LOCATION_2", 11.9804, 121.9189],
-  ["LOCATION_3", 10.7202, 122.5621],
-  ["LOCATION_4", 11.3889, 122.6277],
-  ["LOCATION_5", 10.5929, 122.6325]
-];
-
-var map = L.map('map').setView([11.206051, 122.447886], 8);
-mapLink =
-  '<a href="http://openstreetmap.org">OpenStreetMap</a>';
-L.tileLayer(
-  'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
-    attribution: '&copy; ' + mapLink + ' Contributors',
-    maxZoom: 18,
-  }).addTo(map);
-
-for (var i = 0; i < locations.length; i++) {
-  marker = new L.marker([locations[i][1], locations[i][2]])
-    .bindPopup(locations[i][0])
-    .addTo(map);
-}
-*/
-
-$(document).on("click", ".persona", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("Persona.html?link="+this.id);
-    
-
-  });
-
-$(document).on("click", ".lettera", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  window.open("lettera.html?link="+this.id);
-  
-
-});
-
-$(document).on("click", ".object", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  window.open("object.html?link="+this.id);
-  
-
-});
-
-$(document).on("click", ".hyp", function (ev) {
-
-  var baseurl = window.location.origin+window.location.pathname;
-  let slash = baseurl.lastIndexOf("/");
-  var type = $(this).val() + '.html';
-  var link = this.id;
-  var url = baseurl.substr(0, slash+1) + type + "?link="+link;
-  var link = this.id;
-  $("#myModal").empty();
-  $("#myModal").css("display", "block");
-  $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" +
-    url + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-
-});
-
-$(document).on("click", ".close", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  $("#myModal").css("display", "none");
-
-});
-
-
-$(document).on("click", ".back", function (ev) {
-
-  $("#myTab").css("display", "none");
-
-});
-
-
-$(document).on("click", ".cit", function (ev) {
-  
-  var author ="RESTORE. smart access to digital heritage and memory"
-
-  var year = new Date().getFullYear()
-
-  var today = new Date();
-  var dd = String(today.getDate()).padStart(2, '0');
-  var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
-  var yyyy = today.getFullYear();
-
-  today = dd + '/' + mm + '/' + yyyy;
-
-  var baseurl = window.location.origin+window.location.pathname;
-  let slash = baseurl.lastIndexOf("/");
-  var type = $(this).val() + '.html';
-  var link = this.id;
-  var url = baseurl.substr(0, slash+1) + type + "?link="+link;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  $("#myModal").empty();
-  $("#myModal").css("display", "block");
-  $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" + 
-    author + " " + year + ", accesso effettuato: " + today + ", &lt;" + url + "&gt;</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-
-});
-
-
-function copyToClipboard(text) {
-    var sampleTextarea = document.createElement("textarea");
-    document.body.appendChild(sampleTextarea);
-    sampleTextarea.value = text; //save main text in it
-    sampleTextarea.select(); //select textarea contenrs
-    document.execCommand("copy");
-    document.body.removeChild(sampleTextarea);
-}
-
-function myFunction(){
-    var copy = document.getElementById("myInput");
-    copyText = copy.textContent;
-    copyToClipboard(copyText);
-
-    //copyToClipboard(copyText.value);
-}

+ 12 - 633
js/object.js

@@ -1,270 +1,21 @@
-// Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
-thisUrlParams = {};
-window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
-    thisUrlParams[key] = value;
-});
-console.log('URL get params: ', thisUrlParams);
-
-// Funzioni per eseguire le queries
-function prepareQueryURL(query){
-    sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
-    sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
-    return sparqlEndpoint + sparqlUrlParams;
-}
-
-function doJsonQuery(query){
-
-    queryURL = prepareQueryURL(query);
+var link = thisUrlParams.link;
 
-    response = $.ajax({//OGGETTO
-
-        url: queryURL,
-        dataType: "json",
-        success: function (data){},
-        error: function (e) {}
-    });
+prefixes = queryManager['prefixes']['all'];
 
-    return response;
+queryURL = prefixes + (queryManager['querySchedaOggetto']['queryInfo']).replace('{URI}', link);
+doJsonQuery(queryURL).done(function(data) { handle_objectData(data); });
 
-}
+queryINF = prefixes + (queryManager['querySchedaOggetto']['queryContent']).replace('{URI}', link);
+doJsonQuery(queryINF).done(function(data) { handle_objectInfo(data); });
 
-// Funzioni per raccattare + stringhificare l'output
-queryStringOutput = "";
-function stringifyResponse(val){
-    resultArray = val['results']['bindings'];
-    out = "";
-    for(i = 0; i < resultArray.length; i++){
-        out = out + JSON.stringify(resultArray[i])
-    }
-    queryStringOutput = (queryStringOutput + out).replace("}{",",");
-}
+queryOVI = prefixes + (queryManager['querySchedaOggetto']['queryOviLetter']).replace('{URI}', link);
+doJsonQuery(queryOVI).done(function(data) { handle_oviLetter(data); });
 
-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#>"
-
-queryInfo = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?label ?dimension ?consistency ?id ?sigla_registro (group_concat(distinct ?dimension ; separator='<br />') as ?dimensions) ?material (group_concat(distinct ?time_span ;separator='-') as ?time_span) ?location ?uri_owner ?owner ?uri_document ?document ?note \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-GRAPH ?g { ?uri rdfs:label ?label } \
-OPTIONAL {?uri crm:P1_is_identified_by ?uri_id . \
-?uri_id rdfs:label ?id ; \
-crm:P2_has_type 'Segnatura' .} \
-OPTIONAL { ?uri crm:P43_has_dimension ?uri_consistency . \
-?uri_consistency crm:P2_has_type 'Consistenza carte' ; \
-rdfs:label ?consistency } \
-OPTIONAL { ?uri crm:P43_has_dimension ?uri_dimension . \
-?uri_dimension crm:P2_has_type 'Dimensioni' ; \
-rdfs:label ?dimension } \
-OPTIONAL { ?uri crm:P139_has_alternative_form ?uri_registro . \
-?uri_registro rdfs:label ?sigla_registro; \
-crm:P2_has_type 'Sigla registro' . } \
-OPTIONAL { ?uri crm:P45_consist_of ?uri_material . \
-?uri_material rdfs:label ?material } \
-OPTIONAL { ?uri crm:P52_has_current_owner ?uri_owner . \
-?uri_owner rdfs:label ?owner . } \
-OPTIONAL { ?uri crm:P54_has_current_permanent_location ?location } \
-OPTIONAL { ?uri crm:P3_has_note ?uri_note . \
-?uri_note rdfs:label ?note } \
-OPTIONAL { ?uri crm:P92i_was_brought_into_existence_by ?creation . \
-?creation crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span . } \
-OPTIONAL {?uri_document crm:P46_is_composed_of ?uri ; \
-rdfs:label ?document .} \
-} "
-
-queryContent = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?titolo ?tipo (group_concat(distinct ?ref ; separator='<br />') as ?ref) \
-WHERE { \
-VALUES ?object {<" + thisUrlParams.link + ">} \
-?object crm:P128_carries ?uri . \
-?uri rdf:type crm:E73_Information_Object . \
-GRAPH ?g { ?uri rdfs:label ?label } \
-OPTIONAL {?uri crm:P1_is_identified_by ?uri_titolo . \
-?uri_titolo rdfs:label ?titolo ; \
-rdf:type crm:E35_Title . } \
-OPTIONAL { ?uri crm:P2_has_type ?uri_tipo . \
-?uri_tipo rdfs:label ?tipo . } \
-OPTIONAL { ?uri crm:P67_refers_to ?uri_ref . \
-?uri_ref rdfs:label ?ref . } \
-FILTER NOT EXISTS {GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> { ?uri rdfs:label ?label }}. \
-}"
-
-queryOviLetter = prefixes + " SELECT DISTINCT ?otherId ?InfObj \
-WHERE {  \
-VALUES ?uri {<" + thisUrlParams.link + ">}   \
-?uri crm:P1_is_identified_by ?uri_id .  \
-?uri_id crm:P2_has_type 'Segnatura' ; \
-crm:P139_has_alternative_form ?other_id . \
-?other_id crm:P2_has_type ?uri_type ; \
-rdfs:label ?otherId . \
-?uri_type rdfs:label 'Segnatura OVI' . \
-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 (group_concat(distinct ?p_type ; separator=', ') as ?types) ?note \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-{ \
-?document crm:P141_assigned ?uri ; \
-crm:P67_refers_to ?uri_person . \
-?uri_person foaf:name ?name ; \
-crm:P2_has_type ?person_type . \
-?person_type rdfs:label ?p_type . \
-} UNION { \
-?uri crm:P92i_was_brought_into_existence_by ?creation . \
-?creation crm:P67_refers_to ?uri_person . \
-?uri_person foaf:name ?name ; \
-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 . \
-} \
-}"
-
-queryAssocDocs = prefixes + " SELECT DISTINCT ?card ?doc_type ?name_card \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri crm:P46_is_composed_of ?card . \
-?card rdfs:label ?name_card . \
-OPTIONAL {?card crm:P2_has_type ?doc_type } \
-OPTIONAL {?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 ?type . \
-} \
-}"
-
-queryContrassegni = prefixes + " SELECT DISTINCT ?uri_contrassegno ?contrassegno \
-WHERE {VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri crm:P46_is_composed_of ?uri_paper . \
-?uri_documentation crm:P141_assigned ?uri_paper ; \
-crm:P140_assigned_attribute_to ?uri_contrassegno . \
-?uri_contrassegno rdfs:label ?contrassegno . \
-}"
-
-queryEventiGettatelli = prefixes + " SELECT DISTINCT ?uri_obj ?object ?name_event ?event_type ?uri_person ?label ?role ?time_span ?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 ; \
-rdfs:label ?document . \
-?uri_obj crm:P128_carries ?uri_doc . \
-?uri_doc rdfs:label ?object . \
-?event rdfs:label ?name_event . \
-?event crm:P2_has_type ?uri_event_type . \
-?uri_event_type rdfs:label ?event_type . \
-?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 ?role . \
-?uri_person rdfs:label ?label . \
-OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span . } \
-OPTIONAL {?event crm:P7_took_place_at ?uri_location . \
-?uri_place owl:sameAs ?uri_location ; \
-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);
-
-queryOVI = prepareQueryURL(queryOviLetter);
-
-queryPERS = prepareQueryURL(queryPersone);
-
-queryDOC = prepareQueryURL(queryAssocDocs);
-
-queryCON = prepareQueryURL(queryContrassegni);
-
-queryLG = prepareQueryURL(queryLuoghiGT);
-
-
-response = $.ajax({
-
-    url: queryURL,
-    dataType: "json",
-    success: function (data){
-      handle_objectData(data);
-    },
-    error: function (e) {}
-});
-
-response_info = $.ajax({
-
-    url: queryINF,
-    dataType: "json",
-    success: function (data){
-    	handle_objectInfo(data);
-    },
-    error: function (e) {}
-});
-
-response_info = $.ajax({
-
-    url: queryOVI,
-    dataType: "json",
-    success: function (data){
-      handle_oviLetter(data);
-    },
-    error: function (e) {}
-});
-
-response_people = $.ajax({
-
-  url: queryPERS,
-  dataType: "json",
-  success: function (data){
-    handle_citedPeople(data);
-  },
-  error: function (e) {}
-});
-
-response_luoghi = $.ajax({
-
-  url: queryLG,
-  dataType: "json",
-  success: function (data){
-    handle_luoghiDocumento(data);
-  },
-  error: function (e) {}
-});
+queryPERS = prefixes + (queryManager['querySchedaOggetto']['queryPersone']).replace('{URI}', link);
+doJsonQuery(queryPERS).done(function(data) { handle_citedPeople(data); });
 
+queryLG = prefixes + (queryManager['querySchedaOggetto']['queryLuoghiGT']).replace('{URI}', link);
+doJsonQuery(queryLG).done(function(data) { handle_luoghiDocumento(data); });
 
 
 function handle_objectData(json) {
@@ -467,198 +218,6 @@ function handle_oviLetter(json) {
 
 }
 
-/*
-function handle_citedPeople(json) {
-  
-  console.log(json);
-
-  var Relazioni = "";
-  const myArray = []
-
-  $.each(
-    json['results']['bindings'],
-    function (index, value) {
-        var uri_person = value['uri_person']['value'];
-        var name = value['name']['value'];
-        var tipo = "";
-        var nota = "";
-      
-        if (value.hasOwnProperty('p_type')) {
-          tipo = value['p_type']['value'];
-        }
-        if (value.hasOwnProperty('note')) {
-          nota = "<br /><span class='nota_menzione'><i>" + value['note']['value'] + "</i></span>";
-        }
-      
-      var string = name + nota; 
-
-      myArray.push([tipo, string, uri_person, nota]);
-   
-    });
-
-  if (myArray.length == 0) {
-    $("#placeholder_people").css("display", "none");
-  }
-
-  const checkRel = [];
-
-  for (var i=0; i<myArray.length; i++) {
-      var key = myArray[i][0];
-      checkRel.push(key);
-  }
-
-  var params = [];
-  $.each(checkRel, function(i, el){
-    if($.inArray(el, params) === -1) params.push(el);
-  });
-
-  for (var i=0; i<params.length; i++) {
-    var par = params[i];
-    var par_id = par.replaceAll(" ", "_");
-    var rel = createDivRelazione(par, par_id);
-    Relazioni = Relazioni + rel;
-  }
-
-  $(Relazioni).insertAfter( "#placeholder_people" );
-
-  for (var j=0; j<params.length; j++) {
-      var el = params[j];
-      var par = el.replaceAll(" ", "_");
-      var Colums = ""; 
-      for (var i=0; i<myArray.length; i++) {
-          var text = myArray[i][1];
-          var link = myArray[i][2];
-          var declaration = "" 
-          if (myArray[i][3] != "") {
-            declaration = "myMargin";
-          }
-          var rel = myArray[i][0].replaceAll(" ", "_");
-          if (par == rel) {
-              var col = createColRelazione(text, link, "persona", "fa fa-user", "Scheda Persona", declaration);
-              Colums = Colums + col;
-          }
-      }
-      document.getElementById(par).innerHTML = Colums;
-  }
-
-}
-
-function handle_associatedDocuments(json) {
-  
-  console.log(json);
-
-  var Sezioni = "";
-  const myArray = []
-
-  $.each(
-    json['results']['bindings'],
-    function (index, value) {
-        var uri = value['card']['value'];
-        var name = value['name_card']['value'];
-        var tipo = "";
-      
-        if (value.hasOwnProperty('doc_type')) {
-          tipo = value['doc_type']['value'];
-        }
-        
-      myArray.push([tipo, name, uri]);
-   
-    });
-
-  if (myArray.length == 0) {
-    $("#placeholder_documents").css("display", "none");
-  }
-
-  const checkRel = [];
-
-  for (var i=0; i<myArray.length; i++) {
-      var key = myArray[i][0];
-      checkRel.push(key);
-  }
-
-  var params = [];
-  $.each(checkRel, function(i, el){
-    if($.inArray(el, params) === -1) params.push(el);
-  });
-
-  for (var i=0; i<params.length; i++) {
-    var par = params[i];
-    var par_id = par.replaceAll(" ", "_");
-    var rel = createDivRelazione(par, par_id);
-    Sezioni = Sezioni + rel;
-  }
-
-  $(Sezioni).insertAfter( "#placeholder_documents" );
-
-  for (var j=0; j<params.length; j++) {
-      var el = params[j];
-      var par = el.replaceAll(" ", "_");
-      var Colums = ""; 
-      for (var i=0; i<myArray.length; i++) {
-          var text = myArray[i][1];
-          var link = myArray[i][2];
-          var rel = myArray[i][0].replaceAll(" ", "_");
-          if (par == rel) {
-              var col = createColRelazione(text, link, "object", "fa fa-book", "Scheda Oggetto", "");
-              Colums = Colums + col;
-          }
-      }
-      document.getElementById(par).innerHTML = Colums;
-  }
-
-} 
-
-function handle_associatedDocuments(json) {
-
-  console.log(json);
-
-  const docs = [];
-
-  $.each(
-      json['results']['bindings'],
-      function (index, value) {
-        var uri = value['card']['value'];
-        var label = value['name_card']['value'];
-        var tipo = "";
-      
-        if (value.hasOwnProperty('doc_type')) {
-          tipo = value['doc_type']['value'];
-        }
-
-        docs.push([uri, label, tipo]);
-        
-      });
-
-  var Docs = "";
-
-  for (var i=0; i<docs.length; i++) {
-    var object = '<div class="col-8"><p><span id="' + docs[i][0] + '" class="title_doc object">'+ docs[i][1] + '</span>';
-    if (docs[i][2] != "") {
-      object = object + "<br />Documento: " + docs[i][2];
-    }
-    object = object + '</p></div>';
-
-    var object_button  = '<button type="button" id="' + docs[i][0] + 
-      '" class="object btn btn-default" alt="oggetto" title="' + docs[i][1] + 
-      '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
-
-      Docs += '<div class="row res">'+ object + 
-    '<div class="col d-flex align-items-start justify-content-end">' + object_button +
-    '<button type="button" value="object" id="' + docs[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="' + docs[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/?' + docs[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 = docs.length;
-  document.getElementById("section_documents").innerHTML = Docs;
-
-  if (docs.length==0) {
-    var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
-    document.getElementById("section_documents").innerHTML = messaggio;
-  }
-  
-}*/
-
 function handle_citedPeople(json) {
 
   console.log(json);
@@ -761,69 +320,6 @@ function handle_luoghiDocumento(json) {
   
 }
 
-/*function handle_eventiGettatelli(json) {
-
-  console.log(json);
-
-  const evGett = [];
-
-  $.each(
-      json['results']['bindings'],
-      function (index, value) {
-        var uri = value['uri_obj']['value'];
-        var label = value['object']['value'];
-        var name_event = value['name_event']['value'];
-        var event_type = value['event_type']['value'];
-        var uri_person = value['uri_person']['value'];
-        var person = value['label']['value'];
-        var role = value['role']['value'];
-        var time_span = "";
-        var uri_place = "";
-        var place = "";
-
-        if (value.hasOwnProperty('time_span')) {
-          time_span = value['time_span']['value'];
-        }
-        if (value.hasOwnProperty('uri_place')) {
-          uri_place = value['uri_place']['value'];
-        }
-        if (value.hasOwnProperty('place')) {
-          place = value['place']['value'];
-        } 
-        
-        evGett.push([name_event, uri_person, person, role, time_span, uri_place, place]);
-        
-      });
-
-      var thead = 
-      '<div class="col-4">Evento registrato</div>' +
-      '<div class="col-2">Persona</div>' +
-      '<div class="col-2">Ruolo</div>' +
-      '<div class="col-2">Data</div>' +
-      '<div class="col-2">Luogo</div>';
-    
-      var EventsTable = "";
-    
-      for (var i=0; i<evGett.length; i++) {
-        EventsTable += '<div class="row res">' +
-        '<div class="col-4">' + evGett[i][0] + '</div>' +
-        '<div id="' + evGett[i][1] + '" class="col-2 persona title_doc">' + evGett[i][2] + '</div>' +
-        '<div class="col-2">' + evGett[i][3] + '</div>' +
-        '<div class="col-2">' + evGett[i][4] + '</div>' +
-        '<div id="' + evGett[i][5] + '" class="col-2 luogo title_doc">' + evGett[i][6] + '</div>' +
-        '</div>';
-      }
-
-      document.getElementById("thead_ev").innerHTML = thead;
-    
-      if (evGett.length != 0) {
-        document.getElementById("section_events").innerHTML = EventsTable;
-      } else {
-        var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
-         document.getElementById("section_events").innerHTML = messaggio;
-      }
-  
-}*/
 
 function createDivRelazione(type, id){
 	htmlCode = '\
@@ -851,120 +347,3 @@ function createColRelazione(text, link, tipo, fa, tab, decl) {
 		'.replace("<NAME>", text).replace("<URI>", link).replace("<TIPO>", tipo).replace("<BUTTON>", fa).replace("<TAB>", tab).replace("<CLASS>", decl);
 	return htmlCode;
 }
-
-$(document).on("click", ".lettera", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("lettera.html?link="+this.id);
-    
-  });
-
-$(document).on("click", ".luogo", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("Luogo.html?link="+this.id);
-    
-
-  });
-
-$(document).on("click", ".persona", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("Persona.html?link="+this.id);
-    
-
-  });
-
-  $(document).on("click", ".object", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("object.html?link="+this.id);
-    
-  
-  });
-
-  $(document).on("click", ".hyp", function (ev) {
-
-    var baseurl = window.location.origin+window.location.pathname;
-    let slash = baseurl.lastIndexOf("/");
-    var type = $(this).val() + '.html';
-    var link = this.id;
-    var url = baseurl.substr(0, slash+1) + type + "?link="+link;
-    var link = this.id;
-    $("#myModal").empty();
-    $("#myModal").css("display", "block");
-    $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" +
-      url + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-  
-  });
-
-  $(document).on("click", ".cit", function (ev) {
-  
-    var author ="RESTORE. smart access to digital heritage and memory"
-  
-    var year = new Date().getFullYear()
-  
-    var today = new Date();
-    var dd = String(today.getDate()).padStart(2, '0');
-    var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
-    var yyyy = today.getFullYear();
-  
-    today = dd + '/' + mm + '/' + yyyy;
-  
-    var baseurl = window.location.origin+window.location.pathname;
-    let slash = baseurl.lastIndexOf("/");
-    var type = $(this).val() + '.html';
-    var link = this.id;
-    var url = baseurl.substr(0, slash+1) + type + "?link="+link;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    $("#myModal").empty();
-    $("#myModal").css("display", "block");
-    $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" + 
-      author + " " + year + ", accesso effettuato: " + today + ", &lt;" + url + "&gt;</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-  
-  });
-
-  function schedaASPO(info){
-    window.open(info);
-  }
-
-  $(document).on("click", ".close", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    $("#myModal").css("display", "none");
-  
-  });
-  
-  $(document).on("click", ".back", function (ev) {
-  
-    $("#myTab").css("display", "none");
-  
-  });
-
-function copyToClipboard(text) {
-    var sampleTextarea = document.createElement("textarea");
-    document.body.appendChild(sampleTextarea);
-    sampleTextarea.value = text; //save main text in it
-    sampleTextarea.select(); //select textarea contenrs
-    document.execCommand("copy");
-    document.body.removeChild(sampleTextarea);
-}
-
-function myFunction(){
-    var copy = document.getElementById("myInput");
-    copyText = copy.textContent;
-    copyToClipboard(copyText);
-
-    //copyToClipboard(copyText.value);
-}

+ 27 - 609
js/people.js

@@ -1,492 +1,49 @@
-// Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
-thisUrlParams = {};
-window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
-    thisUrlParams[key] = value;
-});
-//console.log('URL get params: ', thisUrlParams);
-
-// Funzioni per eseguire le queries
-function prepareQueryURL(query){
-    sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
-    sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
-    return sparqlEndpoint + sparqlUrlParams;
-}
-
-function doJsonQuery(query){
-
-    queryURL = prepareQueryURL(query);
-
-    response = $.ajax({//OGGETTO
-
-        url: queryURL,
-        dataType: "json",
-        success: function (data){},
-        error: function (e) {}
-    });
-
-    return response;
-
-}
-
-// Funzioni per raccattare + stringhificare l'output
-queryStringOutput = "";
-function stringifyResponse(val){
-    resultArray = val['results']['bindings'];
-    out = "";
-    for(i = 0; i < resultArray.length; i++){
-        out = out + JSON.stringify(resultArray[i])
-    }
-    queryStringOutput = (queryStringOutput + out).replace("}{",",");
-}
-
-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#>"
-
-query = prefixes + " SELECT DISTINCT ?place ?label ?tipo ?coordinates COUNT(?pc) AS ?count \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-{?pc crm:P02_has_range ?uri . \
-?event_from crm:P01_has_domain ?pc ; \
-rdf:type crm:EL3_Receive_Letter; \
-rdfs:label ?tipo ; \
-crm:P26_moved_to ?place_from . \
-?place_from rdf:type crm:E53_Place ; \
-owl:sameAs ?place . \
-?place rdfs:label ?label ; \
-crm:P168_place_is_defined_by ?coordinates . \
-} UNION { \
-?pc crm:P02_has_range ?uri . \
-?event_from crm:P01_has_domain ?pc ; \
-rdf:type crm:EL2_Send_Letter; \
-rdfs:label ?tipo ; \
-crm:P27_moved_from ?place_from . \
-?place_from rdf:type crm:E53_Place ; \
-owl:sameAs ?place . \
-?place rdfs:label ?label ; \
-crm:P168_place_is_defined_by ?coordinates . \
-} UNION { \
-  ?uri 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 { \
-    ?uri 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 . \
-  } \
-  UNION { \
-    ?pc crm:P02_has_range ?uri . \
-    ?uri_event crm:P01_has_domain ?pc; \
-    crm:P7_took_place_at ?uri_place ; \
-    crm:P2_has_type ?uri_type . \
-    ?uri_type rdfs:label ?tipo . \
-    ?uri_place rdf:type crm:E53_Place ; \
-    rdfs:label ?label . \
-    ?place owl:sameAs ?uri_place ; \
-    crm:P168_place_is_defined_by ?coordinates . \
-    } \
-}"
-
-queryInfo = prefixes + " SELECT DISTINCT ?uri ?graph ?label ?identifier ?id_type ?name ?givenName ?familyName ?relative2 ?relative3 ?provenienza (GROUP_CONCAT(DISTINCT CONCAT(?variant, '| ', ?otherName) ; SEPARATOR = ';') AS ?variants) ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation ?qualification ?group \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-GRAPH ?graph {?uri rdfs:label ?label} \
-?uri foaf:name ?name . \
-OPTIONAL {?uri crm:P1_is_identified_by ?id . \
-?id rdfs:label ?identifier ; \
-crm:P2_has_type ?id_type .} \
-OPTIONAL {?uri foaf:givenName ?givenName} \
-OPTIONAL {?uri foaf:familyName ?familyName} \
-OPTIONAL {?uri foaf:gender ?gender} \
-OPTIONAL {?uri person:patronymicName ?patronymic } \
-OPTIONAL {?uri crm:P74_has_current_or_former_residence ?uri_provenienza . \
-?uri_provenienza crm:P2_has_type 'Provenienza'; \
-rdfs:label ?provenienza . } \
-OPTIONAL {?uri crm:P2_has_type ?uri_person_type . \
-?uri_person_type rdfs:label ?person_type } \
-OPTIONAL {?uri schema:hasOccupation ?uriOccupation . \
-?uriOccupation rdf:type schema:Occupation; \
-rdfs:label ?occupation } \
-OPTIONAL {?uri schema:honorificPrefix ?qualification} \
-OPTIONAL {?uri crm:P100i_died_in ?Death . \
-OPTIONAL {?Death crm:P4_has_time-span ?Death_TS . \
-?Death_TS rdfs:label ?Death_Date . } \
-OPTIONAL {?Death crm:P7_took_place_at ?Place_D .  \
-?Place_D rdfs:label ?Death_Place } \
-} \
-OPTIONAL {?uri crm:P98i_was_born ?Birth . \
-OPTIONAL {?Birth crm:P4_has_time-span ?Birth_TS . \
-?Birth_TS rdfs:label ?Birth_Date . } \
-OPTIONAL {?Birth crm:P7_took_place_at ?Place_B . \
-?Place_B rdfs:label ?Birth_Place } \
-} \
-OPTIONAL {?uri crm:P107i_is_current_or_former_member_of ?uriGroup . \
-?uriGroup rdfs:label ?group } \
-OPTIONAL {?uri schema:alternateName ?alias . } \
-OPTIONAL {?uri owl:sameAs ?variant . \
-?variant foaf:name ?otherName . } \
-OPTIONAL {?relation2 crm:P141_assigned ?uri ; \
-crm:P42_assigned ?uri_rel_type2 . \
-?uri_rel_type2 rdfs:label 'Avo di secondo grado' . \
-?uri_relative2 crm:P141_assigned ?relation2; \
-rdfs:label ?relative2 .} \
-OPTIONAL {?relation3 crm:P141_assigned ?uri ; \
-crm:P42_assigned ?uri_rel_type3 . \
-?uri_rel_type3 rdfs:label 'Avo di terzo grado' . \
-?uri_relative3 crm:P141_assigned ?relation3; \
-rdfs:label ?relative3 .} \
-} \
-GROUP BY ?graph ?uri ?label ?identifier ?id_type ?name ?givenName ?familyName ?relative2 ?relative3 ?provenienza ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation ?qualification ?group \
-LIMIT 1  "
-
-queryInfoGettatelli = prefixes + " SELECT DISTINCT ?card ?uri_card \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?documentation crm:P67_refers_to ?uri ; \
-crm:P141_assigned ?uri_card . \
-?uri_card rdfs:label ?card . \
-} "
-
-queryRelazioni = prefixes + " SELECT DISTINCT ?relation_type ?note ?uri_person ?name ?givenName ?familyName ?patronymic ?provenienza \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri crm:P141_assigned ?relation . \
-?relation crm:P42_assigned ?uri_type ; \
-crm:P141_assigned ?uri_person . \
-?uri_type rdfs:label ?relation_type . \
-OPTIONAL {?uri_type crm:P3_has_note ?note } \
-?uri_person foaf:name ?name . \
-OPTIONAL {?uri_person foaf:givenName ?givenName} \
-OPTIONAL {?uri_person foaf:familyName ?familyName} \
-OPTIONAL {?uri_person person:patronymicName ?patronymic } \
-OPTIONAL {?uri_person crm:P74_has_current_or_former_residence ?uri_provenienza . \
-?uri_provenienza crm:P2_has_type 'Provenienza'; \
-rdfs:label ?provenienza . } \
-} "
-
-queryRelazioniInverse = prefixes + " SELECT DISTINCT ?relation_type ?note ?uri_person SAMPLE(?name) AS ?name ?givenName ?familyName ?patronymic ?provenienza \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?relation crm:P141_assigned ?uri; \
-crm:P42_assigned ?uri_type . \
-?uri_person crm:P141_assigned ?relation . \
-?uri_type rdfs:label ?relation_type . \
-OPTIONAL {?uri_type crm:P3_has_note ?note } \
-OPTIONAL {?uri_person foaf:name ?name } \
-OPTIONAL {?uri_person foaf:givenName ?givenName} \
-OPTIONAL {?uri_person foaf:familyName ?familyName}  \
-OPTIONAL {?uri_person person:patronymicName ?patronymic } \
-OPTIONAL {?uri_person crm:P74_has_current_or_former_residence ?uri_provenienza . \
-?uri_provenienza crm:P2_has_type '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 ; \
-crm:P1_is_identified_by ?uri_id ; \
-rdfs:label ?label . \
-?uri_id rdfs:label ?id ; \
-crm:P2_has_type 'Segnatura' . \
-OPTIONAL { \
-{?event crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span . \
-} UNION { \
-?sub_event rdfs:subClassOf ?event ; \
-crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span . } \
-} \
-?event crm:P01_has_domain ?domain . \
-?domain crm:P02_has_range <" + thisUrlParams.link + "> ; \
-crm:P14.1_in_the_role_of ?uri_role . \
-?uri_role rdfs:label ?role . \
-} \
-GROUP BY ?document ?label ?id ?role "
-
-queryOtherDoc = prefixes + " SELECT DISTINCT ?document ?label ?id (group_concat(distinct ?time_span ;separator='-') as ?time_span) \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + "> } \
-{?domain crm:P02_has_range ?uri . \
-?event crm:P01_has_domain ?domain . \
-?document crm:P92i_was_brought_into_existence_by ?event ; \
-crm:P1_is_identified_by ?uri_id ; \
-rdfs:label ?label . \
-?uri_id crm:P2_has_type 'Segnatura'; \
-rdfs:label ?id . \
-} UNION { \
-?event crm:P67_refers_to ?uri . \
-?document crm:P92i_was_brought_into_existence_by ?event ; \
-rdfs:label ?label ; \
-crm:P1_is_identified_by ?uri_id . \
-?uri_id rdfs:label ?id ; \
-crm:P2_has_type 'Segnatura' . \
-} UNION { \
-?event crm:P67_refers_to ?uri . \
-?documentation crm:P67_refers_to ?uri ; \
-crm:P141_assigned ?card . \
-?document crm:P46_is_composed_of ?card ; \
-rdfs:label ?label ; \
-crm:P1_is_identified_by ?uri_id . \
-?uri_id rdfs:label ?id ; \
-crm:P2_has_type 'Segnatura' . \
-} \
-OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span} \
-} "
-
-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 ; \
-crm:P1_is_identified_by ?uri_nct . \
-?uri_nct rdfs:label ?nct . \
-?production crm:P108_has_produced ?subject . \
-OPTIONAL {?production crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span } \
-?pc crm:P01_has_domain ?production ; \
-crm:P02_has_range <" + thisUrlParams.link + "> } \
-GROUP BY ?subject ?label ?nct "
-
-queryGettatelliEv = prefixes + " SELECT DISTINCT ?event_type ?time_span \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri crm:P12i_was_present_at ?event . \
-?event crm:P2_has_type ?uri_event_type ; \
-crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span . \
-?uri_event_type rdfs:label ?event_type . \
-} "
-
-queryEventi = prefixes + " SELECT DISTINCT ?event_type ?role ?time_span ?place ?uri_place ?document ?uri_document \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?domain crm:P02_has_range ?uri ; \
-crm:P14.1_in_the_role_of ?uri_role . \
-?uri_role rdfs:label ?role . \
-?event crm:P01_has_domain ?domain ; \
-crm:P2_has_type ?uri_event_type . \
-?uri_event_type rdfs:label ?event_type . \
-OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \
-?uri_time_span rdfs:label ?time_span .} \
-OPTIONAL {?event crm:P7_took_place_at ?uri_location . \
-?uri_location rdfs:label ?place . \
-OPTIONAL {?uri_place owl:sameAs ?uri_location . \
-?uri_place crm:P168_place_is_defined_by ?coords }} \
-?document_info crm:P70_documents ?event . \
-?uri_document crm:P128_carries ?document_info ; \
-rdfs:label ?document . \
-} "
-
-queryCompagnia = prefixes + " SELECT DISTINCT ?denomination ?occupation ?uri_sede ?uri_place ?sede \
-WHERE { \
-VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri rdf:type crm:E74_Group . \
-?uri crm:P2_has_type ?denomination . \
-OPTIONAL {?uri schema:hasOccupation ?uri_Occupation . \
-?uri_Occupation rdfs:label ?occupation .} \
-OPTIONAL {?uri crm:P74_has_current_or_former_residence ?uri_sede . \
-?uri_sede rdfs:label ?sede . \
-OPTIONAL {?uri_sede owl:sameAs ?uri_place . \
-?uri_place crm:P168_place_is_defined_by ?coords .} \
-} \
-}"
-
-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);
-
-queryOA = prepareQueryURL(queryOpere);
-
-query = prepareQueryURL(queryInfo);
-
-queryEx = prepareQueryURL(queryLetters);
-
-queryGt = prepareQueryURL(queryGettatelliEv);
-
-queryInfoGt = prepareQueryURL(queryInfoGettatelli);
-
-queryRel = prepareQueryURL(queryRelazioni);
-
-queryRelIn = prepareQueryURL(queryRelazioniInverse);
-
-queryCom = prepareQueryURL(queryCompagnia);
-
-queryEv = prepareQueryURL(queryEventi);
-
-queryCon = prepareQueryURL(queryContrassegni);
-
-response = $.ajax({
-
-    url: query,
-    dataType: "json",
-    success: function (data){
-      handle_data(data);
-    },
-    error: function (e) {}
-});
-
-response = $.ajax({
-
-    url: queryURL,
-    dataType: "json",
-    success: function (data){
-    	handle_map(data);
-    },
-    error: function (e) {}
-});
-
-responseLet = $.ajax({
-
-    url: queryEx,
-    dataType: "json",
-    success: function (data){
-      handle_Letters(data);
-    },
-    error: function (e) {}
-});
-
-responseOA = $.ajax({
-
-  url: queryOA,
-  dataType: "json",
-  success: function (data){
-    handle_Artwork(data);
-  },
-  error: function (e) {}
-});
-
-responseOt = $.ajax({
-
-  url: queryOt,
-  dataType: "json",
-  success: function (data){
-    handle_Other_Documents(data);
-  },
-  error: function (e) {}
-});
-
 
-responseGet = $.ajax({
+var link = thisUrlParams.link;
 
-  url: queryGt,
-  dataType: "json",
-  success: function (data){
-    handle_Gettatelli(data);
-  },
-  error: function (e) {}
-});
+prefixes = queryManager['prefixes']['all'];
 
-responseDoc = $.ajax({
+query = prefixes + (queryManager['querySchedaPersona']['queryInfo']).replace('{URI}', link);
+doJsonQuery(query).done(function(data) { handle_data(data); });
 
-  url: queryInfoGt,
-  dataType: "json",
-  success: function (data){
-    handle_InfoGettatelli(data);
-  },
-  error: function (e) {}
-});
+queryURL = prefixes + (queryManager['querySchedaPersona']['query']).replace('{URI}', link);
+doJsonQuery(queryURL).done(function(data) { handle_map(data); });
 
-responseRel = $.ajax({
+queryEx = prefixes + (queryManager['querySchedaPersona']['queryLetters']).replace('{URI}', link);
+doJsonQuery(queryEx).done(function(data) { handle_Letters(data); });
 
-  url: queryRel,
-  dataType: "json",
-  success: function (data){
-    handle_Relazioni(data);
-  },
-  error: function (e) {}
-});
+queryOA = prefixes + (queryManager['querySchedaPersona']['queryOpere']).replace('{URI}', link);
+doJsonQuery(queryOA).done(function(data) { handle_Artwork(data); });
 
-responseRel = $.ajax({
+queryOt = prefixes + (queryManager['querySchedaPersona']['queryOtherDoc']).replace('{URI}', link);
+doJsonQuery(queryOt).done(function(data) { handle_Other_Documents(data); });
 
-  url: queryRelIn,
-  dataType: "json",
-  success: function (data){
-    handle_RelazioniInverse(data);
-  },
-  error: function (e) {}
-});
+queryGt = prefixes + (queryManager['querySchedaPersona']['queryGettatelliEv']).replace('{URI}', link);
+doJsonQuery(queryGt).done(function(data) { handle_Gettatelli(data); });
 
-responseRel = $.ajax({
+queryInfoGt = prefixes + (queryManager['querySchedaPersona']['queryInfoGettatelli']).replace('{URI}', link);
+doJsonQuery(queryInfoGt).done(function(data) { handle_InfoGettatelli(data); });
 
-  url: queryCom,
-  dataType: "json",
-  success: function (data){
-    handle_Compagnia(data);
-  },
-  error: function (e) {}
-});
+queryRel = prefixes + (queryManager['querySchedaPersona']['queryRelazioni']).replace('{URI}', link);
+doJsonQuery(queryRel).done(function(data) { handle_Relazioni(data); });
 
-responseEv = $.ajax({
+queryRelIn = prefixes + (queryManager['querySchedaPersona']['queryRelazioniInverse']).replace('{URI}', link);
+doJsonQuery(queryRelIn).done(function(data) { handle_RelazioniInverse(data); });
 
-  url: queryEv,
-  dataType: "json",
-  success: function (data){
-    handle_Events(data);
-  },
-  error: function (e) {}
-});
+queryCom = prefixes + (queryManager['querySchedaPersona']['queryCompagnia']).replace('{URI}', link);
+doJsonQuery(queryCom).done(function(data) { handle_Compagnia(data); });
 
-responseEv = $.ajax({
+queryEv = prefixes + (queryManager['querySchedaPersona']['queryEventi']).replace('{URI}', link);
+doJsonQuery(queryEv).done(function(data) { handle_Events(data); });
 
-  url: queryCon,
-  dataType: "json",
-  success: function (data){
-    handle_Contrassegni(data);
-  },
-  error: function (e) {}
-});
+queryCon = prefixes + (queryManager['querySchedaPersona']['queryContrassegni']).replace('{URI}', link);
+doJsonQuery(queryCon).done(function(data) { handle_Contrassegni(data); });
 
 
 var labelName = "";
 
 function handle_data(json) {
 
-  //console.log(json['results']['bindings']);
-
   var graph = "";
   var label = "";
 
@@ -636,8 +193,6 @@ function handle_data(json) {
 
         labelName = first_name;
 
-        //console.log(variants);
-
         var Buttons = '<button title="Apri risorsa originale" class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
         <i class="fas fa-external-link-alt" aria-hidden="true"></i></button> \
         <button title="Citazione" type="button" value="object" id="' + uri + '" class="cit btn btn-default" alt="scheda" title="Citazione"><i class="fa fa-quote-right"></i></button> \
@@ -692,8 +247,6 @@ function get_dataset_name(graph) {
 }
 
 function handle_InfoGettatelli(json) {
-  
-  //console.log(json);
 
   var card = "";
   var uri_card = "";
@@ -1116,7 +669,7 @@ function handle_Contrassegni(json) {
   var Image = '<img style="width:100%;" src="img/contrassegni/' + id_image + '" />'
 
   document.getElementById("contrassegno").innerHTML = Image;
-  document.getElementById("nome_contrassegno").innerHTML = name_image;
+  document.getElementById("nome_contrassegno").innerHTML = titleCase(name_image);
      
 }
 
@@ -1488,141 +1041,6 @@ function handle_map(json) {
 });
 }
 
-
-$(document).on("click", ".luogo", function (ev) {
-
-    var link = this.id;
-    //alert(nome_autore);
-    //$('#myModal').text("");
-    window.open("Luogo.html?link="+this.id);
-    
-
-  });
-
-$(document).on("click", ".persona", function (ev) {
-
-    var link = this.id;
-    window.open("Persona.html?link="+this.id);
-    
-
-  });
-
-$(document).on("click", ".lettera", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  window.open("lettera.html?link="+this.id);
-  
-
-});
-
-$(document).on("click", ".object", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  window.open("object.html?link="+this.id);
-  
-
-});
-
-$(document).on("click", ".hyp", function (ev) {
-
-  var baseurl = window.location.origin+window.location.pathname;
-  let slash = baseurl.lastIndexOf("/");
-  var type = $(this).val() + '.html';
-  var link = this.id;
-  var url = baseurl.substr(0, slash+1) + type + "?link="+link;
-  var link = this.id;
-  $("#myModal").empty();
-  $("#myModal").css("display", "block");
-  $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" +
-    url + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-
-});
-
-$(document).on("click", ".artwork", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  window.open("OA.html?link="+this.id);
-  
-});
-
-$(document).on("click", ".close", function (ev) {
-
-  var link = this.id;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  $("#myModal").css("display", "none");
-
-});
-
-
-$(document).on("click", ".back", function (ev) {
-
-  $("#myTab").css("display", "none");
-
-});
-
-
-$(document).on("click", ".cit", function (ev) {
-  
-  var author ="RESTORE. smart access to digital heritage and memory"
-
-  var year = new Date().getFullYear()
-
-  var today = new Date();
-  var dd = String(today.getDate()).padStart(2, '0');
-  var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
-  var yyyy = today.getFullYear();
-
-  today = dd + '/' + mm + '/' + yyyy;
-
-  var baseurl = window.location.origin+window.location.pathname;
-  let slash = baseurl.lastIndexOf("/");
-  var type = $(this).val() + '.html';
-  var link = this.id;
-  var url = baseurl.substr(0, slash+1) + type + "?link="+link;
-  //alert(nome_autore);
-  //$('#myModal').text("");
-  $("#myModal").empty();
-  $("#myModal").css("display", "block");
-  $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" + 
-    author + " " + year + ", accesso effettuato: " + today + ", &lt;" + url + "&gt;</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-
-});
-
-function titleCase(str) {
-  var splitStr = str.toLowerCase().split(' ');
-  for (var i = 0; i < splitStr.length; i++) {
-      // You do not need to check if i is larger than splitStr length, as your for does that for you
-      // Assign it back to the array
-      splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);     
-  }
-  // Directly return the joined string
-  return splitStr.join(' '); 
-}
-
-function copyToClipboard(text) {
-    var sampleTextarea = document.createElement("textarea");
-    document.body.appendChild(sampleTextarea);
-    sampleTextarea.value = text; //save main text in it
-    sampleTextarea.select(); //select textarea contenrs
-    document.execCommand("copy");
-    document.body.removeChild(sampleTextarea);
-}
-
-function myFunction(){
-    var copy = document.getElementById("myInput");
-    copyText = copy.textContent;
-    copyToClipboard(copyText);
-
-    //copyToClipboard(copyText.value);
-}
-
 function exchangeLetter(tipo, mittente, uri_mittente, destinatario, uri_destinatario) {
   var params = tipo + ";" + mittente + ";" + uri_mittente + ";" + destinatario + ";" + uri_destinatario;
   window.open("results.html?params="+ params);

+ 635 - 0
js/query/managerQuery.js

@@ -258,7 +258,642 @@ var queryManager = {
         ?pc1 crm:P02_has_range ?uri_person . \
         ?uri_person rdfs:label ?name . \
         FILTER (?pc != ?pc1) \
+        }",
+
+        query : " SELECT DISTINCT ?place ?label ?tipo ?coordinates COUNT(?pc) AS ?count \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        {?pc crm:P02_has_range ?uri . \
+        ?event_from crm:P01_has_domain ?pc ; \
+        rdf:type crm:EL3_Receive_Letter; \
+        rdfs:label ?tipo ; \
+        crm:P26_moved_to ?place_from . \
+        ?place_from rdf:type crm:E53_Place ; \
+        owl:sameAs ?place . \
+        ?place rdfs:label ?label ; \
+        crm:P168_place_is_defined_by ?coordinates . \
+        } UNION { \
+        ?pc crm:P02_has_range ?uri . \
+        ?event_from crm:P01_has_domain ?pc ; \
+        rdf:type crm:EL2_Send_Letter; \
+        rdfs:label ?tipo ; \
+        crm:P27_moved_from ?place_from . \
+        ?place_from rdf:type crm:E53_Place ; \
+        owl:sameAs ?place . \
+        ?place rdfs:label ?label ; \
+        crm:P168_place_is_defined_by ?coordinates . \
+        } UNION { \
+        ?uri 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 { \
+            ?uri 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 . \
+        } \
+        UNION { \
+            ?pc crm:P02_has_range ?uri . \
+            ?uri_event crm:P01_has_domain ?pc; \
+            crm:P7_took_place_at ?uri_place ; \
+            crm:P2_has_type ?uri_type . \
+            ?uri_type rdfs:label ?tipo . \
+            ?uri_place rdf:type crm:E53_Place ; \
+            rdfs:label ?label . \
+            ?place owl:sameAs ?uri_place ; \
+            crm:P168_place_is_defined_by ?coordinates . \
+            } \
+        }",
+
+        queryInfo : " SELECT DISTINCT ?uri ?graph ?label ?identifier ?id_type ?name ?givenName ?familyName ?relative2 ?relative3 ?provenienza (GROUP_CONCAT(DISTINCT CONCAT(?variant, '| ', ?otherName) ; SEPARATOR = ';') AS ?variants) ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation ?qualification ?group \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        GRAPH ?graph {?uri rdfs:label ?label} \
+        ?uri foaf:name ?name . \
+        OPTIONAL {?uri crm:P1_is_identified_by ?id . \
+        ?id rdfs:label ?identifier ; \
+        crm:P2_has_type ?id_type .} \
+        OPTIONAL {?uri foaf:givenName ?givenName} \
+        OPTIONAL {?uri foaf:familyName ?familyName} \
+        OPTIONAL {?uri foaf:gender ?gender} \
+        OPTIONAL {?uri person:patronymicName ?patronymic } \
+        OPTIONAL {?uri crm:P74_has_current_or_former_residence ?uri_provenienza . \
+        ?uri_provenienza crm:P2_has_type 'Provenienza'; \
+        rdfs:label ?provenienza . } \
+        OPTIONAL {?uri crm:P2_has_type ?uri_person_type . \
+        ?uri_person_type rdfs:label ?person_type } \
+        OPTIONAL {?uri schema:hasOccupation ?uriOccupation . \
+        ?uriOccupation rdf:type schema:Occupation; \
+        rdfs:label ?occupation } \
+        OPTIONAL {?uri schema:honorificPrefix ?qualification} \
+        OPTIONAL {?uri crm:P100i_died_in ?Death . \
+        OPTIONAL {?Death crm:P4_has_time-span ?Death_TS . \
+        ?Death_TS rdfs:label ?Death_Date . } \
+        OPTIONAL {?Death crm:P7_took_place_at ?Place_D .  \
+        ?Place_D rdfs:label ?Death_Place } \
+        } \
+        OPTIONAL {?uri crm:P98i_was_born ?Birth . \
+        OPTIONAL {?Birth crm:P4_has_time-span ?Birth_TS . \
+        ?Birth_TS rdfs:label ?Birth_Date . } \
+        OPTIONAL {?Birth crm:P7_took_place_at ?Place_B . \
+        ?Place_B rdfs:label ?Birth_Place } \
+        } \
+        OPTIONAL {?uri crm:P107i_is_current_or_former_member_of ?uriGroup . \
+        ?uriGroup rdfs:label ?group } \
+        OPTIONAL {?uri schema:alternateName ?alias . } \
+        OPTIONAL {?uri owl:sameAs ?variant . \
+        ?variant foaf:name ?otherName . } \
+        OPTIONAL {?relation2 crm:P141_assigned ?uri ; \
+        crm:P42_assigned ?uri_rel_type2 . \
+        ?uri_rel_type2 rdfs:label 'Avo di secondo grado' . \
+        ?uri_relative2 crm:P141_assigned ?relation2; \
+        rdfs:label ?relative2 .} \
+        OPTIONAL {?relation3 crm:P141_assigned ?uri ; \
+        crm:P42_assigned ?uri_rel_type3 . \
+        ?uri_rel_type3 rdfs:label 'Avo di terzo grado' . \
+        ?uri_relative3 crm:P141_assigned ?relation3; \
+        rdfs:label ?relative3 .} \
+        } \
+        GROUP BY ?graph ?uri ?label ?identifier ?id_type ?name ?givenName ?familyName ?relative2 ?relative3 ?provenienza ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation ?qualification ?group \
+        LIMIT 1  ",
+
+        queryInfoGettatelli : " SELECT DISTINCT ?card ?uri_card \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?documentation crm:P67_refers_to ?uri ; \
+        crm:P141_assigned ?uri_card . \
+        ?uri_card rdfs:label ?card . \
+        } ",
+
+        queryRelazioni : " SELECT DISTINCT ?relation_type ?note ?uri_person ?name ?givenName ?familyName ?patronymic ?provenienza \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?uri crm:P141_assigned ?relation . \
+        ?relation crm:P42_assigned ?uri_type ; \
+        crm:P141_assigned ?uri_person . \
+        ?uri_type rdfs:label ?relation_type . \
+        OPTIONAL {?uri_type crm:P3_has_note ?note } \
+        ?uri_person foaf:name ?name . \
+        OPTIONAL {?uri_person foaf:givenName ?givenName} \
+        OPTIONAL {?uri_person foaf:familyName ?familyName} \
+        OPTIONAL {?uri_person person:patronymicName ?patronymic } \
+        OPTIONAL {?uri_person crm:P74_has_current_or_former_residence ?uri_provenienza . \
+        ?uri_provenienza crm:P2_has_type 'Provenienza'; \
+        rdfs:label ?provenienza . } \
+        } ",
+
+        queryRelazioniInverse : " SELECT DISTINCT ?relation_type ?note ?uri_person SAMPLE(?name) AS ?name ?givenName ?familyName ?patronymic ?provenienza \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?relation crm:P141_assigned ?uri; \
+        crm:P42_assigned ?uri_type . \
+        ?uri_person crm:P141_assigned ?relation . \
+        ?uri_type rdfs:label ?relation_type . \
+        OPTIONAL {?uri_type crm:P3_has_note ?note } \
+        OPTIONAL {?uri_person foaf:name ?name } \
+        OPTIONAL {?uri_person foaf:givenName ?givenName} \
+        OPTIONAL {?uri_person foaf:familyName ?familyName}  \
+        OPTIONAL {?uri_person person:patronymicName ?patronymic } \
+        OPTIONAL {?uri_person crm:P74_has_current_or_former_residence ?uri_provenienza . \
+        ?uri_provenienza crm:P2_has_type 'Provenienza'; \
+        rdfs:label ?provenienza . } \
+        } ",
+
+        queryLetters : " SELECT DISTINCT ?type ?segnatura ?document_uri ?document_name ?time_span ?InfObj \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        {?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 : " SELECT DISTINCT ?role ?document ?label ?id (group_concat(distinct ?time_span ;separator='-') as ?time_span) \
+        WHERE { \
+        ?document ?property ?event ; \
+        crm:P1_is_identified_by ?uri_id ; \
+        rdfs:label ?label . \
+        ?uri_id rdfs:label ?id ; \
+        crm:P2_has_type 'Segnatura' . \
+        OPTIONAL { \
+        {?event crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span . \
+        } UNION { \
+        ?sub_event rdfs:subClassOf ?event ; \
+        crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span . } \
+        } \
+        ?event crm:P01_has_domain ?domain . \
+        ?domain crm:P02_has_range <{URI}> ; \
+        crm:P14.1_in_the_role_of ?uri_role . \
+        ?uri_role rdfs:label ?role . \
+        } \
+        GROUP BY ?document ?label ?id ?role ",
+
+        queryOtherDoc : " SELECT DISTINCT ?document ?label ?id (group_concat(distinct ?time_span ;separator='-') as ?time_span) \
+        WHERE { \
+        VALUES ?uri {<{URI}> } \
+        {?domain crm:P02_has_range ?uri . \
+        ?event crm:P01_has_domain ?domain . \
+        ?document crm:P92i_was_brought_into_existence_by ?event ; \
+        crm:P1_is_identified_by ?uri_id ; \
+        rdfs:label ?label . \
+        ?uri_id crm:P2_has_type 'Segnatura'; \
+        rdfs:label ?id . \
+        } UNION { \
+        ?event crm:P67_refers_to ?uri . \
+        ?document crm:P92i_was_brought_into_existence_by ?event ; \
+        rdfs:label ?label ; \
+        crm:P1_is_identified_by ?uri_id . \
+        ?uri_id rdfs:label ?id ; \
+        crm:P2_has_type 'Segnatura' . \
+        } UNION { \
+        ?event crm:P67_refers_to ?uri . \
+        ?documentation crm:P67_refers_to ?uri ; \
+        crm:P141_assigned ?card . \
+        ?document crm:P46_is_composed_of ?card ; \
+        rdfs:label ?label ; \
+        crm:P1_is_identified_by ?uri_id . \
+        ?uri_id rdfs:label ?id ; \
+        crm:P2_has_type 'Segnatura' . \
+        } \
+        OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span} \
+        } ",
+
+        queryOpere : " 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 ; \
+        crm:P1_is_identified_by ?uri_nct . \
+        ?uri_nct rdfs:label ?nct . \
+        ?production crm:P108_has_produced ?subject . \
+        OPTIONAL {?production crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span } \
+        ?pc crm:P01_has_domain ?production ; \
+        crm:P02_has_range <{URI}> } \
+        GROUP BY ?subject ?label ?nct ",
+
+        queryGettatelliEv : " SELECT DISTINCT ?event_type ?time_span \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?uri crm:P12i_was_present_at ?event . \
+        ?event crm:P2_has_type ?uri_event_type ; \
+        crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span . \
+        ?uri_event_type rdfs:label ?event_type . \
+        } ",
+
+        queryEventi : " SELECT DISTINCT ?event_type ?role ?uri_time_span ?year ?month ?day ?time_span ?place ?uri_place ?document ?uri_document \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?domain crm:P02_has_range ?uri ; \
+        crm:P14.1_in_the_role_of ?uri_role . \
+        ?uri_role rdfs:label ?role . \
+        ?event crm:P01_has_domain ?domain ; \
+        crm:P2_has_type ?uri_event_type . \
+        ?uri_event_type rdfs:label ?event_type . \
+        OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span . \
+        OPTIONAL {?uri_time_span time:year ?year .} \
+        OPTIONAL {?uri_time_span time:month ?month .} \
+        OPTIONAL {?uri_time_span time:day ?day .} \
+        } \
+        OPTIONAL {?event crm:P7_took_place_at ?uri_location . \
+        ?uri_location rdfs:label ?place . \
+        OPTIONAL {?uri_place owl:sameAs ?uri_location . \
+        ?uri_place crm:P168_place_is_defined_by ?coords }} \
+        ?document_info crm:P70_documents ?event . \
+        ?uri_document crm:P128_carries ?document_info ; \
+        rdfs:label ?document . \
+        } \
+        ORDER BY ?year ?month ?day ",
+
+        queryCompagnia : " SELECT DISTINCT ?denomination ?occupation ?uri_sede ?uri_place ?sede \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?uri rdf:type crm:E74_Group . \
+        ?uri crm:P2_has_type ?denomination . \
+        OPTIONAL {?uri schema:hasOccupation ?uri_Occupation . \
+        ?uri_Occupation rdfs:label ?occupation .} \
+        OPTIONAL {?uri crm:P74_has_current_or_former_residence ?uri_sede . \
+        ?uri_sede rdfs:label ?sede . \
+        OPTIONAL {?uri_sede owl:sameAs ?uri_place . \
+        ?uri_place crm:P168_place_is_defined_by ?coords .} \
+        } \
+        }",
+
+        queryContrassegni : " SELECT DISTINCT ?contrassegno ?image \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?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 . \
+        } "
+    },
+
+    querySchedaOggetto : {
+        queryInfo : " SELECT DISTINCT ?g AS ?graph ?uri ?label ?dimension ?consistency ?id ?sigla_registro (group_concat(distinct ?dimension ; separator='<br />') as ?dimensions) ?material (group_concat(distinct ?time_span ;separator='-') as ?time_span) ?location ?uri_owner ?owner ?uri_document ?document ?note \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        GRAPH ?g { ?uri rdfs:label ?label } \
+        OPTIONAL {?uri crm:P1_is_identified_by ?uri_id . \
+        ?uri_id rdfs:label ?id ; \
+        crm:P2_has_type 'Segnatura' .} \
+        OPTIONAL { ?uri crm:P43_has_dimension ?uri_consistency . \
+        ?uri_consistency crm:P2_has_type 'Consistenza carte' ; \
+        rdfs:label ?consistency } \
+        OPTIONAL { ?uri crm:P43_has_dimension ?uri_dimension . \
+        ?uri_dimension crm:P2_has_type 'Dimensioni' ; \
+        rdfs:label ?dimension } \
+        OPTIONAL { ?uri crm:P139_has_alternative_form ?uri_registro . \
+        ?uri_registro rdfs:label ?sigla_registro; \
+        crm:P2_has_type 'Sigla registro' . } \
+        OPTIONAL { ?uri crm:P45_consist_of ?uri_material . \
+        ?uri_material rdfs:label ?material } \
+        OPTIONAL { ?uri crm:P52_has_current_owner ?uri_owner . \
+        ?uri_owner rdfs:label ?owner . } \
+        OPTIONAL { ?uri crm:P54_has_current_permanent_location ?location } \
+        OPTIONAL { ?uri crm:P3_has_note ?uri_note . \
+        ?uri_note rdfs:label ?note } \
+        OPTIONAL { ?uri crm:P92i_was_brought_into_existence_by ?creation . \
+        ?creation crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span . } \
+        OPTIONAL {?uri_document crm:P46_is_composed_of ?uri ; \
+        rdfs:label ?document .} \
+        } ",
+
+        queryContent : " SELECT DISTINCT ?g AS ?graph ?uri ?titolo ?tipo (group_concat(distinct ?ref ; separator='<br />') as ?ref) \
+        WHERE { \
+        VALUES ?object {<{URI}>} \
+        ?object crm:P128_carries ?uri . \
+        ?uri rdf:type crm:E73_Information_Object . \
+        GRAPH ?g { ?uri rdfs:label ?label } \
+        OPTIONAL {?uri crm:P1_is_identified_by ?uri_titolo . \
+        ?uri_titolo rdfs:label ?titolo ; \
+        rdf:type crm:E35_Title . } \
+        OPTIONAL { ?uri crm:P2_has_type ?uri_tipo . \
+        ?uri_tipo rdfs:label ?tipo . } \
+        OPTIONAL { ?uri crm:P67_refers_to ?uri_ref . \
+        ?uri_ref rdfs:label ?ref . } \
+        FILTER NOT EXISTS {GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> { ?uri rdfs:label ?label }}. \
+        }",
+
+        queryOviLetter : " SELECT DISTINCT ?otherId ?InfObj \
+        WHERE {  \
+        VALUES ?uri {<{URI}>}   \
+        ?uri crm:P1_is_identified_by ?uri_id .  \
+        ?uri_id crm:P2_has_type 'Segnatura' ; \
+        crm:P139_has_alternative_form ?other_id . \
+        ?other_id crm:P2_has_type ?uri_type ; \
+        rdfs:label ?otherId . \
+        ?uri_type rdfs:label 'Segnatura OVI' . \
+        OPTIONAL { ?uri crm:P128_carries ?InfObj . \
+        GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> {?InfObj rdf:type crm:E73_Information_Object } } \
+        } ",
+
+        queryPersone : " SELECT DISTINCT ?uri_person ?name (group_concat(distinct ?p_type ; separator=', ') as ?types) ?person_note ?note \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        { \
+        ?document crm:P141_assigned ?uri ; \
+        crm:P67_refers_to ?uri_person . \
+        ?uri_person foaf:name ?name ; \
+        crm:P2_has_type ?person_type . \
+        ?person_type rdfs:label ?p_type . \
+        OPTIONAL {?uri_person crm:P3_has_note ?uri_person_note . \
+        ?uri_person_note rdfs:label ?person_note; \
+        crm:P2_has_type 'Nota collegamento con gettatello' . } \
+        } UNION { \
+        ?uri crm:P92i_was_brought_into_existence_by ?creation . \
+        ?creation crm:P67_refers_to ?uri_person . \
+        ?uri_person foaf:name ?name ; \
+        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 . \
+        } \
+        }",
+
+        queryAssocDocs : " SELECT DISTINCT ?card ?doc_type ?name_card \
+        WHERE { \
+        VALUES ?uri {<{URI}>} \
+        ?uri crm:P46_is_composed_of ?card . \
+        ?card rdfs:label ?name_card . \
+        OPTIONAL {?card crm:P2_has_type ?doc_type } \
+        OPTIONAL {?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 ?type . \
+        } \
+        }",
+
+        queryContrassegni : " SELECT DISTINCT ?uri_contrassegno ?contrassegno \
+        WHERE {VALUES ?uri {<{URI}>} \
+        ?uri crm:P46_is_composed_of ?uri_paper . \
+        ?uri_documentation crm:P141_assigned ?uri_paper ; \
+        crm:P140_assigned_attribute_to ?uri_contrassegno . \
+        ?uri_contrassegno rdfs:label ?contrassegno . \
+        }",
+
+        queryEventiGettatelli : " SELECT DISTINCT ?uri_obj ?object ?name_event ?event_type ?uri_person ?label ?role ?time_span ?uri_place ?place \
+        WHERE {VALUES ?uri {<{URI}>} \
+        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 rdfs:label ?name_event . \
+        ?event crm:P2_has_type ?uri_event_type . \
+        ?uri_event_type rdfs:label ?event_type . \
+        ?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 ?role . \
+        ?uri_person rdfs:label ?label . \
+        OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \
+        ?uri_time_span rdfs:label ?time_span . } \
+        OPTIONAL {?event crm:P7_took_place_at ?uri_location . \
+        ?uri_place owl:sameAs ?uri_location ; \
+        crm:P168_place_is_defined_by ?coords; \
+        rdfs:label ?place . } \
+        }",
+
+        queryLuoghiGT : " SELECT DISTINCT ?uri_place ?place \
+        WHERE {VALUES ?uri {<{URI}>} \
+        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 .  \
         }"
+    },
+
+    querySchedaLuogo : {
+            query : " SELECT DISTINCT ?graph ?uri ?name_place ?coordinates {\
+            GRAPH ?graph { VALUES ?uri { <{URI}> } \
+            ?uri crm:P168_place_is_defined_by ?coordinates;\
+            rdfs:label ?name_place .\
+            }\
+            }",
+
+            queryRiferimenti : " SELECT DISTINCT ?references {\
+            <{URI}> owl:sameAs ?references\
+            }",
+
+            queryToponimi : " SELECT DISTINCT ?toponimi {\
+            <{URI}> crm:P1_is_identified_by ?uri_toponym .\
+            ?uri_toponym rdfs:label ?toponimi\
+            }",
+
+            queryRicezione : " SELECT DISTINCT ?segnatura ?document_uri ?document_name ?time_span ?InfObj \
+            WHERE { \
+            <{URI}> owl:sameAs ?place . \
+            ?event_to crm:P26_moved_to ?place ; \
+            rdf:type crm:EL3_Receive_Letter ; \
+            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 {?event_to crm:P4_has_time-span ?uri_ts . \
+            ?uri_ts rdfs:label ?time_span . } \
+            } ",
+
+            queryInvio : " SELECT DISTINCT ?segnatura ?document_uri ?document_name ?time_span ?InfObj \
+            WHERE { \
+            <{URI}> owl:sameAs ?place . \
+            ?event_to crm:P27_moved_from ?place ; \
+            rdf:type crm:EL2_Send_Letter ; \
+            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 {?event_to crm:P4_has_time-span ?uri_ts . \
+            ?uri_ts rdfs:label ?time_span . } \
+            }",
+
+            queryCitazione : " SELECT DISTINCT ?segnatura ?document_uri ?document_name SAMPLE(?time_span) AS ?time_span ?InfObj \
+            WHERE { \
+            VALUES ?uri {<{URI}>} \
+            {?uri crm:P1_is_identified_by ?toponym . \
+            ?InfObj crm:P67_refers_to ?toponym . \
+            ?document_uri crm:P128_carries ?InfObj ; \
+            rdfs:label ?document_name . \
+            OPTIONAL {?document_uri crm:P1_is_identified_by ?uriSegnatura . \
+            ?uriSegnatura crm:P2_has_type 'Segnatura' ; \
+            rdfs:label ?segnatura . } \
+            OPTIONAL {?document_uri crm:P25i_moved_by ?event . \
+            ?event_send rdfs:subClassOf ?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 : " SELECT DISTINCT ?role ?range SAMPLE(?name) AS ?label COUNT(?range) AS ?count \
+            WHERE{ \
+            {?place owl:sameAs <{URI}> . \
+            ?event_to crm:P26_moved_to ?place ; \
+            rdf:type crm:EL3_Receive_Letter ; \
+            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 ?lb ; \
+            foaf:name ?name . \
+            } UNION { \
+            ?place owl:sameAs <{URI}> . \
+            ?event_to crm:P27_moved_from ?place ; \
+            rdf:type crm:EL2_Send_Letter ; \
+            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 ?lb ; \
+            foaf:name ?name . \
+            } UNION { \
+            <{URI}> 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",
+
+            queryCount : " SELECT ?place ?label COUNT(?label) AS ?Count \
+            WHERE{ \
+            ?place_to owl:sameAs <{URI}> . \
+            ?event_to crm:P26_moved_to ?place_to ; \
+            rdf:type crm:EL3_Receive_Letter ; \
+            rdfs:subClassOf ?event . \
+            ?event_from rdfs:subClassOf ?event ; \
+            rdf:type crm:EL2_Send_Letter ; \
+            crm:P27_moved_from ?place . \
+            ?place rdfs:label ?label \
+            } \
+            ORDER BY DESC (?Count)",
+
+            queryCount2 : " SELECT ?place ?label COUNT(?label) AS ?Count \
+            WHERE{ \
+            ?place_from owl:sameAs <{URI}> . \
+            ?event_from crm:P27_moved_from ?place_from ; \
+            rdf:type crm:EL2_Send_Letter ; \
+            rdfs:subClassOf ?event . \
+            ?event_to rdfs:subClassOf ?event ; \
+            rdf:type crm:EL2_Send_Letter ; \
+            crm:P27_moved_from ?place . \
+            ?place rdfs:label ?label . \
+            } \
+            ORDER BY DESC (?Count) "
+    },
+
+    querySchedaOpera : {
+            queryInfo : " SELECT DISTINCT ?graph ?identifier ?label ?title ?uriType ?type ?uriOwner ?current_owner ?current_location ?subject (group_concat(distinct ?value ; separator='x') as ?dimensions) SAMPLE(?unit) AS ?unit (GROUP_CONCAT(DISTINCT CONCAT(?uriMaterial, '; ', ?material) ; SEPARATOR = '<br />') AS ?Materials) ?condition ?note \
+            WHERE { \
+            VALUES ?uri {<{URI}>} \
+            GRAPH ?graph {?uri rdfs:label ?label} \
+            OPTIONAL {?uri crm:P3_has_note ?note } \
+            ?uri crm:P128_carries ?Inf_Obj . \
+            OPTIONAL {?Inf_Obj crm:P1_is_identified_by ?uriTitle . \
+            ?uriTitle rdf:type crm:E35_Title; \
+            rdfs:label ?title } \
+            OPTIONAL {?Inf_Obj crm:P2_has_type ?uriType . \
+            ?uriType rdfs:label ?type } \
+            OPTIONAL {?uri crm:P43_has_dimension ?uriDimension . \
+            ?uriDimension crm:P90_has_value ?value; \
+            crm:P91_has_unit ?uri_unit . \
+            ?uri_unit rdfs:label ?unit } \
+            OPTIONAL {?uri crm:P1_is_identified_by ?uriIdentifier . \
+            ?uriIdentifier rdfs:label ?identifier } \
+            OPTIONAL {?uri crm:P45_consists_of ?uriMaterial . \
+            ?uriMaterial rdfs:label ?material } \
+            OPTIONAL {?uri crm:P44_has_condition ?uriCondition . \
+            ?uriCondition crm:P2_has_type ?condition} \
+            OPTIONAL {?uri crm:P54_has_current_permanent_location ?current_location } \
+            OPTIONAL {?uri crm:P62_depicts ?uriSubject . \
+            ?uriSubject rdfs:label ?subject; \
+            crm:P2_has_type 'Identificazione Iconografica' .} \
+            OPTIONAL {?uri crm:P52_has_current_owner ?uriOwner . \
+            ?uriOwner rdfs:label ?current_owner } \
+            }",
+
+            queryProduction : " SELECT DISTINCT (GROUP_CONCAT(DISTINCT CONCAT(?uriPerson, '; ', ?person, '; ', ?role) ; SEPARATOR = '<br />') AS ?Partecipants) (group_concat(distinct ?time_span ;separator='-') as ?time) (GROUP_CONCAT(DISTINCT CONCAT(?uriTecne, '; ', ?technique) ; SEPARATOR = '<br />') AS ?techniques) \
+            WHERE { \
+            VALUES ?uri {<{URI}>} \
+            ?uri crm:P128_carries ?Information_Object . \
+            ?Information_Object crm:P108i_was_produced_by ?Production . \
+            OPTIONAL {?Production crm:P4_has_time-span ?uriTS ; \
+            crm:P32_used_general_technique ?uriTecne . \
+            ?uriTS rdfs:label ?time_span . \
+            ?uriTecne rdfs:label ?technique} \
+            OPTIONAL {?pc crm:P01_has_domain ?Production ; \
+            crm:P02_has_range ?uriPerson ; \
+            crm:P14.1_in_the_role_of ?uriRole . \
+            ?uriPerson rdfs:label ?person . \
+            ?uriRole rdfs:label ?role} \
+            }"
     }
 };
 

+ 0 - 2
js/results_query.js

@@ -1,5 +1,3 @@
-//uri_mittente = "http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0000806";
-//uri_destinatario = "http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0001817";
 
 // Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
 thisUrlParams = {};

+ 1 - 1
js/search.js

@@ -721,7 +721,7 @@ function getGraph(graph1, graph2) {
 				search_graph = "VALUES ?g {<http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi>}";
 			}
 			if (graph2 == "aspo_gettatelli") {
-				search_graph = "VALUES ?g {<http://dev.restore.ovi.cnr.it:8890/gettatelli/newdataset>}";
+				search_graph = "VALUES ?g {<http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli>}";
 			}
 			if (graph2 == "mpp_martini") {
 				search_graph = "VALUES ?g {<http://dev.restore.ovi.cnr.it:8890/mpp/martini>}";

+ 156 - 0
js/utilities.js

@@ -0,0 +1,156 @@
+//INIZIO PREPARAZIOEN QUERY
+// Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
+thisUrlParams = {};
+window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
+    thisUrlParams[key] = value;
+});
+console.log('URL get params: ', thisUrlParams.params);
+
+function prepareQueryURL(query){
+  sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
+  sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
+  return sparqlEndpoint + sparqlUrlParams;
+}
+
+function doJsonQuery(query) {
+
+queryURL = prepareQueryURL(query);
+return $.ajax({
+  url: queryURL,
+      dataType: "json",
+  type: 'GET'
+  });
+}
+
+// Funzioni per raccattare + stringhificare l'output
+queryStringOutput = "";
+function stringifyResponse(val){
+  resultArray = val['results']['bindings'];
+  out = "";
+  for(i = 0; i < resultArray.length; i++){
+      out = out + JSON.stringify(resultArray[i])
+  }
+  queryStringOutput = (queryStringOutput + out).replace("}{",",");
+}
+
+//FINE PREPARAZIONE QUERY 
+
+$(document).on("click", ".luogo", function (ev) {
+    var link = this.id;
+    window.open("Luogo.html?link="+this.id);
+});
+
+
+$(document).on("click", ".persona", function (ev) {
+    var link = this.id;
+    window.open("Persona.html?link="+this.id);
+});
+
+
+$(document).on("click", ".lettera", function (ev) {
+  var link = this.id;
+  window.open("lettera.html?link="+this.id);
+});
+
+
+$(document).on("click", ".object", function (ev) {
+  var link = this.id;
+  window.open("object.html?link="+this.id);
+});
+
+
+$(document).on("click", ".artwork", function (ev) {
+    var link = this.id;
+    window.open("OA.html?link="+this.id); 
+});  
+
+
+function schedaASPO(info){
+    window.open(info);
+}
+
+
+$(document).on("click", ".hyp", function (ev) {
+  var baseurl = window.location.origin+window.location.pathname;
+  let slash = baseurl.lastIndexOf("/");
+  var type = $(this).val() + '.html';
+  var link = this.id;
+  var url = baseurl.substr(0, slash+1) + type + "?link="+link;
+  var link = this.id;
+  $("#myModal").empty();
+  $("#myModal").css("display", "block");
+  $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" +
+    url + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
+
+});
+
+
+$(document).on("click", ".close", function (ev) {
+  var link = this.id;
+  $("#myModal").css("display", "none");
+});
+
+
+$(document).on("click", ".back", function (ev) {
+  $("#myTab").css("display", "none");
+});
+
+
+$(document).on("click", ".cit", function (ev) {
+  
+  var author ="RESTORE. smart access to digital heritage and memory"
+
+  var year = new Date().getFullYear()
+
+  var today = new Date();
+  var dd = String(today.getDate()).padStart(2, '0');
+  var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
+  var yyyy = today.getFullYear();
+
+  today = dd + '/' + mm + '/' + yyyy;
+
+  var baseurl = window.location.origin+window.location.pathname;
+  let slash = baseurl.lastIndexOf("/");
+  var type = $(this).val() + '.html';
+  var link = this.id;
+  var url = baseurl.substr(0, slash+1) + type + "?link="+link;
+  //alert(nome_autore);
+  //$('#myModal').text("");
+  $("#myModal").empty();
+  $("#myModal").css("display", "block");
+  $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>&times;</span></div><div id='myInput'>" + 
+    author + " " + year + ", accesso effettuato: " + today + ", &lt;" + url + "&gt;</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
+
+});
+
+
+function titleCase(str) {
+    var splitStr = str.toLowerCase().split(' ');
+    for (var i = 0; i < splitStr.length; i++) {
+        // You do not need to check if i is larger than splitStr length, as your for does that for you
+        // Assign it back to the array
+        splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);     
+    }
+    // Directly return the joined string
+    new_str = splitStr.join(' '); 
+    finalString = new_str.replace(" Di ", " di ")
+    return finalString;
+}
+
+
+function copyToClipboard(text) {
+    var sampleTextarea = document.createElement("textarea");
+    document.body.appendChild(sampleTextarea);
+    sampleTextarea.value = text; //save main text in it
+    sampleTextarea.select(); //select textarea contenrs
+    document.execCommand("copy");
+    document.body.removeChild(sampleTextarea);
+}
+
+function myFunction(){
+    var copy = document.getElementById("myInput");
+    copyText = copy.textContent;
+    copyToClipboard(copyText);
+
+    //copyToClipboard(copyText.value);
+}

+ 2 - 0
lettera.html

@@ -383,6 +383,8 @@
 		</div>
 	</footer>
 
+	<script src="js/query/managerQuery.js"></script>
+	<script src="js/utilities.js"></script>
 	<script src="js\lettera.js"></script>
 
 	<!-- Bootstrap core JavaScript -->

+ 2 - 0
object.html

@@ -396,6 +396,8 @@
 		</div>
 	</footer>
 
+	<script src="js/query/managerQuery.js"></script>
+	<script src="js/utilities.js"></script>
 	<script src="js/object.js"></script>
 
 	<!-- Bootstrap core JavaScript -->

+ 2 - 2
results.html

@@ -20,8 +20,8 @@
     <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://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?lang=css&amp;skin=default"></script>
-    <script src="js/jquery.csv.js"></script>
-    <script src="js/query/lemmi.js"></script>
+    <!--<script src="js/jquery.csv.js"></script>
+    <script src="js/query/lemmi.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>