|
@@ -109,23 +109,27 @@ crm:P4_has_time-span ?uri_ts . \
|
|
|
?uri_ts rdfs:label ?time_span . } \
|
|
|
} "
|
|
|
|
|
|
-queryPersone = prefixes + " SELECT DISTINCT ?range ?label \
|
|
|
+queryPersone = prefixes + " SELECT DISTINCT ?role ?range ?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 .\
|
|
|
- ?range rdfs:label ?label .\
|
|
|
-} 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 .\
|
|
|
- ?range rdfs:label ?label .\
|
|
|
- }\
|
|
|
-}"
|
|
|
+ {?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 ?label . \
|
|
|
+} 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 ?label . \
|
|
|
+ } \
|
|
|
+} GROUP BY ?role ?range ?label"
|
|
|
|
|
|
queryCount = prefixes + " SELECT ?place ?label COUNT(?label) AS ?Count \
|
|
|
WHERE{ \
|
|
@@ -566,36 +570,65 @@ function handle_persons(json) {
|
|
|
|
|
|
console.log(json);
|
|
|
|
|
|
- const people = {};
|
|
|
-
|
|
|
- var i=0;
|
|
|
+ const people = [];
|
|
|
+ const person_names = [];
|
|
|
+ const person_events = [];
|
|
|
+ var Person = "";
|
|
|
|
|
|
$.each(
|
|
|
json['results']['bindings'],
|
|
|
function (index, value) {
|
|
|
- key = value['range']['value'];
|
|
|
- data = value['label']['value'];
|
|
|
- people[key] = data;
|
|
|
- i++;
|
|
|
+ var uri = value['range']['value'];
|
|
|
+ var label = value['label']['value'];
|
|
|
+ var ruolo = value['role']['value']
|
|
|
+ var count = value['count']['value']
|
|
|
+ var evento = ruolo + ": " + count
|
|
|
+ person_events.push([uri, label, evento]);
|
|
|
+ if (!person_names.includes(uri)) {
|
|
|
+ person_names.push([uri, label]);
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
|
|
|
- var myArray = "";
|
|
|
-
|
|
|
- for (var key in people) {
|
|
|
- myArray += "<div class='row res'><div class='col-10'>" + people[key] + "</div><div class='col d-flex align-items-center justify-content-end'><div class='persona' id='" +
|
|
|
- key + "'><i class='fa fa-user' style='cursor: pointer'></i></div></div></div>";
|
|
|
+ for (var k=0; k<person_names.length; k++) {
|
|
|
+ const tempArray = [];
|
|
|
+ var uri = person_names[k][0];
|
|
|
+ var nome = person_names[k][1]
|
|
|
+ tempArray.push(uri);
|
|
|
+ tempArray.push(nome);
|
|
|
+ for (var y=0; y<person_events.length; y++) {
|
|
|
+ var ev = person_events[y][2];
|
|
|
+ if (person_names[k][0] == person_events[y][0]) {
|
|
|
+ tempArray.push(ev);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ people.push(tempArray);
|
|
|
}
|
|
|
|
|
|
+ for (var i=0; i<people.length; i++) {
|
|
|
+
|
|
|
+ var info = "";
|
|
|
+ for (var h=2; h<people[i].length; h++) {
|
|
|
+ info += people[i][h] + ' occorrenze<br />';
|
|
|
+ }
|
|
|
+
|
|
|
+ Person += '<div class="row res"><div class="col-8">' +
|
|
|
+ '<a href=' + people[i][0] + ' target="_blank">' + people[i][1] + '</a><br />' + info + '</div>' +
|
|
|
+ '<div class="col d-flex align-items-start justify-content-end"><button type="button" id="' + people[i][0] + '" class="persona btn btn-default" alt="persona" title="' +
|
|
|
+ people[i][1] + '"><i class="fa fa-user"></i><p class="btn-text">Scheda Persona</p></button>' +
|
|
|
+ '<button type="button" id="' + people[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
|
|
|
+ /*DA QUI HYPERLINK ->*/'<button type="button" id="' + people[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
|
|
|
+ /*DA QUI LOD ->*/'<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + people[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
|
|
|
+ }
|
|
|
|
|
|
- document.getElementById("n_per").innerHTML = i;
|
|
|
- document.getElementById("object_per").innerHTML = myArray;
|
|
|
+ document.getElementById("n_per").innerHTML = people.length;
|
|
|
+ document.getElementById("object_per").innerHTML = Person;
|
|
|
|
|
|
- if (i==0) {
|
|
|
+ if (people.length==0) {
|
|
|
var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
|
|
|
document.getElementById("object_per").innerHTML = messaggio;
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
function handle_count(json) {
|
|
|
console.log(json);
|