|
@@ -28,6 +28,9 @@ $(document).ready(function () {
|
|
|
}
|
|
|
|
|
|
var search_name = "";
|
|
|
+ var Label = "";
|
|
|
+ var object_Label = "";
|
|
|
+ var id_label = "";
|
|
|
var testo = "";
|
|
|
|
|
|
function results_retrieveData() {
|
|
@@ -38,6 +41,17 @@ $(document).ready(function () {
|
|
|
|
|
|
search_name = testo;
|
|
|
|
|
|
+ if (testo != "") {
|
|
|
+ Label = " ?label bif:contains \"\' "+ search_name + " \'\" . ";
|
|
|
+ object_Label = " ?object_Label bif:contains \"\' "+ search_name + " \'\" . ";
|
|
|
+ id_label = " ?id bif:contains \"\' "+ search_name + " \'\" . ";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Label = "";
|
|
|
+ object_Label = "";
|
|
|
+ id_label = "";
|
|
|
+ }
|
|
|
+
|
|
|
var g = document.getElementById("graph_selector");
|
|
|
var graph = g.value;
|
|
|
|
|
@@ -61,13 +75,11 @@ $(document).ready(function () {
|
|
|
OPTIONAL {?subject crm:P2_has_type ?type } \
|
|
|
OPTIONAL {?subject crm:P1_is_identified_by ?uri_id . \
|
|
|
?uri_id rdfs:label ?id . } \
|
|
|
- {?subject rdfs:label ?label . \
|
|
|
- ?label bif:contains \"\' "+ search_name + " \'\" . \
|
|
|
+ {?subject rdfs:label ?label . " + Label + "\
|
|
|
} UNION { \
|
|
|
?subject crm:P1_is_identified_by ?uri_id ; \
|
|
|
rdfs:label ?label . \
|
|
|
- ?uri_id rdfs:label ?id . \
|
|
|
- ?id bif:contains \"\' "+ search_name + " \'\" } \
|
|
|
+ ?uri_id rdfs:label ?id . " + id_label + " } \
|
|
|
} ORDER BY ?types"
|
|
|
|
|
|
queryInfObj = prefixes + " SELECT DISTINCT "+ search_graph +" AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
|
|
@@ -80,14 +92,12 @@ $(document).ready(function () {
|
|
|
rdf:type crm:E42_Identifier . } \
|
|
|
OPTIONAL {?subject crm:P2_has_type ?entity_type . \
|
|
|
?entity_type rdfs:label ?type .} \
|
|
|
- {?subject ?property ?object_Label . \
|
|
|
- ?object_Label bif:contains \"\' "+ search_name + " \'\" . \
|
|
|
+ {?subject ?property ?object_Label . " + object_Label + " \
|
|
|
} UNION { \
|
|
|
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 \"\' "+ search_name + " \'\" . \
|
|
|
+ ?object rdf:type ?object_type . " + object_Label + " \
|
|
|
} \
|
|
|
FILTER NOT EXISTS { ?property rdfs:label 'label' } \
|
|
|
} ORDER BY ?id ?types"
|
|
@@ -96,21 +106,18 @@ $(document).ready(function () {
|
|
|
WHERE {GRAPH "+ search_graph +" { ?subject ?property ?object } \
|
|
|
?subject rdfs:label ?label; \
|
|
|
rdf:type crm:E21_Person ; \
|
|
|
- foaf:name ?name . \
|
|
|
- ?label bif:contains \"\' "+ search_name + " \'\" . \
|
|
|
+ foaf:name ?name . " + Label + " \
|
|
|
}"
|
|
|
|
|
|
queryPlace = prefixes + " SELECT DISTINCT "+ search_graph +" AS ?graph ?subject ?label \
|
|
|
WHERE {GRAPH "+ search_graph +" { ?subject ?property ?object } \
|
|
|
{?subject rdfs:label ?label ; \
|
|
|
rdf:type crm:E53_Place ; \
|
|
|
- crm:P168_place_is_defined_by ?coords . \
|
|
|
- ?label bif:contains \"\' "+ search_name + " \'\" . \
|
|
|
+ crm:P168_place_is_defined_by ?coords . " + Label + " \
|
|
|
} UNION { \
|
|
|
?subject crm:P1_is_identified_by ?toponimo . \
|
|
|
?toponimo crm:P2_has_type 'Toponimo' ; \
|
|
|
- rdfs:label ?label . \
|
|
|
- ?label bif:contains \"\' "+ search_name + " \'\" . \
|
|
|
+ rdfs:label ?label . " + Label + " \
|
|
|
} \
|
|
|
}"
|
|
|
|
|
@@ -309,100 +316,101 @@ $(document).ready(function () {
|
|
|
var tipo = "";
|
|
|
var id = "";
|
|
|
var infObject_button = "";
|
|
|
-
|
|
|
- var myString = value['text']['value'];
|
|
|
- var str = myString.replace(/<[^>]*>?/gm, '');
|
|
|
- let string_text = str.toLowerCase();
|
|
|
- let string_len = str.length;
|
|
|
- var word = testo;
|
|
|
- let ind = string_text.indexOf(word);
|
|
|
- let length = word.length;
|
|
|
- var wl = ind + length;
|
|
|
- /*var start = 0;
|
|
|
- var end = 0
|
|
|
-
|
|
|
- var bb = pp - 50;
|
|
|
- var ee = pp + length + 150;*/
|
|
|
-
|
|
|
- var pp = ind;
|
|
|
- before = str.substring(0, ind);
|
|
|
- after = str.substring(wl, string_len);
|
|
|
-
|
|
|
- let bb = before.lastIndexOf(".");
|
|
|
- let point = bb + pp;
|
|
|
- let ee = str.indexOf(".", point);
|
|
|
-
|
|
|
- console.log(bb, ee);
|
|
|
-
|
|
|
- if (bb < 0) {
|
|
|
- start = 0;
|
|
|
- } else {
|
|
|
- start = bb+1;
|
|
|
- }
|
|
|
-
|
|
|
- if (ee < 0) {
|
|
|
- end = string_len;
|
|
|
- } else {
|
|
|
- end = ee;
|
|
|
- }
|
|
|
-
|
|
|
- console.log(start, bb, end, ee);
|
|
|
-
|
|
|
-
|
|
|
- /*if (bb<=0) {
|
|
|
+ if (value['text']['type'] != 'uri') {
|
|
|
+ var myString = value['text']['value'];
|
|
|
+ var str = myString.replace(/<[^>]*>?/gm, '');
|
|
|
+ let string_text = str.toLowerCase();
|
|
|
+ let string_len = str.length;
|
|
|
+ var word = testo;
|
|
|
+ let ind = string_text.indexOf(word);
|
|
|
+ let length = word.length;
|
|
|
+ var wl = ind + length;
|
|
|
+ /*var start = 0;
|
|
|
+ var end = 0
|
|
|
+
|
|
|
+ var bb = pp - 50;
|
|
|
+ var ee = pp + length + 150;*/
|
|
|
+
|
|
|
+ var pp = ind;
|
|
|
+ before = str.substring(0, ind);
|
|
|
+ after = str.substring(wl, string_len);
|
|
|
+
|
|
|
+ let bb = before.lastIndexOf(".");
|
|
|
+ let point = bb + pp;
|
|
|
+ let ee = str.indexOf(".", point);
|
|
|
+
|
|
|
+ console.log(bb, ee);
|
|
|
+
|
|
|
+ if (bb < 0) {
|
|
|
start = 0;
|
|
|
- } else {
|
|
|
- start = bb;
|
|
|
- }
|
|
|
-
|
|
|
+ } else {
|
|
|
+ start = bb+1;
|
|
|
+ }
|
|
|
|
|
|
- if (ee>=string_len) {
|
|
|
+ if (ee < 0) {
|
|
|
end = string_len;
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
end = ee;
|
|
|
- }*/
|
|
|
-
|
|
|
- first_chunk = str.substring(start, ind);
|
|
|
- highlight = str.substring(ind, wl);
|
|
|
- second_chunk = str.substring(wl, end);
|
|
|
-
|
|
|
- var snippet = first_chunk + "<span class='sharp'>" + highlight + "</span>" + second_chunk ;
|
|
|
+ }
|
|
|
|
|
|
- console.log(snippet);
|
|
|
+ console.log(start, bb, end, ee);
|
|
|
+
|
|
|
|
|
|
- if (value.hasOwnProperty('types')) {
|
|
|
- tipo = value['types']['value'];
|
|
|
+ /*if (bb<=0) {
|
|
|
+ start = 0;
|
|
|
+ } else {
|
|
|
+ start = bb;
|
|
|
}
|
|
|
|
|
|
- if (value.hasOwnProperty('id')) {
|
|
|
- id = " (" + value['id']['value'] + ")";
|
|
|
+
|
|
|
+ if (ee>=string_len) {
|
|
|
+ end = string_len;
|
|
|
+ } else {
|
|
|
+ end = ee;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ first_chunk = str.substring(start, ind);
|
|
|
+ highlight = str.substring(ind, wl);
|
|
|
+ second_chunk = str.substring(wl, end);
|
|
|
+
|
|
|
+ var snippet = first_chunk + "<span class='sharp'>" + highlight + "</span>" + second_chunk ;
|
|
|
+
|
|
|
+ console.log(snippet);
|
|
|
+
|
|
|
+ if (value.hasOwnProperty('types')) {
|
|
|
+ tipo = value['types']['value'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (value.hasOwnProperty('id')) {
|
|
|
+ id = " (" + value['id']['value'] + ")";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tipo.includes("lettera")) {
|
|
|
+ infObject_button += '<button type="button" id="' + value['subject']['value'] +
|
|
|
+ '" class="lettera btn btn-default" alt="lettera" title="' + value['label']['value'] +
|
|
|
+ '"><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
|
|
|
+ } else {
|
|
|
+ infObject_button += '<button type="button" id="' + value['Physical_Object']['value'] +
|
|
|
+ '" class="object btn btn-default" alt="oggetto" title="' + value['label']['value'] +
|
|
|
+ '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
|
|
|
}
|
|
|
-
|
|
|
- if (tipo.includes("lettera")) {
|
|
|
- infObject_button += '<button type="button" id="' + value['subject']['value'] +
|
|
|
- '" class="lettera btn btn-default" alt="lettera" title="' + value['label']['value'] +
|
|
|
- '"><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
|
|
|
- } else {
|
|
|
- infObject_button += '<button type="button" id="' + value['Physical_Object']['value'] +
|
|
|
- '" class="object btn btn-default" alt="oggetto" title="' + value['label']['value'] +
|
|
|
- '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
|
|
|
- }
|
|
|
|
|
|
|
|
|
- information += /*INIZIO DIV*/ '<div class="row res"><div class="col-8"><p>'+ snippet+'</p>' +
|
|
|
- 'In: ' + graph_name + ';<br />' +
|
|
|
- '<a href=' + value['subject']['value'] + ' target="_blank">' + value['label']['value'] + id +
|
|
|
- '</a>;<br /><i>' + tipo + '</i><br /></div>' +
|
|
|
- '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
|
|
|
- '<button type="button" id="' + value['subject']['value'] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
|
|
|
- /*DA QUI HYPERLINK ->*/'<button type="button" id="' + value['subject']['value'] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
|
|
|
- /*DA QUI LOD ->*/'<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + value['subject']['value'] + '" 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>';
|
|
|
+ information += /*INIZIO DIV*/ '<div class="row res"><div class="col-8"><p>'+ snippet+'</p>' +
|
|
|
+ 'In: ' + graph_name + ';<br />' +
|
|
|
+ '<a href=' + value['subject']['value'] + ' target="_blank">' + value['label']['value'] + id +
|
|
|
+ '</a>;<br /><i>' + tipo + '</i><br /></div>' +
|
|
|
+ '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
|
|
|
+ '<button type="button" id="' + value['subject']['value'] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
|
|
|
+ /*DA QUI HYPERLINK ->*/'<button type="button" id="' + value['subject']['value'] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
|
|
|
+ /*DA QUI LOD ->*/'<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + value['subject']['value'] + '" 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>';
|
|
|
|
|
|
- i++;
|
|
|
+ i++;
|
|
|
|
|
|
- /*onclick=copy__Text("' + value['link']['value'] + '")*/
|
|
|
+ /*onclick=copy__Text("' + value['link']['value'] + '")*/
|
|
|
|
|
|
- $('#Information_Object').append(information);
|
|
|
+ $('#Information_Object').append(information);
|
|
|
+ }
|
|
|
|
|
|
});
|
|
|
|