123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893 |
- /*var final_transcript = '';
- var recognizing = false;*/
- var Parole = "";
- /*if ('webkitSpeechRecognition' in window) {
- var recognition = new webkitSpeechRecognition();
- recognition.continuous = false;
- recognition.interimResults = true;
- recognition.onstart = function () {
- recognizing = true;
- };
- recognition.onerror = function (event) {
- console.log(event.error);
- };
- recognition.onend = function () {
- recognizing = false;
- };
- recognition.onresult = function (event) {
- var interim_transcript = '';
- for (var i = event.resultIndex; i < event.results.length; ++i) {
- if (event.results[i].isFinal) {
- final_transcript += event.results[i][0].transcript;
- Parole = final_transcript;
- console.log(Parole);
- setTimeout(function () {
- $("#ClipArt1" ).click();
- }, 3000);
- } else {
- interim_transcript += event.results[i][0].transcript;
- }
- }
- final_transcript = capitalize(final_transcript);
- final_span.innerHTML = linebreak(final_transcript);
- TextArea1.value = linebreak(final_transcript);
- interim_span.innerHTML = linebreak(interim_transcript);
- };
- }
- var two_line = /\n\n/g;
- var one_line = /\n/g;
- function linebreak(s) {
- return s.replace(two_line, '<p></p>').replace(one_line, '<br>');
- }
- function capitalize(s) {
- return s.replace(s.substr(0, 1), function (m) {
- return m.toUpperCase();
- });
- }
- function startDictation(event) {
- if (recognizing) {
- recognition.stop();
- return;
- }
- final_transcript = '';
- recognition.lang = 'it-it';
- recognition.start();
- final_span.innerHTML = '';
- TextArea1.value = '';
- interim_span.innerHTML = '';
- }*/
- let mmoQueries = 0;
- let infQueries = 0;
- let perQueries = 0;
- let lgQueries = 0;
- $(document).ready(function () {
- //#######################################
- populateOption();
- var search_name = "";
- var Label = "";
- var object_Label = "";
- var id_label = "";
- var name_per = "";
- var note_per = "";
- var occupation_per = "";
- var place_search = "";
- var testo = "";
- $('#ClipArt1').on("click", function () {
- $('#Man-Made_Object').text("");
- $('#n_mmo').text("0");
- $('#Information_Object').text("");
- $('#n_io').text("0");
- $('#Person').text("");
- $('#n_ps').text("0");
- $('#Place').text("");
- $('#n_pl').text("0");
- $('#licenza').css("display", "block");
- testo = $('input#TextArea1').val();
- console.log(testo);
- Parole = testo;
-
- //questo era il contenuto di results_retrieveData()
- mmoQueries = 0;
- infQueries = 0;
- perQueries = 0;
- lgQueries = 0;
- $("#mmoLoader").css("display", "block");
- $("#infLoader").css("display", "block");
- $("#perLoader").css("display", "block");
- $("#lgLoader").css("display", "block");
- $('#wb_Image1').text("");
- $('.results').css("display", "none");
- next_text = testo.split(" ");
- search_name = "\"'" + next_text[0] + "'";
- if (next_text.length > 1) {
- for (var i=1; i<next_text.length; i++) {
- search_name = search_name + " AND '" + next_text[i] + "'";
- }
- }
- search_name = search_name + "\"";
- if (testo != "") {
- Label = " ?label bif:contains "+ search_name + " . ";
- object_Label = " ?object_Label bif:contains "+ search_name + " . ";
- id_label = " ?id bif:contains "+ search_name + " . ";
- name_per = "?name bif:contains "+ search_name + " . ";
- note_per = " ?note bif:contains " + search_name + " . ";
- occupation_per = " ?occupation bif:contains " + search_name + " . ";
- place_search = " ?label bif:contains" + search_name + " . ";
- }
- else {
- Label = "";
- object_Label = "";
- id_label = "";
- name_per = "";
- note_per = " ?note bif:contains 'NNNNNN' . ";;
- place_search = "";
- occupation_per = " ?occupation bif:contains 'NNNNN' . ";;
- }
- var g = document.getElementById("graph_selector");
- var g2 = document.getElementById("graph_selector2");
- var graph1 = g.value;
- var graph2 = g2.value;
- if (graph1 == 'MPP') {
- object_Label = " ?object_Label bif:contains 'NNNNNNNN' . ";
- }
- var search_graph = getGraph(graph1, graph2);
- var pref = queryManager['prefixes']['all'];
- var query1 = pref + (queryManager['queryMMO']['queryLabel']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', Label);
- var query2 = pref + (queryManager['queryMMO']['queryArte']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', Label);
- var query3 = pref + (queryManager['queryMMO']['queryIdentificatore']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', testo);
- var query4 = pref + (queryManager['queryINF']['queryContenuti1']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', object_Label);
- var query5 = pref + (queryManager['queryINF']['queryContenuti2']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', object_Label);
- var query6 = pref + (queryManager['queryINF']['queryContenuti3']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', object_Label);
- var query7 = pref + (queryManager['queryPER']['queryNome']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', name_per);
- var query8 = pref + (queryManager['queryPER']['queryNote']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', note_per);
- var query9 = pref + (queryManager['queryPER']['queryOccupazione']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', occupation_per);
- var query10 = pref + (queryManager['queryLG']['queryLuoghi']).replace('<{GRAPH}>', search_graph).replace('<{WORD}>', place_search);
-
-
- // la funzione doJsonQuery restituisce direttamente l'oggetto della chiamata ajax in json.
- // Una volta effettuata la chiamata, il risultato è passato alla funzione manage...
- doJsonQuery(query1).done(function(r) { manageMMO(r); });
- doJsonQuery(query2).done(function(r) { manageMMO(r); });
- doJsonQuery(query3).done(function(r) { manageMMO(r); });
- doJsonQuery(query4).done(function(r) { manageINF(r); });
- doJsonQuery(query5).done(function(r) { manageINF(r); });
- doJsonQuery(query6).done(function(r) { manageINF(r); });
- doJsonQuery(query7).done(function(r) { managePER(r); });
- doJsonQuery(query8).done(function(r) { managePER(r); });
- doJsonQuery(query9).done(function(r) { managePER(r); });
- doJsonQuery(query10).done(function(r) { manageLG(r); });
-
- });
-
-
- $('input#TextArea1').keypress(function(e) {
- var key = e.which;
- if (key == 13) // the enter key code
- {
- $('#ClipArt1').click();
- return false;
- }
- });
- });
- function checkEmpty() {
- if ($("#Man-Made_Object").is(':empty')) {
- var message = '<p class="no-results">Nessun <span>Oggetto Fisico</span> trovato</p>';
- $('#Man-Made_Object').append(message);
- }
-
- if ($("#Information_Object").is(':empty')) {
- var message = '<p class="no-results">Nessun <span>Oggetto Informativo</span> trovato</p>';
- $('#Information_Object').append(message);
- }
-
- if ($("#Person").is(':empty')) {
- var message = '<p class="no-results">Nessuna <span>Persona</span> trovata</p>';
- $('#Person').append(message);
- }
-
- if ($("#Place").is(':empty')) {
- var message = '<p class="no-results">Nessun <span>Luogo</span> trovato</p>';
- $('#Place').append(message);
- }
- }
- function rewrite_graph(graph) {
- var graph_name = ""
- if (graph == "http://147.213.76.182:8890/aspo/datini") {
- graph_name = "Archivio di Stato di Prato - Fondo Datini";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/ospedale") {
- graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/marcovaldi") {
- graph_name = "Archivio di Stato di Prato - Fondo Marcolvaldi";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/gettatelli") {
- graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/actors") {
- graph_name = "Archivio di Stato di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/martini") {
- graph_name = "Museo di Palazzo Pretorio di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/ospedale") {
- graph_name = "Museo di Palazzo Pretorio di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/datini") {
- graph_name = "Museo di Palazzo Pretorio di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/authors") {
- graph_name = "Museo di Palazzo Pretorio di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/ovi/datini") {
- graph_name = "Opera del Vocabolario Italiano";
- }
- else if (graph == "http://147.213.76.182:8890/ovi/datini/trascr") {
- graph_name = "Opera del Vocabolario Italiano";
- }
- else if (graph == "http://147.213.76.182:8890/places") {
- graph_name = "Luoghi";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/places") {
- graph_name = "Museo di Palazzo Pretorio di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/label/toponimi") {
- graph_name = "Toponimi Archivio di Stato di Prato";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/onomastica") {
- graph_name = "Archivio di Stato di Prato - Onomatica Datini";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/gettatelli/newdataset") {
- graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/onomastica/gruppi") {
- graph_name = "Archivio di Stato di Prato - Onomastica Datini";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/autori") {
- graph_name = "Museo di Palazzo Pretorio";
- }
- else if (graph == "http://147.213.76.182:8890/aspo/onomastica/datini") {
- graph_name = "Archivio di Stato di Prato - Onomastica Datini";
- }
- else if (graph == "http://147.213.76.182:8890/onomastica/ospedale") {
- graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce";
- }
- else if (graph == "http://147.213.76.182:8890/mpp/ulan/viaf") {
- graph_name = "Persone";
- }
- else if (graph == "http://147.213.76.182:8890/places/microtoponimi") {
- graph_name = "Luoghi";
- }
- else {graph_name = graph;
- }
- return graph_name;
- }
- function MMO_handle_json(json) {
- // console.log(json);
- mmoQueries = mmoQueries+1;
- if(mmoQueries==3){
- $('#mmoLoader').css("display", "none");
- }
- $('#wb_Shape1').text("");
- $(".results").css("display", "block");
- var n_mmo = $('#n_mmo').text();
- var b = parseInt(n_mmo);
- var i = 0;
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var object = ""; /*Inserisci VALUE TIPOLOGIA*/
- var graph = value['graph']['value'];
- var graph_name = rewrite_graph(graph);
- var mmoType = "";
- var mmoId = "";
- var object_button = "";
- var object_type = "";
- if (value.hasOwnProperty('type')) {
- mmoType = value['type']['value'];
- }
- if (value.hasOwnProperty('identifier')) {
- mmoId = value['identifier']['value'];
- }
-
- if (mmoType.includes("Opera d'Arte")) {
- object_type = "artwork";
- object_button += '<button type="button" id="' + value['subject']['value'] +
- '" class="artwork btn btn-default" alt="opera d\'arte" title="' + value['label']['value'] +
- '"><i class="fas fa-paint-brush"></i><p class="btn-text">Scheda Opera d\'Arte</p></button>';
- } else {
- object_type = "object";
- object_button += '<button type="button" id="' + value['subject']['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>';
- }
- object += /*INIZIO DIV*/ '<div class="row res"><div class="col-8">' + graph_name + '<br />' +
- '<span id="' + value['subject']['value'] + '" class="title_doc ' + object_type +'">' + value['label']['value'] + '</span><br />' +
- '<i>' + mmoType + ' ' + mmoId + '</i></div>' +
- '<div class="col d-flex align-items-start justify-content-end">' + object_button +
- '<button type="button" value="' + object_type + '" 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" value="' + object_type + '" 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://147.213.76.182/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++;
- /*onclick=copy__Text("' + value['link']['value'] + '")*/
- $('#Man-Made_Object').append(object);
- });
-
- var n_oggetto = b + i;
- $('#n_mmo').text("");
- $('#n_mmo').append(n_oggetto);
- if (n_oggetto == 0) {
- $('#Man-Made_Object').text("");
- var message = '<p id="no_mmo" class="no-results">Nessun <span>Oggetto Fisico</span> trovato</p>';
- $('#Man-Made_Object').append(message);
- } else {
- $('#no_mmo').remove("");
- }
- }
- function InfObj_handle_json(json) {
- // console.log(json);
- infQueries = infQueries+1;
- if(infQueries==3){
- $('#infLoader').css("display", "none");
- }
- var n_io = $('#n_io').text();
- var b = parseInt(n_io);
- var i = 0;
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var information = ""; /*Inserisci VALUE TIPOLOGIA*/
- var graph = value['graph']['value'];
- var graph_name = rewrite_graph(graph);
- var tipo = "";
- var id = "";
- var infObject_button = "";
- 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 = Parole;
- let ind = string_text.indexOf(word);
- let length = word.length;
- var wl = ind + length;
- var resource_type = "";
- var link_type = "";
- /*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);
-
- if (bb < 0) {
- start = 0;
- } else {
- start = bb+1;
- }
- if (ee < 0) {
- 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 + highlight + second_chunk ;
- //var snippet = first_chunk + "<span class='sharp'>" + highlight + "</span>" + second_chunk ;
- if (value.hasOwnProperty('types')) {
- tipo = value['types']['value'];
- }
- if (value.hasOwnProperty('id')) {
- id = " (" + value['id']['value'] + ")";
- }
-
- if (tipo.includes("lettera")) {
- link_name = value['subject']['value'];
- resource_type = "lettera";
- link_type = "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 {
- link_name = value['Physical_Object']['value'];
- resource_type = "object";
- link_type = "object";
- 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>';
- }
- //'<div class="row res"><div class="col-8"><p>' + graph_name + '<br />' +
- //'<span id="' + value['subject']['value'] + '" class="title_doc luogo">' + value['label']['value'] + '</span></p></div>'
- information += /*INIZIO DIV*/ '<div class="row res"><div class="col-8"><p>'+ snippet+'</p>' +
- 'In: ' + graph_name + ';<br />' +
- '<span id="' + link_name + '" class="title_doc ' + link_type + '">' + value['label']['value'] + id +
- '</span>;<br /><i>' + tipo + '</i><br /></div>' +
- '<div class="col d-flex align-items-start justify-content-end">' + infObject_button +
- '<button type="button" value="' + resource_type + '" 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" value="' + resource_type + '" 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://147.213.76.182/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++;
- /*onclick=copy__Text("' + value['link']['value'] + '")*/
- $('#Information_Object').append(information);
- }
- });
- var n_oggetto = b + i;
- $('#n_io').text("");
- $('#n_io').append(n_oggetto);
- if (n_oggetto == 0) {
- $('#Information_Object').text("");
- var message = '<p id="no_io" class="no-results">Nessun <span>Testo</span> trovato</p>';
- $('#Information_Object').append(message);
- } else {
- $('#no_io').remove("");
- }
- }
- function Person_handle_json(json) {
- console.log(json);
- perQueries = perQueries+1;
- if(perQueries==3){
- $('#perLoader').css("display", "none");
- }
- var n_ps = $('#n_ps').text();
- var b = parseInt(n_ps);
-
- var i = 0;
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var person = ""; /*Inserisci VALUE TIPOLOGIA*/
- var graph = value['graph']['value'];
- var graph_name = rewrite_graph(graph);
- person += /*INIZIO DIV*/ '<div class="row res"><div class="col-8"><p>' + graph_name + '<br />' +
- '<span id="' + value['subject']['value'] + '" class="title_doc persona">' + value['name']['value'] + '</span></p></div>' +
- '<div class="col d-flex align-items-start justify-content-end"><button type="button" id="' + value['subject']['value'] + '" class="persona btn btn-default" alt="persona" title="' +
- value['name']['value'] + '"><i class="fa fa-user"></i><p class="btn-text">Scheda Persona</p></button>' +
- '<button type="button" value="Persona" 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" value="Persona" 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://147.213.76.182/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++;
- /*onclick=copy__Text("' + value['link']['value'] + '")*/
- $('#Person').append(person);
- });
- var n_oggetto = b + i;
- $('#n_ps').text("");
- $('#n_ps').append(n_oggetto);
- if (n_oggetto == 0) {
- $('#Person').text("");
- var message = '<p id="no_ps" class="no-results">Nessun <span>Persona</span> trovata</p>';
- $('#Person').append(message);
- } else {
- $('#no_ps').remove("");
- }
- }
- function Place_handle_json(json) {
- // console.log(json);
- lgQueries = lgQueries+1;
- if(lgQueries==1){
- $('#lgLoader').css("display", "none");
- }
- var n_pl = $('#n_pl').text();
- var b = parseInt(n_pl);
-
- var i = 0;
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var place = ""; /*Inserisci VALUE TIPOLOGIA*/
- var graph = value['graph']['value'];
- var graph_name = rewrite_graph(graph);
-
- place += /*INIZIO DIV*/ '<div class="row res"><div class="col-8"><p>' + graph_name + '<br />' +
- '<span id="' + value['subject']['value'] + '" class="title_doc luogo">' + value['label']['value'] + '</span></p></div>' +
- '<div class="col d-flex align-items-start justify-content-end"><button type="button" id="' + value['subject']['value'] + '" class="luogo btn btn-default" alt="luogo" title="' +
- value['label']['value'] + '"><i class="fa fa-map"></i><p class="btn-text">Scheda Luogo</p></button>' +
- '<button type="button" value="Luogo" 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" value="Luogo" 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://147.213.76.182/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++;
- /*onclick=copy__Text("' + value['link']['value'] + '")*/
- $('#Place').append(place);
- });
- var n_oggetto = b + i;
- $('#n_pl').text("");
- $('#n_pl').append(n_oggetto);
- if (n_oggetto == 0) {
- $('#Place').text("");
- var message = '<p id="no_pl" class="no-results">Nessun <span>Luogo</span> trovato</p>';
- $('#Place').append(message);
- } else {
- $('#no_pl').remove("");
- }
- }
- //onlick hyperlink button
- $(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'>×</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", ".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", ".artwork", function (ev) {
- var link = this.id;
- //alert(nome_autore);
- //$('#myModal').text("");
- window.open("OA.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", ".luogo", function (ev) {
- var link = this.id;
- //alert(nome_autore);
- //$('#myModal').text("");
- window.open("Luogo.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'>×</span></div><div id='myInput'>" +
- author + " " + year + ", accesso effettuato: " + today + ", <" + url + "></div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
-
- });
- //#######################################
- function prepareQueryURL(query){
- sparqlEndpoint = 'http://147.213.76.182:8890/sparql/';
- sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
- return sparqlEndpoint + sparqlUrlParams;
- }
- // Esegue una query sull'endpoint SPARQL il cui testo completo deve essere fornito nel parametro-stringa 'query'
- // Restituisce una lista di oggetti json nel formato di Virtuoso
- // Il parametro opzionale 'isUnique', se messo a 'true' controlla che ci sia un unico risultato (un array di
- // lunghezza 1) e se non è così restituisce un errore.
- //restituisce direttamente l'oggetto della chiamata ajax
- function doJsonQuery(query) {
-
- queryURL = prepareQueryURL(query);
- return $.ajax({
- url: queryURL,
- dataType: "json",
- type: 'GET'
- });
- }
- //funzione che prende il risultato della chiamata ajax e fa tutto quello che serve dopo
- function manageMMO(result){
- // console.log(result);
- MMO_handle_json(result);
- }
- function manageINF(result){
- // console.log(result);
- InfObj_handle_json(result);
- }
- function managePER(result){
- // console.log(result);
- Person_handle_json(result);
- }
- function manageLG(result){
- // console.log(result);
- Place_handle_json(result);
- }
- function populateOption() {
- const graph_selector = document.getElementById("graph_selector");
- const graph_selector2 = document.getElementById("graph_selector2");
- const createOption = (graph_selector, text, value) => {
- const opt = document.createElement('option');
- opt.value = value;
- opt.text = text;
- graph_selector.options.add(opt);
- }
- const configureDropDownLists = (graph_selector, graph_selector2) => {
- const ASPO = [
- ['Tutti Fondi', ''],
- ['Fondo Datini', 'aspo_datini'],
- ['Fondo Ospedale Misericordia e Dolce', 'aspo_ospedale'],
- ['Fondo Marcovaldi', 'aspo_marcovaldi'],
- ['Fondo Gettatelli', 'aspo_gettatelli']
- ];
- const MPP = [
- ['Tutte', ''],
- ['Galleria Martini', 'mpp_martini'],
- ['Opere provenienti dall’Ospedale', 'mpp_ospedale'],
- ['Iconografia Datini', 'mpp_datini']
- ];
- const OVI = [
- ['Tutte le risorse', ''],
- ['Lettere', 'ovi_lettere']
- ];
- graph_selector2.options.length = 0
-
- switch (graph_selector.value) {
- case 'ASPO':
- for (const c of ASPO) {
- createOption(graph_selector2, c[0], c[1]);
- }
- break;
- case 'MPP':
- for (const s of MPP) {
- createOption(graph_selector2, s[0], s[1]);
- }
- break;
- case 'OVI':
- for (const n of OVI) {
- createOption(graph_selector2, n[0], n[1]);
- }
- break;
- default:
- break;
- }
- }
-
- graph_selector.addEventListener('change', () => {
- $("#graph_selector2").css("display", "block");
- configureDropDownLists(graph_selector, graph_selector2)
- });
- }
- function getGraph(graph1, graph2) {
- var search_graph = "";
- if ((graph1 == '') && (graph2 == '')) {
- search_graph = "";
- }
- else if ((graph1 != '') && (graph2 == '')) {
- if (graph1 == "ASPO") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/aspo/datini> \
- <http://147.213.76.182:8890/aspo/ospedale> \
- <http://147.213.76.182:8890/aspo/marcovaldi> \
- <http://147.213.76.182:8890/aspo/gettatelli>}";
- }
- if (graph1 == "MPP") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/mpp/martini> \
- <http://147.213.76.182:8890/mpp/ospedale> \
- <http://147.213.76.182:8890/mpp/datini> \
- <http://147.213.76.182:8890/mpp/autori> }";
- }
- if (graph1 == "OVI") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/ovi/datini>}";
- }
- }
- else if (graph2 != '') {
- if (graph2 == "aspo_datini") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/aspo/datini>}";
- }
- if (graph2 == "aspo_ospedale") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/aspo/ospedale>}";
- }
- if (graph2 == "aspo_marcovaldi") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/aspo/marcovaldi>}";
- }
- if (graph2 == "aspo_gettatelli") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/aspo/gettatelli>}";
- }
- if (graph2 == "mpp_martini") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/mpp/martini>}";
- }
- if (graph2 == "mpp_ospedale") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/mpp/ospedale>}";
- }
- if (graph2 == "mpp_datini") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/mpp/datini>}";
- }
- if (graph2 == "ovi_lettere") {
- search_graph = "VALUES ?g {<http://147.213.76.182:8890/ovi/datini>}";
- }
- } else {
- search_graph = "";
- }
- return search_graph;
- }
- 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);
- }
|