Alessia 1 gadu atpakaļ
vecāks
revīzija
2f70e21a50
11 mainītis faili ar 262 papildinājumiem un 226 dzēšanām
  1. 1 0
      Persona.html
  2. 69 29
      js/lettera.js
  3. 19 7
      js/lettera_query.js
  4. 4 0
      js/people.js
  5. 43 132
      js/query/managerQuery.js
  6. 56 26
      js/results.js
  7. 37 18
      js/results_query.js
  8. 2 2
      js/word_cloud.js
  9. 17 4
      lettera.html
  10. 5 5
      results.html
  11. 9 3
      ricerca.html

+ 1 - 0
Persona.html

@@ -565,6 +565,7 @@
 	<script src="js/people.js"></script>
 	<script src="js/rectangles.js"></script>
 	<script src="js/word_cloud.js"></script>
+	<script src="js/query/managerQuery.js"></script>
 
 	<!-- Bootstrap core JavaScript -->
 	<script src="vendor/jquery/jquery.min.js"></script>

+ 69 - 29
js/lettera.js

@@ -28,10 +28,8 @@ async function getPageInfo(){
 		out.edizione = await doJsonQuery(queryEdizione, true);
 		out.toponimi = await doJsonQuery(queryToponimi);
 		out.antroponimi = await doJsonQuery(queryAntroponimi);
+		out.lemmi = await doJsonQuery(queryLemmi);
 
-		// out.tipo = await doJsonQuery(queryTipo);
-		// out.siglaOVI = await doJsonQuery(querySiglaOVI);
-		// out.raccolta = await doJsonQuery(queryRaccolta);
 	} catch(err){
 		console.log(err);
 	}
@@ -70,28 +68,6 @@ function updatePage(){
 		}
 	}
 
-	/*if(pageInfo.query1){
-		document.getElementById("mittente_id").innerHTML = pageInfo.query1.mittente.value;
-		//document.getElementById("mittente_btn").innerHTML = createButton("fa fa-user", "Scheda persona", "schedaPersona('PERS')".replace("PERS", pageInfo.query1.mittente.value));
-	}
-	if(pageInfo.query1){
-		document.getElementById("destinatario_id").innerHTML = pageInfo.query1.destinatario.value;
-		//document.getElementById("destinatario_btn").innerHTML = createButton("fa fa-user", "Scheda persona", "schedaPersona('PERS')".replace("PERS", pageInfo.query1.destinatario.value));
-	}
-	if(pageInfo.query1){
-		document.getElementById("imageASPO").innerHTML = createEmbed(pageInfo.query1.subject.value);
-	}
-	if(pageInfo.query1){
-		document.getElementById("luogo_partenza_id").innerHTML = pageInfo.query1.luogo_partenza.value;
-		document.getElementById("luogo_partenza_btn").innerHTML = createButton("fa fa-map", "Vedi mappa", "schedaMappa('LUOGO')".replace("LUOGO", pageInfo.query1.uriLuogoPartenza.value));
-	}
-	if(pageInfo.query1){
-		document.getElementById("luogo_arrivo_id").innerHTML = pageInfo.query1.luogo_arrivo.value;
-		document.getElementById("luogo_arrivo_btn").innerHTML = createButton("fa fa-map", "Vedi mappa", "schedaMappa('LUOGO')".replace("LUOGO", pageInfo.query1.uriLuogoArrivo.value));
-	}
-	if(pageInfo.query1) document.getElementById("data_partenza_id").innerHTML = pageInfo.query1.data_partenza.value;
-	if(pageInfo.query1) document.getElementById("data_arrivo_id").innerHTML = pageInfo.query1.data_arrivo.value;
-	*/
 	if(pageInfo.descrizione) document.getElementById("descrizione_id").innerHTML = pageInfo.descrizione.descrizione.value;
 	if(pageInfo.areaLinguistica) document.getElementById("lingua_id").innerHTML = pageInfo.areaLinguistica.lingua.value;
 	if(pageInfo.areaLinguistica) document.getElementById("area_linguistica_id").innerHTML = pageInfo.areaLinguistica.area_linguistica.value;
@@ -106,13 +82,25 @@ function updatePage(){
 	}
 	if(pageInfo.testo) document.getElementById("trascrizione_id").innerHTML = pageInfo.testo.testo_lemmatizzato.value;
 	//
-	if(pageInfo.antroponimi && pageInfo.antroponimi.length){
-		const listaAntroponimi = pageInfo.antroponimi.map(elem => elem.antroponimo.value);
+	/*if(pageInfo.antroponimi && pageInfo.antroponimi.length){
+		const listaAntroponimi = pageInfo.antroponimi.map(elem => elem.lemma.value);
 		document.getElementById("antroponimi").innerHTML = formatListAsLi(listaAntroponimi);
 	}
 	if(pageInfo.toponimi && pageInfo.toponimi.length){
-		const listaToponimi = pageInfo.toponimi.map(elem => elem.toponimo.value);
+		const listaToponimi = pageInfo.toponimi.map(elem => elem.lemma.value);
 		document.getElementById("toponimi").innerHTML = formatListAsLi(listaToponimi);
+	}*/
+
+	if(pageInfo.antroponimi){
+		handle_lemmi(pageInfo.antroponimi, "Antroponimo", "n.p.");
+	}
+
+	if(pageInfo.toponimi){
+		handle_lemmi(pageInfo.toponimi, "Toponimo", "n.g.");
+	}
+
+	if(pageInfo.lemmi){
+		handle_lemmi(pageInfo.lemmi, "", "");
 	}
 
 	if(pageInfo.query2) {
@@ -219,6 +207,53 @@ for (var i = 0; i < btns.length; i++) {
   });
 }
 
+function handle_lemmi(array, type, partOfSpeech) {
+
+	lemmi = [];
+
+	$.each( 
+		array, 
+		function (index, value) {
+			var uri_lemma = value['uri_lemma']['value'];
+			var lemma = value['lemma']['value'];
+			var tipo = type;
+			var pos = partOfSpeech;
+			var uri_iperlemma = "";
+			var iperlemma = "";
+
+			if (value.hasOwnProperty('tipo')) {
+				tipo = value['tipo']['value'];
+			}
+			if (value.hasOwnProperty('pos')) {
+				pos = value['pos']['value'];
+			}
+			if (value.hasOwnProperty('uri_iperlemma')) {
+				uri_iperlemma = value['uri_iperlemma']['value'];
+			}
+			if (value.hasOwnProperty('iperlemma')) {
+				iperlemma = value['iperlemma']['value'];
+			}
+
+			const cells = [uri_lemma, lemma, tipo, pos, uri_iperlemma, iperlemma];    
+      		lemmi.push(cells); 
+					
+	  });
+
+
+	for (var i=0; i<lemmi.length; i++) {
+		var new_lemma = '<tr class="res">' +
+		'<th class="col-4">' + lemmi[i][1] + '</th>' +
+		'<th class="col-2">' + lemmi[i][2] + '</th>' +
+		'<th class="col-2">' + lemmi[i][3] + '</th>' +
+		'<th id="' + lemmi[i][4] + '" class="col-2 iperlemma link">' + lemmi[i][5] + '</th>' +
+		'<th onclick="exploreDocuments(\'' + lemmi[i][0] + '\', \''+ lemmi[i][1] + '\');" class="col-2 explore link"><i class="fa fa-search" aria-hidden="true"></i></th>' +
+		'</tr>';
+
+		$('#lemmi').append(new_lemma);
+	}
+	
+}
+
 $(document).on("click", ".close", function (ev) {
 
 		var link = this.id;
@@ -285,4 +320,9 @@ function myFunction(){
     copyToClipboard(copyText);
 
     //copyToClipboard(copyText.value);
-}
+}
+
+function exploreDocuments(uri_lemma, lemma) {
+	var params = "lemma" + ";" + uri_lemma + ";" + lemma;
+	window.open("results.html?params="+ params);
+  }

+ 19 - 7
js/lettera_query.js

@@ -183,13 +183,25 @@ rdfs:label ?raccolta . \
 ?racc_type rdfs:label 'Raccolta'. \
 } LIMIT 1"
 
-queryToponimi = prefixes + "SELECT DISTINCT ?link_toponimo ?toponimo \
-WHERE {<" + thisUrlParams.link + "> crm:P67_refers_to ?link_toponimo . \
-?link_toponimo rdfs:label ?toponimo ; \
+queryToponimi = prefixes + "SELECT DISTINCT ?uri_lemma ?lemma \
+WHERE {<" + thisUrlParams.link + "> crm:P67_refers_to ?uri_lemma . \
+?uri_lemma rdfs:label ?lemma ; \
 crm:P2_has_type 'Toponimo' . \
 }"
 
-queryAntroponimi = prefixes + "SELECT DISTINCT * \
-WHERE {<" + thisUrlParams.link + "> crm:P67_refers_to ?link_antroponimo . \
-?link_antroponimo rdfs:label ?antroponimo; \
-crm:P2_has_type 'Antroponimo'}"
+queryAntroponimi = prefixes + "SELECT DISTINCT ?uri_lemma ?lemma \
+WHERE {<" + thisUrlParams.link + "> crm:P67_refers_to ?uri_lemma . \
+?uri_lemma rdfs:label ?lemma; \
+crm:P2_has_type 'Antroponimo'}"
+
+queryLemmi = prefixes + " SELECT DISTINCT ?uri_lemma ?lemma ?tipo ?pos ?uri_iperlemma ?iperlemma \
+WHERE {<" + thisUrlParams.link + "> crm:P67_refers_to ?uri_thing . \
+?uri_thing crm:P128_carries ?uri_lemma . \
+?uri_lemma rdfs:label ?lemma ; \
+crm:P2_has_type ?uri_pos . \
+?uri_pos rdfs:label ?pos . \
+OPTIONAL {?uri_thing crm:P2_has_type ?uri_type . \
+?uri_type rdfs:label ?tipo .} \
+OPTIONAL {?uri_lemma rdfs:subClassOf ?uri_iperlemma . \
+?uri_iperlemma rdfs:label ?iperlemma .} \
+}"

+ 4 - 0
js/people.js

@@ -1623,3 +1623,7 @@ function myFunction(){
     //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);
+}

+ 43 - 132
js/query/managerQuery.js

@@ -128,139 +128,50 @@ var queryManager = {
         crm:P168_place_is_defined_by ?coords . \
         ?label bif:contains <{WORD}> . \
         }"
-    }
-};
-
-/*
-$.jsonManager
-        { 
-                    connection : [
-                        queries = {
-                            prefixes : {
-                                pref : "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
-                                PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
-                                PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
-                                PREFIX owl: <http://www.w3.org/2002/07/owl#> \
-                                PREFIX schema: <http://schema.org/> \
-                                PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
-                                PREFIX person: <http://www.w3.org/ns/person#> \
-                                PREFIX time: <https://www.w3.org/TR/owl-time#> "
-                            },
-
-                            sparqlMMO : {
-                                queryLabel : " SELECT DISTINCT ?g ?subject ?label ?identifier \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
-                                ?subject rdfs:label ?label . \
-                                ?subject crm:P1_is_identified_by ?uri_identifier . \
-                                ?uri_identifier rdfs:label ?identifier ; \
-                                crm:P2_has_type 'Segnatura' . \
-                                ?label bif:contains <{WORD}> . \
-                                }",
-
-                                queryIdentificatore: " SELECT DISTINCT ?g ?subject ?label ?identifier \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
-                                ?subject rdfs:label ?label . \
-                                ?subject crm:P1_is_identified_by ?uri_identifier . \
-                                ?uri_identifier rdfs:label ?identifier ; \
-                                crm:P2_has_type 'Segnatura' . \
-                                FILTER (CONTAINS(?identifier, <{WORD}>)) \
-                                }"
-                            },
-                            sparqlINF : {
-                                queryContenuti1: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
-                                WHERE { <{GRAPH}> \
-                                GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
-                                rdfs:label ?label .} \
-                                OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
-                                OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
-                                ?id_subject rdfs:label ?id ; \
-                                rdf:type crm:E42_Identifier . } \
-                                OPTIONAL {?subject crm:P2_has_type ?type . } \
-                                ?subject ?property ?object_Label . \
-                                ?object_Label bif:contains <{WORD}> . \
-                                }",
-
-                                queryContenuti2: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
-                                WHERE { <{GRAPH}> \
-                                GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
-                                rdfs:label ?label .} \
-                                OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
-                                OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
-                                ?id_subject rdfs:label ?id ; \
-                                rdf:type crm:E42_Identifier . } \
-                                OPTIONAL {?subject crm:P2_has_type ?type . } \
-                                VALUES ?object_type {crm:E1_Entity crm:E1_CRM_Entity crm:E41_Appellation crm:E62_String} \
-                                ?subject ?property ?object  . \
-                                ?object rdfs:label ?object_Label . \
-                                ?object rdf:type ?object_type . \
-                                ?object_Label bif:contains <{WORD}> . \
-                                FILTER NOT EXISTS { ?property rdfs:label 'label' } \
-                                }",
-
-                                queryContenuti3: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
-                                rdfs:label ?label .} \
-                                OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
-                                OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
-                                ?id_subject rdfs:label ?id ; \
-                                rdf:type crm:E42_Identifier . } \
-                                OPTIONAL { \
-                                {?subject crm:P2_has_type ?type .} \
-                                UNION { \
-                                ?subject crm:P2_has_type ?uri_type . \
-                                ?uri_type rdfs:label ?type . } \
-                                } \
-                                ?subject crm:P67_refers_to ?object_uri . \
-                                ?object_uri rdfs:label ?object_Label . \
-                                ?object_Label bif:contains <{WORD}> . \
-                                }"
+    },
 
-                            },
-                            sparqlPER : {
-                                queryNome: " SELECT DISTINCT ?g AS ?graph ?subject ?name \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g { ?subject ?property ?object . } \
-                                ?subject rdf:type crm:E21_Person ; \
-                                foaf:name ?name . \
-                                ?name bif:contains <{WORD}> . \
-                                } ",
+    queryRES: {
+        queryExchange : " SELECT DISTINCT ?uri_document ?document ?time_span_from ?time_span_to ?uri_place_from ?place_from ?uri_place_to ?place_to \
+        { \
+        ?event_from rdfs:subClassOf ?event ; \
+        rdf:type crm:EL2_Send_Letter . \
+        ?event_to rdfs:subClassOf ?event ; \
+        rdf:type crm:EL3_Receive_Letter . \
+        \
+        ?event_from crm:P01_has_domain ?pc_from . \
+        ?pc_from crm:P02_has_range <{MITTENTE}> . \
+        OPTIONAL {?event_from crm:P4_has_time-span ?uri_time_span_from . \
+        ?uri_time_span_from rdfs:label ?time_span_from} \
+        OPTIONAL {?event_from crm:P27_moved_from ?aspo_place_from . \
+        ?aspo_place_from owl:sameAs ?uri_place_from . \
+        ?uri_place_from rdfs:label ?place_from ; \
+        crm:P168_place_is_defined_by ?coords_from} \
+        \
+        ?event_to crm:P01_has_domain ?pc_to . \
+        ?pc_to crm:P02_has_range <{DESTINATARIO}> . \
+        OPTIONAL {?event_to crm:P4_has_time-span ?uri_time_span_to . \
+        ?uri_time_span_to rdfs:label ?time_span_to} \
+        OPTIONAL {?event_to crm:P26_moved_to ?aspo_place_to . \
+        ?aspo_place_to owl:sameAs ?uri_place_to . \
+        ?uri_place_to rdfs:label ?place_to ; \
+        crm:P168_place_is_defined_by ?coords_to} \
+        \
+        ?uri_document crm:P25i_moved_by ?event ; \
+        rdfs:label ?document . \
+        }",
 
-                                queryNote: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?note \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g { ?subject ?property ?object . } \
-                                ?subject rdf:type crm:E21_Person ; \
-                                foaf:name ?name . \
-                                ?subject crm:P3_has_note ?note . \
-                                ?note bif:contains <{WORD}> . \
-                                }",
+        queryEsploraDocumenti : " SELECT DISTINCT ?document ?uri_document ?uri_infObj (group_concat(distinct ?type ;separator=', ') as ?types) \
+        WHERE { \
+            { ?uri_thing crm:P128_carries <{URI}> . \
+                ?uri_infObj crm:P67_refers_to ?uri_thing . \
+            } UNION { \
+                ?uri_infObj crm:P67_refers_to <{URI}> . } \
+                ?uri_document crm:P128_carries ?uri_infObj ; \
+                rdfs:label ?document . \
+                OPTIONAL {?uri_infObj crm:P2_has_type ?uri_type . \
+                    ?uri_type rdfs:label ?type . } \
+        }"
 
-                                queryOccupazione: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?occupation \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g { ?subject ?property ?object . } \
-                                ?subject rdf:type crm:E21_Person ; \
-                                foaf:name ?name . \
-                                ?subject schema:hasOccupation ?uri_occupation . \
-                                ?uri_occupation rdfs:label ?occupation . \
-                                ?occupation bif:contains <{WORD}> . \
-                                }"
-                            },
-                            sparqlLG : {
-                                queryLuoghi : " SELECT DISTINCT ?g AS ?graph ?subject ?label \
-                                WHERE {<{GRAPH}> \
-                                GRAPH ?g { ?subject ?property ?object } \
-                                ?subject rdfs:label ?label ; \
-                                rdf:type crm:E53_Place ; \
-                                crm:P168_place_is_defined_by ?coords . \
-                                ?label bif:contains <{WORD}> . \
-                                }"
-                            },
-                            endpoint : 'http://dev.restore.ovi.cnr.it:8890/sparql/',
-                        },
-                    ]
-                }
-*/
-                
+    }
+};
 

+ 56 - 26
js/results.js

@@ -1,26 +1,4 @@
-//Parametri da passare alla funzione onclick
-
-queryChoice = queryLettere;
-tipoRisorsa = "scambio epistolare";
-mittente = "Bellandi Simone di Andrea";
-uri_mittente = "http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0000806";
-destinatario = "Compagnia di Datini Francesco di Marco & co";
-uri_destinatario = "http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0001817";
-//////
-
-query = prepareQueryURL(queryChoice);
-
-response = $.ajax({
-
-    url: query,
-    dataType: "json",
-    success: function (data){
-      handle_Letters(data, mittente, uri_mittente, destinatario, uri_destinatario);
-    },
-    error: function (e) {}
-});
-
-function handle_Letters(json, mittente, uri_mittente, destinatario, uri_destinatario){
+function handle_Letters(json, mittente, destinatario){
 
 	thead = '<div class="row def_res"> \
 				<div class="col-4">Documento</div> \
@@ -69,7 +47,7 @@ function handle_Letters(json, mittente, uri_mittente, destinatario, uri_destinat
 				place_to = value['place_to']['value'];
 			}
 
-			EventsTable += '<div class="row">' +
+			EventsTable += '<div class="row res">' +
 			'<div id="' + uri_document + '" class="col-4 object">' + doc + '</div>' +
 			'<div class="col-2">' + time_span_from + '</div>' +
 			'<div class="col-2">' + time_span_to + '</div>' +
@@ -80,9 +58,61 @@ function handle_Letters(json, mittente, uri_mittente, destinatario, uri_destinat
 	});
 		
 
-		document.getElementById("results_table").innerHTML = EventsTable;
-		document.getElementById("results_title").innerHTML = "Lettere da " + mittente + " a " + destinatario;
+	document.getElementById("results_table").innerHTML = EventsTable;
+	document.getElementById("results_title").innerHTML = "Lettere da " + mittente + " a " + destinatario;
+		
+}
+
+function handleLemma(json, lemma) {
+	
+	thead = '<div class="row def_res"> \
+				<div class="col-10">Documento</div> \
+				<div class="col-2">Esplora</div> \
+			</div>';
+
+	var DocumentsTable = thead;
+
+	var i = 0;
+
+	$.each(
+		json['results']['bindings'],
+		function (index, value) {
+		  	var document = value['document']['value'];
+			var uri_document = value['uri_document']['value'];
+			var uri_info = "";
+			var type = "";
+			var object_button = "";
+		
+			if(value.hasOwnProperty('uri_infObj')) {
+				uri_info = value['uri_infObj']['value'];	
+			}
+			if(value.hasOwnProperty('types')) {
+				type = value['types']['value'];
+			}
+
+			if (type.includes("lettera")) {
+				object_button  = '<button type="button" id="' + uri_info + 
+				'" class="lettera btn btn-default" alt="opera d\'arte" title="' + document + 
+				'"><i class="fa fa-envelope"></i><p class="btn-text">Lettera</p></button>';
+			} else {
+				object_button  = '<button type="button" id="' + uri_document + 
+				'" class="object btn btn-default" alt="oggetto" title="' + document + 
+				'"><i class="fa fa-book"></i><p class="btn-text">Bene Culturale</p></button>';
+			}
+			
+
+			DocumentsTable += '<div class="row res">' +
+			'<div id="' + uri_document + '" class="col-10 object">' + document + '</div>' +
+			'<div class="col-2">' + object_button + '</div>' +
+			'</div>';
+
+			i++;
+
+	});
 		
+
+	document.getElementById("results_table").innerHTML = DocumentsTable;
+	document.getElementById("results_title").innerHTML = i + " documenti con citazione di " + lemma;
 }
 
 	/*if(pageInfo.query1){

+ 37 - 18
js/results_query.js

@@ -1,34 +1,52 @@
-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";
+//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 = {};
 window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
     thisUrlParams[key] = value;
 });
-//console.log('URL get params: ', thisUrlParams);
+console.log('URL get params: ', thisUrlParams.params);
+
+var params = thisUrlParams.params;
+const pp = params.split(";");
+var tipo = pp[0];
+
+
+prefixes = queryManager['prefixes']['all'];
+
+if (tipo=="lemma") {
+    var uri_lemma = pp[1];
+    var lemma = pp[2].replace(/%20/g, " ");;
+    queryEsplora = prefixes + (queryManager['queryRES']['queryEsploraDocumenti']).replaceAll('{URI}', uri_lemma);
+    doJsonQuery(queryEsplora).done(function(r) { handleLemma(r, lemma); });
+}
+
+if (tipo=="lettera") {
+    var uri_mittente = pp[2];
+    var uri_destinatario = pp[4];
+    var mittente = pp[1].replace(/%20/g, " ");
+    var destinatario = pp[3].replace(/%20/g, " ");
+    queryLettere = prefixes + (queryManager['queryRES']['queryExchange']).replace('{MITTENTE}', uri_mittente).replace('{DESTINATARIO}', uri_destinatario);
+    doJsonQuery(queryLettere).done(function(r) { handle_Letters(r, mittente, destinatario); });
+
+}
+
 
-// 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,
+function doJsonQuery(query) {
+	
+	queryURL = prepareQueryURL(query);
+	return $.ajax({
+		url: queryURL,
         dataType: "json",
-        success: function (data){},
-        error: function (e) {}
+		type: 'GET'
     });
-
-    return response;
-
 }
 
 // Funzioni per raccattare + stringhificare l'output
@@ -45,8 +63,9 @@ function stringifyResponse(val){
 ////////////////////
 // TESTI DELLE QUERY
 ////////////////////
+	
 
-prefixes = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
+/*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 dat: <http://datini.archiviodistato.prato.it/la-ricerca/scheda/> \
@@ -80,5 +99,5 @@ crm:P168_place_is_defined_by ?coords_to} \
 \
 ?uri_document crm:P25i_moved_by ?event ; \
 rdfs:label ?document . \
-}"
+}"*/
 

+ 2 - 2
js/word_cloud.js

@@ -99,8 +99,8 @@ function doListPersonNetwork(words){
         "<div class='item-place-person'>"+
             "<div class='item-place-person-label' id='list-" + filteredText + "'>" +
                 element['text'] +
-                "<br /><span onlick='sendLetter("+ filteredText + ", " + element['hlink'] + ", " + labelName + ", " + thisUrlParams.link +")' class='num_occ'>[Lettere inviate: " + element['sent'] + "]</span>" +
-                "<br /><span onlick='receiveLetter("+ filteredText + ", " + element['hlink'] + ", " + labelName + ", " + thisUrlParams.link +")' class='num_occ'>[Lettere ricevute: " + element['received'] + "]</span>" +
+                "<br /><span onclick='exchangeLetter(\"lettera\", \"" + labelName + "\", \""+ thisUrlParams.link + "\", \""+ filteredText + "\", \""+ element['hlink'] + "\");' class='num_occ'>[Lettere inviate: " + element['sent'] + "]</span>" +
+                "<br /><span onclick='exchangeLetter(\"lettera\", \"" + "\", \""+ element['hlink'] + "\", \""+ labelName + "\", \""+ thisUrlParams.link + "\");' class='num_occ'>[Lettere ricevute: " + element['received'] + "]</span>" +
                 "<br /><span id='tot-"+filteredText+"' class='num_occ'>[Totale corrispondenza: " + element['count'] + "]</span>" +
             "</div>" +
             "<div class='item-place-person-action'>" +

+ 17 - 4
lettera.html

@@ -272,7 +272,7 @@
 									</div>
 
 									<div class="row" id="row_pl">
-										<div class="col-12 col-sm mb-4 mb-sm-0">
+										<!--<div class="col-12 col-sm mb-4 mb-sm-0">
 											<div class="headInfo">
 												<h3>Antroponimi</h3>
 											</div>
@@ -287,13 +287,26 @@
 											<div id="col_toponimi">
 												<ul id="toponimi"></ul>
 											</div>
-										</div>
+										</div>-->
 										<div class="col-12 col-sm">
 											<div class="headInfo">
 												<h3>Lemmi</h3>
 											</div>
-											<div id="col_lemmi">
-												<ul id="lemmi"></ul>
+											<div class="res-events-table-container" id="lemmi_container">
+												<table class="inner_results">
+													<thead id="lem_thead" class="def_res">
+														<tr>
+															<th class="col-4">Lemma</th>
+															<th class="col-2">Tipo</th>
+															<th class="col-2">PoS</th>
+															<th class="col-2">Iperlemma</th>
+															<th class="col-2">Esplora</th>
+														</tr>
+													</thead>
+													<tbody id="lemmi">
+
+													</tbody>
+												</table>
 											</div>
 										</div>
 									</div>

+ 5 - 5
results.html

@@ -8,7 +8,7 @@
     <meta name="description" content="">
     <meta name="author" content="">
 
-    <title>Restore - Standard</title>
+    <title>Restore - Approfondimento</title>
 
     <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
     <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
@@ -41,7 +41,7 @@
                         <li class="nav-item">
                             <a class="nav-link" href="http://restore.ovi.cnr.it/">Progetto</a>
                         </li>
-                        <li class="nav-item">
+                        <li class="nav-item active">
                             <a class="nav-link" href="ricerca.html">Ricerca</a>
                         </li>
                         <!--<li class="nav-item">
@@ -50,7 +50,7 @@
                         <li class="nav-item">
                             <a class="nav-link" href="#">Percorsi</a>
                         </li>-->
-                        <li class="nav-item active">
+                        <li class="nav-item">
                             <a class="nav-link" href="standard.html">Standard</a>
                         </li>
                         <li class="nav-item dropdown">
@@ -88,7 +88,7 @@
                                 </div>
                             </div>
                             <div class="row box-info-container container-fluid" id="res_container">
-                                <div class="col" id="results_table">
+                                <div class="col inner_results" id="results_table">
                                    
                                 </div>
                             </div>
@@ -160,7 +160,7 @@
             </div>
         </div>
     </footer>
-
+    <script src="js\query\managerQuery.js"></script>
     <script src="js\results_query.js"></script>
     <script src="js\results.js"></script>
 

+ 9 - 3
ricerca.html

@@ -122,9 +122,15 @@
 		<section id="wb_Image1">
 			<div class="container">
 				<div id="wb_intro" class="section-small">
-					<h2>Inizia la tua ricerca</h2>
-					<p>Per iniziare, inserite una parola o un gruppo di parole nella barra di ricerca e cliccate il pulsante di avvio della ricerca. Se siete interessati solo alle risorse afferenti a una singola collezione (Archivio di Stato di Prato, Museo di Palazzo Pretorio, ecc.) potete selezionare la collezione dal menù a tendina dove di default sono selezionate "Tutte le collezioni". I risultati appariranno suddivisi in quattro blocchi, che corrispondono alla tipologia di risorsa: Oggetti Fisici, Contenuti, Persone e Luoghi. Se nessuna risorsa corrisponde ai criteri di ricerca apparirà un messaggio di errore che inviterà a cambiare i criteri di ricerca. </p>
-					<p>Verranno restituite tutte le corrispondenze della parola cercata, insieme al loro contesto, costituito dalla collezione di appartenenza e dal tipo di entità che la risorsa rappresenta. Per ogni risultato sono disponibili dei pulsanti che permettono di approfondire l'informazione sulla risorsa.
+					<h2>Avvia la ricerca</h2>
+					<p>Per avviare una ricerca è sufficiente inserire uno o più termini nella barra di ricerca e cliccare sul pulsante di avvio. 
+						La ricerca riguarderà l’intero dataset delle risorse (l’opzione inserita di default è "Tutte le collezioni"). 
+						Chi è interessato alle risorse afferenti a una singola collezione può selezionare l’opzione di interesse utilizzando i relativi menù a tendina. 
+						Al momento le collezioni presenti nel dataset sono Archivio di Stato di Prato (ASPO), Museo di Palazzo Pretorio (MPP) e Opera del Vocabolario Italiano (OVI-CNR). 
+						I risultati appariranno suddivisi in quattro blocchi: oggetti fisici, testi collegati alle risorse, protagonisti e toponimi.
+					</p>
+					<p>Per ogni risultato sono disponibili dei pulsanti che permettono di approfondire l'informazione sulla risorsa. 
+						Se nessuna risorsa corrisponde ai criteri di ricerca apparirà un messaggio di errore che inviterà a modificare i criteri di ricerca.
 					</p>
 				</div>
 			</div>