// 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); // 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, dataType: "json", success: function (data){}, error: function (e) {} }); return response; } // Funzioni per raccattare + stringhificare l'output queryStringOutput = ""; function stringifyResponse(val){ resultArray = val['results']['bindings']; out = ""; for(i = 0; i < resultArray.length; i++){ out = out + JSON.stringify(resultArray[i]) } queryStringOutput = (queryStringOutput + out).replace("}{",","); } prefixes = "PREFIX rdfs: \ PREFIX rdf: \ PREFIX crm: \ PREFIX owl: \ PREFIX schema: \ PREFIX foaf: \ PREFIX person: " queryInfo = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?label ?dimension ?consistency ?id ?sigla_registro (group_concat(distinct ?dimension ; separator='
') as ?dimensions) ?material (group_concat(distinct ?time_span ;separator='-') as ?time_span) ?location ?uri_owner ?owner ?uri_document ?document ?note \ WHERE { \ VALUES ?uri {<" + thisUrlParams.link + ">} \ GRAPH ?g { ?uri rdfs:label ?label } \ OPTIONAL {?uri crm:P1_is_identified_by ?uri_id . \ ?uri_id rdfs:label ?id ; \ crm:P2_has_type 'Segnatura' .} \ OPTIONAL { ?uri crm:P43_has_dimension ?uri_consistency . \ ?uri_consistency crm:P2_has_type 'Consistenza carte' ; \ rdfs:label ?consistency } \ OPTIONAL { ?uri crm:P43_has_dimension ?uri_dimension . \ ?uri_dimension crm:P2_has_type 'Dimensioni' ; \ rdfs:label ?dimension } \ OPTIONAL { ?uri crm:P139_has_alternative_form ?uri_registro . \ ?uri_registro rdfs:label ?sigla_registro; \ crm:P2_has_type 'Sigla registro' . } \ OPTIONAL { ?uri crm:P45_consist_of ?uri_material . \ ?uri_material rdfs:label ?material } \ OPTIONAL { ?uri crm:P52_has_current_owner ?uri_owner . \ ?uri_owner rdfs:label ?owner . } \ OPTIONAL { ?uri crm:P54_has_current_permanent_location ?location } \ OPTIONAL { ?uri crm:P3_has_note ?uri_note . \ ?uri_note rdfs:label ?note } \ OPTIONAL { ?uri crm:P92i_was_brought_into_existence_by ?creation . \ ?creation crm:P4_has_time-span ?uri_time_span . \ ?uri_time_span rdfs:label ?time_span . } \ OPTIONAL {?uri_document crm:P46_is_composed_of ?uri ; \ rdfs:label ?document .} \ } " queryContent = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?titolo ?tipo (group_concat(distinct ?ref ; separator='
') as ?ref) \ WHERE { \ VALUES ?object {<" + thisUrlParams.link + ">} \ ?object crm:P128_carries ?uri . \ ?uri rdf:type crm:E73_Information_Object . \ GRAPH ?g { ?uri rdfs:label ?label } \ OPTIONAL {?uri crm:P1_is_identified_by ?uri_titolo . \ ?uri_titolo rdfs:label ?titolo ; \ rdf:type crm:E35_Title . } \ OPTIONAL { ?uri crm:P2_has_type ?uri_tipo . \ ?uri_tipo rdfs:label ?tipo . } \ OPTIONAL { ?uri crm:P67_refers_to ?uri_ref . \ ?uri_ref rdfs:label ?ref . } \ FILTER NOT EXISTS {GRAPH { ?uri rdfs:label ?label }}. \ }" queryOviLetter = prefixes + " SELECT DISTINCT ?otherId ?InfObj \ WHERE { \ VALUES ?uri {<" + thisUrlParams.link + ">} \ ?uri crm:P1_is_identified_by ?uri_id . \ ?uri_id crm:P2_has_type 'Segnatura' ; \ crm:P139_has_alternative_form ?other_id . \ ?other_id crm:P2_has_type ?uri_type ; \ rdfs:label ?otherId . \ ?uri_type rdfs:label 'Segnatura OVI' . \ OPTIONAL { ?uri crm:P128_carries ?InfObj . \ GRAPH {?InfObj rdf:type crm:E73_Information_Object } } \ } " queryPersone = prefixes + " SELECT DISTINCT ?uri_person ?name (group_concat(distinct ?p_type ; separator=', ') as ?types) ?note \ WHERE { \ VALUES ?uri {<" + thisUrlParams.link + ">} \ { \ ?document crm:P141_assigned ?uri ; \ crm:P67_refers_to ?uri_person . \ ?uri_person foaf:name ?name ; \ crm:P2_has_type ?person_type . \ ?person_type rdfs:label ?p_type . \ } UNION { \ ?uri crm:P92i_was_brought_into_existence_by ?creation . \ ?creation crm:P67_refers_to ?uri_person . \ ?uri_person foaf:name ?name ; \ crm:P67.1_type ?person_type . \ OPTIONAL {?uri_person crm:P3_has_note ?note } \ ?person_type rdfs:label ?p_type . \ } UNION { \ OPTIONAL {?uri crm:P46_is_composed_of ?uri_paper . } \ {?uri_paper crm:P128_carries ?uri_doc } \ UNION \ {?uri crm:P128_carries ?uri_doc } \ ?uri_doc crm:P70_documents ?event ; \ rdfs:label ?document . \ ?uri_obj crm:P128_carries ?uri_doc . \ ?uri_doc rdfs:label ?object . \ ?event crm:P01_has_domain ?domain . \ ?domain crm:P02_has_range ?uri_person ; \ crm:P14.1_in_the_role_of ?uri_role . \ ?uri_role rdfs:label ?p_type . \ ?uri_person rdfs:label ?name . \ } \ }" queryAssocDocs = prefixes + " SELECT DISTINCT ?card ?doc_type ?name_card \ WHERE { \ VALUES ?uri {<" + thisUrlParams.link + ">} \ ?uri crm:P46_is_composed_of ?card . \ ?card rdfs:label ?name_card . \ OPTIONAL {?card crm:P2_has_type ?doc_type } \ OPTIONAL {?document crm:P141_assigned ?card ; \ crm:P67_refers_to ?uri_person . \ ?uri_person foaf:name ?name ; \ crm:P2_has_type ?person_type . \ ?person_type rdfs:label ?type . \ } \ }" queryContrassegni = prefixes + " SELECT DISTINCT ?uri_contrassegno ?contrassegno \ WHERE {VALUES ?uri {<" + thisUrlParams.link + ">} \ ?uri crm:P46_is_composed_of ?uri_paper . \ ?uri_documentation crm:P141_assigned ?uri_paper ; \ crm:P140_assigned_attribute_to ?uri_contrassegno . \ ?uri_contrassegno rdfs:label ?contrassegno . \ }" queryEventiGettatelli = prefixes + " SELECT DISTINCT ?uri_obj ?object ?name_event ?event_type ?uri_person ?label ?role ?time_span ?uri_place ?place \ WHERE {VALUES ?uri {<" + thisUrlParams.link + ">} \ OPTIONAL {?uri crm:P46_is_composed_of ?uri_paper . } \ {?uri_paper crm:P128_carries ?uri_doc } \ UNION \ {?uri crm:P128_carries ?uri_doc } \ ?uri_doc crm:P70_documents ?event ; \ rdfs:label ?document . \ ?uri_obj crm:P128_carries ?uri_doc . \ ?uri_doc rdfs:label ?object . \ ?event rdfs:label ?name_event . \ ?event crm:P2_has_type ?uri_event_type . \ ?uri_event_type rdfs:label ?event_type . \ ?event crm:P01_has_domain ?domain . \ ?domain crm:P02_has_range ?uri_person ; \ crm:P14.1_in_the_role_of ?uri_role . \ ?uri_role rdfs:label ?role . \ ?uri_person rdfs:label ?label . \ OPTIONAL {?event crm:P4_has_time-span ?uri_time_span . \ ?uri_time_span rdfs:label ?time_span . } \ OPTIONAL {?event crm:P7_took_place_at ?uri_location . \ ?uri_place owl:sameAs ?uri_location ; \ crm:P168_place_is_defined_by ?coords; \ rdfs:label ?place . } \ }" queryLuoghiGT = prefixes + " SELECT DISTINCT ?uri_place ?place \ WHERE {VALUES ?uri {<" + thisUrlParams.link + ">} \ OPTIONAL {?uri crm:P46_is_composed_of ?uri_paper . } \ {?uri_paper crm:P128_carries ?uri_doc } \ UNION \ {?uri crm:P128_carries ?uri_doc } \ ?uri_doc crm:P70_documents ?event . \ ?event crm:P7_took_place_at ?uri_location . \ ?uri_place owl:sameAs ?uri_location ; \ crm:P168_place_is_defined_by ?coords; \ rdfs:label ?place . \ }" queryURL = prepareQueryURL(queryInfo); queryINF = prepareQueryURL(queryContent); queryOVI = prepareQueryURL(queryOviLetter); queryPERS = prepareQueryURL(queryPersone); queryDOC = prepareQueryURL(queryAssocDocs); queryCON = prepareQueryURL(queryContrassegni); queryLG = prepareQueryURL(queryLuoghiGT); response = $.ajax({ url: queryURL, dataType: "json", success: function (data){ handle_objectData(data); }, error: function (e) {} }); response_info = $.ajax({ url: queryINF, dataType: "json", success: function (data){ handle_objectInfo(data); }, error: function (e) {} }); response_info = $.ajax({ url: queryOVI, dataType: "json", success: function (data){ handle_oviLetter(data); }, error: function (e) {} }); response_people = $.ajax({ url: queryPERS, dataType: "json", success: function (data){ handle_citedPeople(data); }, error: function (e) {} }); response_luoghi = $.ajax({ url: queryLG, dataType: "json", success: function (data){ handle_luoghiDocumento(data); }, error: function (e) {} }); function handle_objectData(json) { console.log(json['results']['bindings']); $.each( json['results']['bindings'], function (index, value) { var graph = value['graph']['value']; var label = value['label']['value']; var uri = value['uri']['value']; var siglaRegistro = ""; var identifier = ""; var dimensions = ""; var consistence = ""; var materials = ""; var description = ""; var button_ext = ""; var button_owner = ""; var current_owner = ""; var uri_owner = ""; var dates = ""; var uri_composed = ""; var composed = ""; var button_doc = ""; var dataset = get_graph_name(graph); if (value.hasOwnProperty('id')) { $("#ID").css("display", "flex"); identifier = value['id']['value']; } if (value.hasOwnProperty('dimension')) { $("#dimensione").css("display", "flex"); dimensions = value['dimensions']['value']; } if (value.hasOwnProperty('consistency')) { $("#consistenza").css("display", "flex"); consistence = value['consistency']['value']; } if (value.hasOwnProperty('sigla_registro')) { $("#IDreg").css("display", "flex"); siglaRegistro = value['sigla_registro']['value']; } if (value.hasOwnProperty('condition')) { $("#STCC").css("display", "flex"); condition = value['condition']['value']; } if (value.hasOwnProperty('material')) { $("#materia").css("display", "flex"); materials = value['material']['value']; } if (value.hasOwnProperty('uri_owner')) { $("#current_owner").css("display", "flex"); current_owner = value['owner']['value']; uri_owner = value['uri_owner']['value']; } if (value.hasOwnProperty('time_span')) { if (value['time_span']['value'] != ""){ $("#time_span_object").css("display", "flex"); dates = value['time_span']['value']; } } if (value.hasOwnProperty('note')) { $("#notes").css("display", "flex"); description = value['note']['value']; } if (value.hasOwnProperty('uri_document')) { uri_composed = value['uri_document']['value']; } if (value.hasOwnProperty('document')) { $("#composed").css("display", "flex"); composed = value['document']['value']; } if (identifier != "") { button_ext = '' + identifier + ''; } if (uri_composed != "") { button_doc = ''; } if (owner != "") { button_owner = '' + current_owner + ''; } var Buttons = ' \ \ \ '; document.getElementById("grafo").innerHTML = dataset; document.getElementById("nome_oggetto").innerHTML = label; document.getElementById("identifier").innerHTML = button_ext; document.getElementById("nota").innerHTML = description; document.getElementById("sigla_registro").innerHTML = siglaRegistro; document.getElementById("dimensions").innerHTML = dimensions; document.getElementById("materials").innerHTML = materials; document.getElementById("consistence").innerHTML = consistence; document.getElementById("owner").innerHTML = button_owner; document.getElementById("timeSpan").innerHTML = dates; document.getElementById("superDoc").innerHTML = composed; document.getElementById("btn_superDoc").innerHTML = button_doc; document.getElementById("link_buttons").innerHTML = Buttons; }); } function get_graph_name(graph) { var dataset = "Scheda Oggetto"; if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale") { dataset = dataset + " / Ospedale"; } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/datini") { dataset = dataset + " / Datini"; } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi") { dataset = dataset + " / Marcovaldi"; } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli") { dataset = dataset + " / Gettatelli"; } else { dataset = dataset; } return dataset; } function handle_objectInfo(json) { console.log(json['results']['bindings']); $.each( json['results']['bindings'], function (index, value) { var title = ""; var type = ""; var subject = ""; if (value.hasOwnProperty('titolo')) { $("#titolo").css("display", "flex"); title = value['titolo']['value']; } if (value.hasOwnProperty('tipo')) { $("#tipo").css("display", "flex"); type = value['tipo']['value']; } if (value.hasOwnProperty('ref')) { if (value['ref']['value'] != "") { $("#argomento").css("display", "flex"); subject = value['ref']['value']; } } document.getElementById("title").innerHTML = title; document.getElementById("type").innerHTML = type; document.getElementById("subject").innerHTML = subject; }); } function handle_oviLetter(json) { console.log(json['results']['bindings']); $.each( json['results']['bindings'], function (index, value) { var other_id = ""; var uri = ""; var button_letter = ""; if (value.hasOwnProperty('otherId')) { $("#IDbis").css("display", "flex"); other_id = value['otherId']['value']; } if (value.hasOwnProperty('InfObj')) { uri = value['InfObj']['value']; } if (uri != "") { button_letter = ''; } document.getElementById("other_identifier").innerHTML = other_id; document.getElementById("btn_other_identifier").innerHTML = button_letter; }); } /* function handle_citedPeople(json) { console.log(json); var Relazioni = ""; const myArray = [] $.each( json['results']['bindings'], function (index, value) { var uri_person = value['uri_person']['value']; var name = value['name']['value']; var tipo = ""; var nota = ""; if (value.hasOwnProperty('p_type')) { tipo = value['p_type']['value']; } if (value.hasOwnProperty('note')) { nota = "
" + value['note']['value'] + ""; } var string = name + nota; myArray.push([tipo, string, uri_person, nota]); }); if (myArray.length == 0) { $("#placeholder_people").css("display", "none"); } const checkRel = []; for (var i=0; i'+ docs[i][1] + ''; if (docs[i][2] != "") { object = object + "
Documento: " + docs[i][2]; } object = object + '

'; var object_button = ''; Docs += '
'+ object + '
' + object_button + '' + '' + '
'; } document.getElementById("n_sec").innerHTML = docs.length; document.getElementById("section_documents").innerHTML = Docs; if (docs.length==0) { var messaggio = "

Nessun risultato trovato

"; document.getElementById("section_documents").innerHTML = messaggio; } }*/ function handle_citedPeople(json) { console.log(json); const people = []; $.each( json['results']['bindings'], function (index, value) { var uri = value['uri_person']['value']; var name = value['name']['value']; var tipo = ""; var nota = ""; if (value.hasOwnProperty('types')) { if (value['types']['value'] != "") { tipo = value['types']['value']; } } if (value.hasOwnProperty('note')) { nota = value['note']['value']; } people.push([uri, name, tipo, nota]); }); var Person = ""; for (var i=0; i'+ people[i][1] + ''; if (people[i][2] != "") { object = object + "
Citazione nel ruolo di: " + people[i][2]; } if (people[i][3] != "") { object = object + "
Nota: " + people[i][3]; } object = object + '

'; Person += '
' + object + '
' + '' + '' + '
'; } document.getElementById("n_pp").innerHTML = people.length; document.getElementById("cited_people").innerHTML = Person; if (people.length==0) { var messaggio = "

Nessun risultato trovato

"; document.getElementById("cited_people").innerHTML = messaggio; } } function handle_luoghiDocumento(json) { console.log(json); const places = []; $.each( json['results']['bindings'], function (index, value) { var uri = value['uri_place']['value']; var label = value['place']['value']; places.push([uri, label]); }); var Luoghi = ""; for (var i=0; i'+ places[i][1] + '

'; var object_button = ''; Luoghi += '
'+ object + '
' + object_button + '' + '' + '
'; } document.getElementById("n_pl").innerHTML = places.length; document.getElementById("section_places").innerHTML = Luoghi; if (places.length==0) { var messaggio = "

Nessun risultato trovato

"; document.getElementById("section_places").innerHTML = messaggio; } } /*function handle_eventiGettatelli(json) { console.log(json); const evGett = []; $.each( json['results']['bindings'], function (index, value) { var uri = value['uri_obj']['value']; var label = value['object']['value']; var name_event = value['name_event']['value']; var event_type = value['event_type']['value']; var uri_person = value['uri_person']['value']; var person = value['label']['value']; var role = value['role']['value']; var time_span = ""; var uri_place = ""; var place = ""; if (value.hasOwnProperty('time_span')) { time_span = value['time_span']['value']; } if (value.hasOwnProperty('uri_place')) { uri_place = value['uri_place']['value']; } if (value.hasOwnProperty('place')) { place = value['place']['value']; } evGett.push([name_event, uri_person, person, role, time_span, uri_place, place]); }); var thead = '
Evento registrato
' + '
Persona
' + '
Ruolo
' + '
Data
' + '
Luogo
'; var EventsTable = ""; for (var i=0; i' + evGett[i][0] + '' + '
' + evGett[i][2] + '
' + '
' + evGett[i][3] + '
' + '
' + evGett[i][4] + '
' + '
' + evGett[i][6] + '
' + ''; } document.getElementById("thead_ev").innerHTML = thead; if (evGett.length != 0) { document.getElementById("section_events").innerHTML = EventsTable; } else { var messaggio = "

Nessun risultato trovato

"; document.getElementById("section_events").innerHTML = messaggio; } }*/ function createDivRelazione(type, id){ htmlCode = '\
\
\ \
\
\
\ '.replace("", type).replace("", id); return htmlCode; } function createColRelazione(text, link, tipo, fa, tab, decl) { htmlCode = '\
\
\
\ \
\
\ '.replace("", text).replace("", link).replace("", tipo).replace(""); }); $(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("