|
@@ -1,149 +0,0 @@
|
|
|
-$(document).ready(function () {
|
|
|
|
|
- //#######################################
|
|
|
|
|
-
|
|
|
|
|
- const graphArray = [
|
|
|
|
|
- ["ASPO - Datini", "http://dev.restore.ovi.cnr.it:8890/aspo/datini"],
|
|
|
|
|
- ["ASPO - Ospedale", "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale"],
|
|
|
|
|
- ["ASPO - Marcovaldi", "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi"],
|
|
|
|
|
- ["ASPO - Gettatelli", "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli"],
|
|
|
|
|
- ["ASPO - Autori ASPO", "http://dev.restore.ovi.cnr.it:8890/aspo/actors"],
|
|
|
|
|
- ["MPP - Collezione Martini", "http://dev.restore.ovi.cnr.it:8890/mpp/martini"],
|
|
|
|
|
- ["MPP - Collezione Ospedale", "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale"],
|
|
|
|
|
- ["MPP - Collezione Datini", "http://dev.restore.ovi.cnr.it:8890/mpp/datini"],
|
|
|
|
|
- ["MPP - Autori MPP", "http://dev.restore.ovi.cnr.it:8890/mpp/authors"]
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- var graph_selector = document.getElementById("graph_selector");
|
|
|
|
|
-
|
|
|
|
|
- let x = graphArray.length;
|
|
|
|
|
-
|
|
|
|
|
- for(var i=0; i<x; i++) {
|
|
|
|
|
- var opt = document.createElement("option");
|
|
|
|
|
- opt.value= graphArray[i][1];
|
|
|
|
|
- opt.innerHTML = graphArray[i][0]; // whatever property it has
|
|
|
|
|
-
|
|
|
|
|
- // then append it to the select element
|
|
|
|
|
- graph_selector.add(opt);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const entityArray = [
|
|
|
|
|
- ["Oggetti fisici", "http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object"],
|
|
|
|
|
- ["Persone", "http://www.cidoc-crm.org/cidoc-crm/E21_Person"],
|
|
|
|
|
- ["Luoghi", "http://www.cidoc-crm.org/cidoc-crm/E53_Place"]
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- var entity_selector = document.getElementById("entity_selector");
|
|
|
|
|
-
|
|
|
|
|
- let y = entityArray.length;
|
|
|
|
|
-
|
|
|
|
|
- for(var i=0; i<y; i++) {
|
|
|
|
|
- var opt = document.createElement("option");
|
|
|
|
|
- opt.value= entityArray[i][1];
|
|
|
|
|
- opt.innerHTML = entityArray[i][0]; // whatever property it has
|
|
|
|
|
-
|
|
|
|
|
- // then append it to the select element
|
|
|
|
|
- entity_selector.add(opt);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- var search_name = "";
|
|
|
|
|
- var testo = "";
|
|
|
|
|
-
|
|
|
|
|
- function autori_retrieveData() {
|
|
|
|
|
-
|
|
|
|
|
- search_name = testo;
|
|
|
|
|
-
|
|
|
|
|
- var g = document.getElementById("graph_selector");
|
|
|
|
|
- var graph = g.value;
|
|
|
|
|
-
|
|
|
|
|
- var search_graph = "";
|
|
|
|
|
-
|
|
|
|
|
- if (graph != "") {
|
|
|
|
|
- search_graph = '<' + graph + '>';
|
|
|
|
|
- } else {
|
|
|
|
|
- search_graph = '?g';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- var e = document.getElementById("entity_selector");
|
|
|
|
|
- var entity = e.value;
|
|
|
|
|
-
|
|
|
|
|
- var search_entity = "";
|
|
|
|
|
-
|
|
|
|
|
- if (entity != "") {
|
|
|
|
|
- search_entity = '<' + entity + '>';
|
|
|
|
|
- } else {
|
|
|
|
|
- search_entity = '?type';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //var query='SELECT DISTINCT ?nome WHERE { ?autore <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.cidoc-crm.org/cidoc-crm/E39_Actor> . ?autore <http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by> ?nomeid. ?nomeid <http://www.w3.org/2000/01/rdf-schema#label> ?nome . FILTER regex(?nome, "'+ search_name +'") }' ;
|
|
|
|
|
-
|
|
|
|
|
- query = 'SELECT DISTINCT '+ search_graph +' AS ?graph ?link ?label ?entity WHERE { GRAPH '+ search_graph +' { ?link <http://www.w3.org/2000/01/rdf-schema#label> ?label ; <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> '+ search_entity +' . ?label bif:contains "'+ search_name +'" .} '+ search_entity +' <http://www.w3.org/2000/01/rdf-schema#label> ?entity . FILTER (langMatches( lang(?entity), "en" )) }';
|
|
|
|
|
- //query = 'select distinct ?nome ?link where {?link <http://www.w3.org/2000/01/rdf-schema#label> ?nome . ?nome bif:contains "'+ search_name +'"}'
|
|
|
|
|
-
|
|
|
|
|
- //query = 'select distinct ?nome where {?nome <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.cidoc-crm.org/cidoc-crm/E39_Actor> FILTER regex(?nome, "'+ search_name +'")}';
|
|
|
|
|
-
|
|
|
|
|
- entity = '';
|
|
|
|
|
-
|
|
|
|
|
- graph = '';
|
|
|
|
|
-
|
|
|
|
|
- var autori_url = 'http://dev.restore.ovi.cnr.it:8890/sparql/?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json';
|
|
|
|
|
-
|
|
|
|
|
- $.ajax({
|
|
|
|
|
-
|
|
|
|
|
- url: autori_url + '&callback=?',
|
|
|
|
|
- dataType: "json",
|
|
|
|
|
- success: function (data) {
|
|
|
|
|
- autori_handle_json(data);
|
|
|
|
|
- },
|
|
|
|
|
- error: function (e) {}
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function autori_handle_json(json) {
|
|
|
|
|
-
|
|
|
|
|
- console.log(json);
|
|
|
|
|
-
|
|
|
|
|
- $('#wb_Shape1').text("");
|
|
|
|
|
-
|
|
|
|
|
- $.each(
|
|
|
|
|
- json['results']['bindings'],
|
|
|
|
|
- function (index, value) {
|
|
|
|
|
- var autore = "";
|
|
|
|
|
- autore += /*INIZIO DIV*/ '<tr><td>' /*DA QUA AUTORE ->*/ +
|
|
|
|
|
- '<div style="width:100%; height:auto; border:transparent;">' + value['graph']['value'] + '<br /><a href="' + value['link']['value'] + '" target="_blank">' + value['label']['value'] + '</a>' + '<br />' + value['entity']['value'] + '</td><td>' +
|
|
|
|
|
- /*DA QUI SCHEDA ->*/'<button type="button" id="scheda ' + value['link']['value'] + '"class="btn btn-default info" alt="scheda" title="Info"><i class="fa fa-bars"></i><p class="btn-text">Scheda</p></button>' + '</td><td>' +
|
|
|
|
|
- /*DA QUI CITAZIONE ->*/'<button type="button" id="cit ' + value['link']['value'] + '"class="btn btn-default info" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' + '</td><td>' +
|
|
|
|
|
- /*DA QUI HYPERLINK ->*/'<button type="button" id="hyp ' + value['link']['value'] + '"class="btn btn-default info" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' + '</td><td>' +
|
|
|
|
|
- /*DA QUI LOD ->*/'<button type="button" id="lod ' + value['link']['value'] + '"class="btn btn-default info" alt="scheda" title="Info"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button>' +
|
|
|
|
|
- '</td></tr>';/*FINE DIV*/
|
|
|
|
|
-
|
|
|
|
|
- $('#wb_Shape1').append(autore);
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $('#ClipArt1').click(function () {
|
|
|
|
|
- testo = $('textarea#TextArea1').val();
|
|
|
|
|
- autori_retrieveData();
|
|
|
|
|
- search_name = "";
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- //VISUALIZZAZIONI DATI DELL'AUTORE
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //FUNZIONE LETTURA LUNGHEZZA FILE JSON
|
|
|
|
|
- /*
|
|
|
|
|
- function objLength(obj){
|
|
|
|
|
- var i=0;
|
|
|
|
|
- for (var x in obj){
|
|
|
|
|
- if(obj.hasOwnProperty(x)){
|
|
|
|
|
- i++;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return i;
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- //#######################################
|
|
|
|
|
-});
|
|
|