1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297 |
- const choiceArray = [
- ["Nome risorsa", "Object, OA", "label"],
- ["Identificatore", "Object, OA, Person, Letter, Place", "identifier"],
- ["Materia", "Object, OA", "material"],
- ["Istituto di conservazione", "Object, OA", "localization"],
- ["Tecnica", "OA", "technique"],
- ["Artista", "OA", "artist"],
- ["Soggetto", "OA", "subject"],
- ["Titolo", "Object, Inf", "title"],
- ["Tipo di risorsa", "Object, Inf", "type"],
- ["Nome proprio", "Person", "givenName"],
- ["Nome di famiglia", "Person", "familyName"],
- ["Luogo di Nascita", "Person", "birthPlace"],
- ["Luogo di Morte", "Person", "deathPlace"],
- ["Genere", "Person", "sex"],
- ["Data di Nascita", "Person", "birthDate"],
- ["Data di Morte", "Person", "deathDate"],
- ["Occupazione", "Person", "occupation"],
- ["Qualifica", "Person", "qualification"],
- ["Mittente", "Letter", "sender"],
- ["Destinatario", "Letter", "receiver"],
- ["Luogo di Partenza", "Letter", "startPlace"],
- ["Luogo di Arrivo", "Letter", "endPlace"],
- ["Data partenza", "Letter", "startDate"],
- ["Data arrivo", "Letter", "endDate"],
- ["Lingua", "Letter", "language"],
- ["Area linguistica", "Letter", "languageArea"],
- ["Edizione", "Letter", "edition"],
- ["Data", "Object", "date"],
- ["Date", "OA", "date_OA"],
- ["Lemma", "Letter", "lemma"],
- ["Testo libero", "Letter", "keyword"]
- ];
- const typeArray = [
- ["Oggetto", "Object"],
- ["Lettera", "Letter"],
- ["Opera d'Arte", "OA"],
- ["Persona", "Person"]
- ];
- const graphArray = [
- ["ASPO - Datini", "http://147.213.76.182:8890/aspo/datini", "Object"],
- ["ASPO - Ospedale", "http://147.213.76.182:8890/aspo/ospedale", "Object"],
- ["ASPO - Marcovaldi", "http://147.213.76.182:8890/aspo/marcovaldi", "Object"],
- ["ASPO - Onomastica Gettatelli", "http://147.213.76.182:8890/aspo/gettatelli", "Person"],
- ["ASPO - Onomastica Datini", "http://147.213.76.182:8890/aspo/onomastica", "Person"],
- ["MPP – Onomastica Artisti", "http://147.213.76.182:8890/mpp/autori", "Person"],
- ["MPP - Collezione Martini", "http://147.213.76.182:8890/mpp/martini", "Artwork"],
- ["MPP - Opere provenienti dall’Ospedale", "http://147.213.76.182:8890/mpp/ospedale", "Artwork"],
- ["MPP – Iconografia Datini", "http://147.213.76.182:8890/mpp/datini", "Artwork"],
- ["OVI - Lettere", "http://147.213.76.182:8890/ovi/datini", "Letter"]
- ];
- const objectArray = [];
- const personArray = [];
- const placeArray = [];
- const oaArray = [];
- const letterArray = [];
- $(document).ready(function () {
- //#######################################
- var type_selector = document.getElementById("type_selector");
- var collection_selector = document.getElementById("collection_selector");
- let x = typeArray.length;
- for(var i=0; i<x; i++) {
- var opt = document.createElement("option");
- opt.value= typeArray[i][1];
- opt.innerHTML = typeArray[i][0]; // whatever property it has
- // then append it to the select element
- type_selector.add(opt);
- }
- let z = choiceArray.length;
- for(var i=0; i<z; i++) {
- var cat = choiceArray[i][1];
- if (cat.includes("Object")) {
- objectArray.push(choiceArray[i]);
- }
- if (cat.includes("OA")) {
- oaArray.push(choiceArray[i]);
- }
- if (cat.includes("Person")) {
- personArray.push(choiceArray[i]);
- }
- if (cat.includes("Letter")) {
- letterArray.push(choiceArray[i]);
- }
- if (cat.includes("Place")) {
- placeArray.push(choiceArray[i]);
- }
- }
- $("#type_selector").change(function(){
- var selOpt = "";
- $(this).find("option:selected").each(function(){
- var optionValue = $(this).attr("value");
- selOpt = optionValue;
- if(optionValue){
- $(".box").not("." + optionValue).hide();
- $("." + optionValue).show();
- } else{
- $(".box").hide();
- }
- });
- $( ".container_choice" ).remove();
- if (selOpt == "Object") {
- addToListObject();
- populateSelGraph("Object");
- }
- else if (selOpt == "OA") {
- addToListOA();
- populateSelGraph("Artwork");
- }
- else if (selOpt == "Person") {
- addToListPerson();
- populateSelGraph("Person");
- }
- else if (selOpt == "Letter") {
- addToListLetter();
- populateSelGraph("Letter");
- }
- else {
- addToList();
- populateSelGraph("General");
- }
- }).change();
- /*$('[name=sel-parent]').on('change', function() {
- $(this).attr("id", 'example' + $(this).name());
- });*/
- });
- function populateOptions(selector, myArray) {
- var choice_selector = document.getElementById(selector);
- let k = myArray.length;
- for(var i=0; i<k; i++) {
- var opt = document.createElement("option");
- opt.value= myArray[i][1];
- opt.innerHTML = myArray[i][0]; // whatever property it has
- // then append it to the select element
- choice_selector.add(opt);
- }
- $('#' + selector).on( "change", function() {
- var numberId= selector.split("-")[1];
- var inputText= $( this ).find(":selected").text();
- var inp = "";
- if (inputText == "Genere") {
- inp = '<select class="advanced-form-select form-control" id="inputchoiceSelector_'+ numberId +'"> \
- <option>F</option> \
- <option>M</option> \
- </select>';
- } else if (inputText == "Materia"){
- inp = '<select class="advanced-form-select form-control" id="inputchoiceSelector_'+ numberId +'"> \
- <option>Tempera</option> \
- <option>Tavola</option> \
- <option>Stucco</option> \
- <option>Rame</option> \
- <option>Carta</option> \
- <option>Tela</option> \
- </select>';
- } else if (inputText == "Tecnica"){
- inp = '<select class="advanced-form-select form-control" id="inputchoiceSelector_'+ numberId +'"> \
- <option>Pittura a olio</option> \
- <option>Doratura</option> \
- </select>';
- } else if (inputText == "Tipo di risorsa"){
- inp = '<select class="advanced-form-select form-control" id="inputchoiceSelector_'+ numberId +'"> \
- <option>Documento</option> \
- <option>Carteggio</option> \
- <option>Lettera</option> \
- <option>Libro</option> \
- <option>Documenti diversi</option> \
- </select>';
- } else if (inputText == "Data"){
- var inp = '<div style="display:flex;"><div id="box_' + numberId + '_a" class="container_choice"><div class="choice_box">Da <select style="display:none;" id ="choice_selector-' + numberId + '_a" value=' + numberId + '_a" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Da</option> \
- <input type="number" id="inputchoiceSelector_'+ numberId +'_a" name="start" min="1000" max="2099" step="1" value="1300" /></div></div>\
- <div id="box_' + numberId + '_b" class="container_choice"><div class="choice_box">A <select style="display:none;" id ="choice_selector-' + numberId + '_b" value=' + numberId + '_b" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">A</option> \
- <input type="number" id="inputchoiceSelector_'+ numberId +'_b" name="end" min="1000" max="2099" step="1" value="1900" /></div></div>\
- </select></div></div></div>';
- /*var inp = '<div style="display:flex;"><div id="box_' + numberId + '_a" class="container_choice"><div class="choice_box">Da <select style="display:none;" id ="choice_selector-' + numberId + '_a" value=' + numberId + '_a" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Da</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_a" name="start" value="1300-01-01"> \
- </select></div></div> \
- <div id="box_' + numberId + '_b" class="container_choice"><div class="choice_box">A <select style="display:none;" id ="choice_selector-' + numberId + '_b" value=' + numberId + '_b" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">A</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_b" name="end" value="1900-12-31"> \
- </select></div></div></div>';*/
- }
- else if (inputText == "Date"){
- var inp = '<div style="display:flex;"><div id="box_' + numberId + '_a" class="container_choice"><div class="choice_box">Da <select style="display:none;" id ="choice_selector-' + numberId + '_a" value=' + numberId + '_a" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data inizio opera</option> \
- <input type="number" id="inputchoiceSelector_'+ numberId +'_a" name="start" min="1000" max="2099" step="1" value="1300" /></div></div>\
- <div id="box_' + numberId + '_b" class="container_choice"><div class="choice_box">A <select style="display:none;" id ="choice_selector-' + numberId + '_b" value=' + numberId + '_b" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data fine opera</option> \
- <input type="number" id="inputchoiceSelector_'+ numberId +'_b" name="end" min="1000" max="2099" step="1" value="1900" /></div></div>\
- </select></div></div></div>';
- /*var inp = '<div style="display:flex;"><div id="box_' + numberId + '_a" class="container_choice"><div class="choice_box">Da <select style="display:none;" id ="choice_selector-' + numberId + '_a" value=' + numberId + '_a" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data inizio opera</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_a" name="start" value="1300-01-01"> \
- </select></div></div> \
- <div id="box_' + numberId + '_b" class="container_choice"><div class="choice_box">A <select style="display:none;" id ="choice_selector-' + numberId + '_b" value=' + numberId + '_b" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data fine opera</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_b" name="end" value="1900-12-31"> \
- </select></div></div></div>';*/
- }
- else if (inputText == "Data partenza"){
- var inp = '<div style="display:flex;"><div id="box_' + numberId + '_a" class="container_choice"><div class="choice_box">Da <select style="display:none;" id ="choice_selector-' + numberId + '_a" value=' + numberId + '_a" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data partenza inizio</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_a" name="start" value="1300-01-01"> \
- </select></div></div> \
- <div id="box_' + numberId + '_b" class="container_choice"><div class="choice_box">A <select style="display:none;" id ="choice_selector-' + numberId + '_b" value=' + numberId + '_b" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data partenza fine</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_b" name="end" value="1900-12-31"> \
- </select></div></div></div>';
- }
- else if (inputText == "Data arrivo"){
- var inp = '<div style="display:flex;"><div id="box_' + numberId + '_a" class="container_choice"><div class="choice_box">Da <select style="display:none;" id ="choice_selector-' + numberId + '_a" value=' + numberId + '_a" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data arrivo inizio</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_a" name="start" value="1300-01-01"> \
- </select></div></div> \
- <div id="box_' + numberId + '_b" class="container_choice"><div class="choice_box">A <select style="display:none;" id ="choice_selector-' + numberId + '_b" value=' + numberId + '_b" name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Data arrivo fine</option> \
- <input type="date" id="inputchoiceSelector_'+ numberId +'_b" name="end" value="1900-12-31"> \
- </select></div></div></div>';
- }
- else {
- inp = '<input type="text" id="inputchoiceSelector_'+ numberId +'" class="selected_option form-control" placeholder="Enter search terms" aria-label="Enter search terms" aria-describedby="button-addon2">';
-
- }
- var sect = 'sect-' + String(numberId);
- var inDiv = document.getElementById(sect);
- inDiv.innerHTML = inp;
- console.log(selector);
-
-
- /*$('#inputchoiceSelector_' + numberId).val(inputText);
- $('#inputchoiceSelector_' + numberId).id(inputText);*/
- });
- }
- var val = 0;
- function addToList() {
- val = val+1;
- var sel = '<div id="box_' + val + '" class="container_choice"><div class="remove"><a onclick="removeElement(\'box_' + val + '\')"><i class="fa fa-trash" aria-hidden="true"></i></a></div><div class="choice_box"><select id ="choice_selector-' + val + '" value=' + val + ' name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Scegli un\'opzione</option> \
- </select><div id="sect-' + val + '"></div></div></div>';
- $('#drop-down-content').append(sel);
- var selector = 'choice_selector-' + val;
- //populateOptions(selector, choiceArray);
- }
- function addToListObject() {
- val = val+100;
- var sel = '<div id="box_' + val + '" class="container_choice"><div class="remove"><a onclick="removeElement(\'box_' + val + '\')"><i class="fa fa-trash" aria-hidden="true"></i></a></div><div class="choice_box"><select id ="choice_selector-' + val + '" value=' + val + ' name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Scegli un\'opzione</option> \
- </select><div id="sect-' + val + '"></div></div></div>';
- $('#drop-down-content-Object').append(sel);
- var selector = 'choice_selector-' + val;
- populateOptions(selector, objectArray);
- }
- function addToListOA() {
- val = val+200;
- var sel = '<div id="box_' + val + '" class="container_choice"><div class="remove"><a onclick="removeElement(\'box_' + val + '\')"><i class="fa fa-trash" aria-hidden="true"></i></a></div><div class="choice_box"><select id ="choice_selector-' + val + '" value=' + val + ' name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Scegli un\'opzione</option> \
- </select><div id="sect-' + val + '"></div></div></div>';
- $('#drop-down-content-OA').append(sel);
- var selector = 'choice_selector-' + val;
- populateOptions(selector, oaArray);
- }
- function addToListPerson() {
- val = val+300;
- var sel = '<div id="box_' + val + '" class="container_choice"><div class="remove"><a onclick="removeElement(\'box_' + val + '\')"><i class="fa fa-trash" aria-hidden="true"></i></a></div><div class="choice_box"><select id ="choice_selector-' + val + '" value=' + val + ' name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Scegli un\'opzione</option> \
- </select><div id="sect-' + val + '"></div></div></div>';
- $('#drop-down-content-Person').append(sel);
- var selector = 'choice_selector-' + val;
- populateOptions(selector, personArray);
- }
- function addToListLetter() {
- val = val+400;
- var sel = '<div id="box_' + val + '" class="container_choice"><div class="remove"><a onclick="removeElement(\'box_' + val + '\')"><i class="fa fa-trash" aria-hidden="true"></i></a></div><div class="choice_box"><select id ="choice_selector-' + val + '" value=' + val + ' name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Scegli un\'opzione</option> \
- </select><div id="sect-' + val + '"></div></div></div>';
- $('#drop-down-content-Letter').append(sel);
- var selector = 'choice_selector-' + val;
- populateOptions(selector, letterArray);
- }
- function addToListPlace() {
- val = val+500;
- var sel = '<div id="box_' + val + '" class="container_choice"><div class="remove"><a onclick="removeElement(\'box_' + val + '\')"><i class="fa fa-trash" aria-hidden="true"></i></a></div><div class="choice_box"><select id ="choice_selector-' + val + '" value=' + val + ' name="sel-parent" class="advanced-form-select form-control" aria-label="Default select example"> \
- <option selected value="0">Scegli un\'opzione</option> \
- <input type="text" id="inputchoiceSelector_'+ val +'" class="selected_option form-control" placeholder="Enter search terms" aria-label="Enter search terms" aria-describedby="button-addon2"> \
- </select></div></div>';
- $('#drop-down-content-Place').append(sel);
- var selector = 'choice_selector-' + val;
- populateOptions(selector, placeArray);
- }
- //Get parameters from select and input options to build the query
- function getParameters() {
- $('#Loader').css("display", "block");
- $('#query_results').text("");
- var cc = document.getElementById("type_selector").value;
- if (cc != "General") {
- const arr = [];
- const collection = document.getElementsByClassName("advanced-form-select");
- for (let i = 0; i < collection.length; i++) {
- var x = collection[i].id;
- var t = document.getElementById(x);
- var e = t.options[t.selectedIndex].text;
- var numberId= x.split("-")[1]
- var inputId = "inputchoiceSelector_" + numberId;
- if (!!document.getElementById(inputId)) {
- var inputText = document.getElementById(inputId).value;
- var el = [e, inputText];
- console.log([inputText, el]);
- arr.push(el);
- }
-
- }
- constructQuery(arr);
- }
- else {
- alert("Seleziona una categoria")
- }
- /*$('#query_results').append(arr);
- testo = $('input#writeText').val();*/
- }
- function removeElement(id_element) {
- const element = document.getElementById(id_element);
- element.remove();
- }
- //Build query with harvested parametes
- function constructQuery(params) {
- var g = document.getElementById("collection_selector");
- var graph = g.value;
- var search_graph = "?g";
- if (graph != "") {
- search_graph = '<' + graph + '>';
- }
- var search_type = "";
- var ct = document.getElementById("type_selector");
- var choosen_type = ct.value;
- console.log(choosen_type);
- var search_identifier = "";
- if (choosen_type == "Object") {
- search_type = "?subject rdf:type crm:E22_Man-Made_Object . ";
- search_identifier = "?subject crm:P1_is_identified_by ?uri_identifier . \
- ?uri_identifier rdfs:label ?identifier ; \
- crm:P2_has_type 'Segnatura' .";
- }
- if (choosen_type == "Letter") {
- search_type = "?subject crm:P128_carries ?information_object . \
- ?information_object crm:P2_has_type ?uri_letter . \
- ?uri_letter rdfs:label 'lettera' ."
- search_identifier = "?subject crm:P1_is_identified_by ?uri_identifier . \
- ?uri_identifier rdfs:label ?identifier ; \
- crm:P2_has_type 'Segnatura' .";
- }
- if (choosen_type == "OA") {
- search_identifier = "?subject crm:P1_is_identified_by ?uri_identifier . \
- ?uri_identifier rdfs:label ?identifier ; \
- crm:P2_has_type 'Codice univoco del bene (NCT)' .";
- }
- if (choosen_type == "Person") {
- search_type = "?subject rdf:type crm:E21_Person . ";
- search_identifier = "?subject crm:P1_is_identified_by ?uri_identifier . \
- ?uri_identifier rdfs:label ?identifier .";
- }
- var label = ""; //
- var identificatore = ""; //
- var dimensione = ""; //
- var materia = ""; //
- var localizzazione = ""; //
- var tecnica = ""; //
- var artista = ""; //
- var soggetto = ""; //
- var titolo = ""; //
- var tipo = ""; //
- var note = ""; //
- var riferimenti = ""; //
- var nome_proprio = ""; //
- var nome_di_famiglia = ""; //
- var patronimico = ""; //
- var luogo_di_Nascita = ""; //
- var luogo_di_Morte = ""; //
- var genere = ""; //
- var data_di_Nascita = ""; //
- var data_di_Morte = ""; //
- var occupazione = ""; //
- var qualifica = ""; //
- var gruppi_di_appartenenza = ""; //
- var mittente = ""; //
- var destinatario = ""; //
- var luogo_di_Partenza = ""; //
- var luogo_di_Arrivo = ""; //
- var data_partenza_inizio = ""; //
- var data_partenza_fine = "";
- var data_arrivo_inizio = ""; //
- var data_arrivo_fine = "";
- var data_opera_inizio = ""; //
- var data_opera_fine = ""; //
- var lingua = ""; //
- var area_linguistica = ""; //
- var edizione = ""; //
- var lemma = ""; //
- var testo = ""; //
- var data = ""; //
- var start = "";
- var finish = "";
- var letter_event = ""; //
- var infObj = ""; //
- var id = ""; //
- var dm = ""; //
- var mt = ""; //
- var locl = ""; //
- var tec = ""; //
- var at = ""; //
- var sg = ""; //
- var tt = ""; //
- var tp = ""; //
- var nt = ""; //
- var rf = ""; //
- var np = ""; //
- var nf = ""; //
- var pt = ""; //
- var ln = ""; //
- var lm = ""; //
- var gr = ""; //
- var dn = ""; //
- var dts = ""; //
- var oc = ""; //
- var qf = ""; //
- var ga = ""; //
- var mit = ""; //
- var des = ""; //
- var lp = ""; //
- var la = ""; //
- var dp = ""; //
- var da = ""; //
- var lin = ""; //
- var alin = ""; //
- var ed = ""; //
- var lem = ""; //
- var ttx = ""; //
- var dt = ""; //
- var st = "";
- var fn = "";
- var dpi = "";
- var dai = "";
- var diop = "";
- var dfop = "";
- for (let i = 0; i < params.length; i++) {
- if(params[i][0] == "Nome risorsa" && (params[i][1] != "")) {
- var toSearch = params[i][1].replace("'", " ");
- label = "?label bif:contains \"\' "+ toSearch + " \'\" . ";
- }
- if(params[i][0] == "Identificatore" && (params[i][1] != "")) {
- id = " ?identifier";
- identificatore = "FILTER (CONTAINS(?identifier, \'"+ params[i][1] +"\'))";
- }
- if(params[i][0] == "Dimensione" && (params[i][1] != "")) {
- dm = " ?dimension";
- dimensione = "?subject crm:P43_has_dimension ?uri_dimension . \
- ?uri_dimension rdfs:label ?dimension . \
- ?dimension bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if(params[i][0] == "Materia" && (params[i][1] != "")) {
- mt = " ?material";
- materia = "?subject crm:P45_consists_of ?uri_material . \
- ?uri_material rdfs:label ?material . \
- ?material bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if(params[i][0] == "Istituto di conservazione" && (params[i][1] != "")) {
- locl = " ?location";
- localizzazione = "?subject crm:P52_has_current_owner ?uri_location . \
- ?uri_location rdfs:label ?location . \
- ?location bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if(params[i][0] == "Tecnica" && (params[i][1] != "")) {
- tec = " ?technique";
- tecnica = "?event ?pp ?subject . \
- ?event crm:P32_used_general_technique ?uri_technique . \
- ?uri_technique rdfs:label ?technique . \
- ?technique bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Artista" && (params[i][1] != "")) {
- at = " ?artist";
- artista = "?subject rdfs:label ?label . \
- ?production crm:P108_has_produced ?subject . \
- ?pc crm:P01_has_domain ?production . \
- ?pc crm:P02_has_range ?range . \
- ?range rdfs:label ?artist . \
- ?artist bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Soggetto" && (params[i][1] != "")) {
- sg = " ?depiction";
- soggetto = "?subject crm:P62_depicts ?uri_depiction . \
- ?uri_depiction rdfs:label ?depiction . \
- ?depiction bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Titolo" && (params[i][1] != "")) {
- tt = " ?title";
- infObj = "?subject crm:P128_carries ?information_object .";
- titolo = "?information_object crm:P1_is_identified_by ?uri_title . \
- ?uri_title rdfs:label ?title . \
- ?title bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Tipo di risorsa" && (params[i][1] != "")) {
- tp = " ?type";
- infObj = "?subject crm:P128_carries ?information_object .";
- tipo = "?information_object crm:P2_has_type ?uri_type . \
- ?uri_type rdfs:label ?type . \
- ?type bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Note" && (params[i][1] != "")) {
- nt = " ?note";
- note = "?subject crm:P3_has_note ?uri_note . \
- ?uri_note rdfs:label ?note . \
- ?note bif:contains \"\'"+ params[i][1] +"\'\" .";
- }
- if (params[i][0] == "Riferimenti" && (params[i][1] != "")) {
- rf = " ?ref";
- riferimenti = "?subject crm:P67_refers_to ?uri_ref . \
- ?uri_ref rdfs:label ?ref . \
- ?ref bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Nome proprio" && (params[i][1] != "")) {
- np = " ?givenName";
- nome_proprio = "?subject foaf:givenName ?givenName . \
- ?givenName bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Nome di famiglia" && (params[i][1] != "")) {
- nf = " ?familyName";
- nome_di_famiglia = "?subject foaf:familyName ?familyName . \
- ?familyName bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Patronimico" && (params[i][1] != "")) {
- pt = " ?patronymic";
- patronimico = "?subject person:patronymicName ?patronymic . \
- ?patronymic bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Luogo di Nascita" && (params[i][1] != "")) {
- ln = " ?birthPlace";
- luogo_di_Nascita = "?subject crm:P98i_was_born ?Birth . \
- ?Birth crm:P7_took_place_at ?uri_birthPlace . \
- ?uri_birthPlace rdfs:label ?birthPlace . \
- ?birthPlace bif:contains \""+ params[i][1] +"\" . "
- }
- if (params[i][0] == "Luogo di Morte" && (params[i][1] != "")) {
- lm = " ?deathPlace";
- luogo_di_Morte = "?subject crm:P100i_died_in ?Death . \
- ?Death crm:P7_took_place_at ?uri_deathPlace . \
- ?uri_deathPlace rdfs:label ?deathPlace \
- ?deathPlace bif:contains \""+ params[i][1] +"\" . "
- }
- if (params[i][0] == "Genere" && (params[i][1] != "")) {
- gr = "?genere";
- genere = "?subject foaf:gender ?genere . \
- ?genere bif:contains \""+ params[i][1] +"\" . "
- }
- if (params[i][0] == "Data di Nascita" && (params[i][1] != "")) {
- dn = " ?Birth_TS";
- data_di_Nascita = "?subject crm:P98i_was_born ?Birth . \
- ?Birth crm:P4_has_time-span ?Birth_TS . \
- ?Birth_TS rdfs:label \""+ params[i][1] +"\" ."
- }
- if (params[i][0] == "Data di Morte" && (params[i][1] != "")) {
- dts = " ?Death_TS";
- data_di_Morte = "?subject crm:P100i_died_in ?Death . \
- ?Death crm:P4_has_time-span ?Death_TS . \
- ?Death_TS rdfs:label \""+ params[i][1] +"\" . "
- }
- if (params[i][0] == "Qualifica" && (params[i][1] != "")) {
- qf = " ?qualification";
- qualifica = "?subject schema:honorificPrefix ?qualification . \
- ?qualification bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Occupazione" && (params[i][1] != "")) {
- oc = " ?occupation";
- occupazione = "?subject schema:hasOccupation ?uriOccupation . \
- ?uriOccupation rdf:type schema:Occupation; \
- rdfs:label ?occupation . \
- ?occupation bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Gruppi di appartenenza" && (params[i][1] != "")) {
- ga = " ?group";
- gruppi_di_appartenenza = "?subject crm:P107i_is_current_or_former_member_of ?uriGroup . \
- ?uriGroup rdfs:label ?group . \
- ?group bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Mittente" && (params[i][1] != "")) {
- mit = " ?mittente";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- mittente = "?send crm:P01_has_domain ?pcS . \
- ?pcS crm:P02_has_range ?uriSender . \
- ?uriSender rdfs:label ?mittente . \
- ?mittente bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Destinatario" && (params[i][1] != "")) {
- des = " ?destinatario";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- destinatario = "?receive crm:P01_has_domain ?pcR . \
- ?pcR crm:P02_has_range ?uriReceiver . \
- ?uriReceiver rdfs:label ?destinatario . \
- ?destinatario bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Luogo di Partenza" && (params[i][1] != "")) {
- lp = " ?luogo_partenza";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- luogo_di_Partenza = "?send crm:P27_moved_from ?uriLuogoPartenza . \
- ?uriLuogoPartenza rdfs:label ?luogo_partenza . \
- ?luogo_partenza bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Luogo di Arrivo" && (params[i][1] != "")) {
- la = " ?luogo_arrivo";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- luogo_di_Arrivo = "?receive crm:P26_moved_to ?uriLuogoArrivo . \
- ?uriLuogoArrivo rdfs:label ?luogo_arrivo . \
- ?luogo_arrivo bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Data partenza" && (params[i][1] != "")) {
- dp = " ?timeSpanSend";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- data_partenza = "?send crm:P4_has_time-span ?time_spanS . \
- ?time_spanS rdfs:label ?timeSpanSend . \
- ?timeSpanSend bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Data arrivo" && (params[i][1] != "")) {
- da = " ?timeSpanReceive";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- data_arrivo = "?receive crm:P4_has_time-span ?time_spanR . \
- ?time_spanR rdfs:label ?timeSpanReceive .\
- ?timeSpanReceive bif:contains \"\'"+ params[i][1] +"\'\" . "
- }
- if (params[i][0] == "Lingua" && (params[i][1] != "")) {
- lin = " ?lingua";
- lingua = "?information_object crm:P72_has_language ?language . \
- ?language rdfs:label ?lingua . \
- ?lingua bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Area linguistica" && (params[i][1] != "")) {
- alin = " ?area_linguistica";
- area_linguistica = "?information_object crm:P72_has_language ?language . \
- ?language crm:P3_has_note ?area . \
- ?area rdfs:label ?area_linguistica .\
- ?area_linguistica bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Edizione" && (params[i][1] != "")) {
- ed = " ?edizione";
- edizione = "?edition crm:P70_documents ?information_object ; \
- crm:P1_is_identified_by ?edition_id . \
- ?edition_id rdfs:label ?edizione . \
- ?edizione bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Lemma" && (params[i][1] != "")) {
- lem = " ?lemma";
- lemma = "?information_object crm:P67_refers_to ?link_lemma . \
- ?link_lemma rdfs:label ?lemma. \
- ?lemma bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Testo libero" && (params[i][1] != "")) {
- ttx = " ?testo";
- testo = "?information_object crm:P190_has_symbolic_content ?testo . \
- ?testo bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Data" && (params[i][1] != "")) {
- dt = " ?date";
- data = "?subject ?property ?event . \
- ?event crm:P4_has_time-span ?uri_date . \
- ?uri_date rdfs:label ?date . \
- ?date bif:contains \"\'"+ params[i][1] +"\'\" ."
- }
- if (params[i][0] == "Da" && (params[i][1] != "")) {
- st = " ?start";
- start = "?subject ?property ?event_start . \
- ?event_start crm:P4_has_time-span ?uri_date_start . \
- ?uri_date_start rdfs:label ?start ; \
- time:hasBeginning ?date_start . \
- FILTER (?date_start >= \""+ params[i][1] +"\"^^xsd:date)";
- }
- if (params[i][0] == "A" && (params[i][1] != "")) {
- fn = " ?end";
- finish = "?subject ?property ?event_end . \
- ?event_end crm:P4_has_time-span ?uri_date_end . \
- ?uri_date_end rdfs:label ?end ; \
- time:hasEnd ?date_end . \
- FILTER (?date_start <= \""+ params[i][1] +"\"^^xsd:date)";
- }
- if (params[i][0] == "Data partenza inizio" && (params[i][1] != "")) {
- dpi = " ?send_date";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- data_partenza_inizio = "?send crm:P4_has_time-span ?uri_send_date . \
- ?uri_send_date rdfs:label ?send_date ; \
- time:hasBeginning ?time_send . \
- FILTER (?time_send >= \""+ params[i][1] +"\"^^xsd:date";
- }
- if (params[i][0] == "Data partenza fine" && (params[i][1] != "")) {
-
- data_partenza_fine = data_partenza_inizio + " && ?time_send <= \""+ params[i][1] +"\"^^xsd:date)";
- }
- if (params[i][0] == "Data arrivo inizio" && (params[i][1] != "")) {
- dai = " ?receive_date";
- letter_event = "?subject crm:P25i_moved_by ?mov_ev . \
- ?send rdfs:subClassOf ?mov_ev ; \
- rdf:type crm:EL2_Send_Letter . \
- ?receive rdfs:subClassOf ?mov_ev; \
- rdf:type crm:EL3_Receive_Letter . ";
- data_arrivo_inizio = "?receive crm:P4_has_time-span ?uri_receive_date . \
- ?uri_receive_date rdfs:label ?receive_date ; \
- time:hasEnd ?time_receive . \
- FILTER (?time_receive >= \""+ params[i][1] +"\"^^xsd:date";
- }
- if (params[i][0] == "Data arrivo fine" && (params[i][1] != "")) {
-
- data_arrivo_fine = data_arrivo_inizio + " && ?time_receive <= \""+ params[i][1] +"\"^^xsd:date)";
- }
- if (params[i][0] == "Data inizio opera" && (params[i][1] != "")) {
- diop = " ?time_start";
- data_opera_inizio = "?event_start ?pp ?subject ; \
- crm:P2_has_type 'Inizio'^^<http://www.w3.org/2001/XMLSchema#string> ; \
- crm:P4_has_time-span ?uri_time_start . \
- ?uri_time_start rdfs:label ?time_start; \
- time:year ?date_start . \
- FILTER (?date_start >= \""+ params[i][1] +"\"^^xsd:integer)";
- }
- if (params[i][0] == "Data fine opera" && (params[i][1] != "")) {
- data_opera_fine = "FILTER (?date_start <= \""+ params[i][1] +"\"^^xsd:integer)";
- }
- }
- prefixes = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
- PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
- PREFIX owl: <http://www.w3.org/2002/07/owl#> \
- PREFIX schema: <http://schema.org/> \
- PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
- PREFIX person: <http://www.w3.org/ns/person#> \
- PREFIX time: <https://www.w3.org/TR/owl-time#>"
- query = prefixes + " SELECT DISTINCT ?subject ?label ?identifier " + dm + mt + locl + tec + at
- + sg + tt + tp + nt + rf + np + nf + pt + ln + lm + gr + dn + dts + oc + qf + ga + mit
- + des + lp + la + dp + da + dpi + dai + diop + lin + alin + ed + lem + dt + st + ttx + " \
- WHERE {GRAPH " + search_graph + " {?subject ?property ?object } \
- ?subject rdfs:label ?label . "
- + search_identifier + infObj + letter_event + label + search_type + dimensione + materia + localizzazione + tecnica
- + artista + titolo + tipo + note + riferimenti + nome_proprio + nome_di_famiglia
- + patronimico + luogo_di_Nascita + luogo_di_Morte + genere + data_di_Nascita
- + data_di_Morte + qualifica + occupazione + gruppi_di_appartenenza + mittente + destinatario
- +luogo_di_Partenza + luogo_di_Arrivo + data_partenza_fine + data_arrivo_fine + data_opera_inizio + data_opera_fine + lingua
- + area_linguistica + edizione + lemma + data + identificatore + start + finish + testo + "}"
- var query_url = endpoint + '/?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json';
- console.log(query);
- $.ajax({
- url: query_url + '&callback=?',
- dataType: "json",
- success: function (data) {
- query_handle_json(data, choosen_type);
- },
- error: function (e) {}
- });
- }
- function query_handle_json(json, choosen_type) {
- console.log(json);
- var resulType = "";
- if (choosen_type == "Object") {
- resulType = "object";
- }
- if (choosen_type == "Letter") {
- resulType = "object";
- }
- if (choosen_type == "OA") {
- resulType = "artwork";
- }
- if (choosen_type == "Person") {
- resulType = "persona";
- }
- $('#query_results').text("");
- var i = 0;
- const first_row = [];
- $.each(
- json['head']['vars'],
- function (index, value) {
- first_row.push(value);
- });
- var t_head = '<div class="row t_head">';
- for (let k = 1; k < first_row.length; k++) {
- var param = renameCol(first_row[k]);
- t_head += '<div class="col-auto">' + param + '</div>';
- }
- t_head += '</div>';
- $('#query_results').append(t_head);
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var object = "";
- var link = value['subject']['value'];
- var label = value['label']['value'];
- object += '<div class="row"><div id="' + link + '" class="col-auto link ' + resulType + '">' + label + '</div>';
- if (value.hasOwnProperty('identifier')) {
- identifier = value['identifier']['value'];
- object += '<div class="col-auto">' + identifier + '</div>';
- }
- if (value.hasOwnProperty('dimension')) {
- dimension = value['dimension']['value'];
- object += '<div class="col-auto">' + dimension + '</div>';
- }
- if (value.hasOwnProperty('material')) {
- material = value['material']['value'];
- object += '<div class="col-auto">' + material + '</div>';
- }
- if (value.hasOwnProperty('location')) {
- localization = value['location']['value'];
- object += '<div class="col-auto">' + localization + '</div>';
- }
- if (value.hasOwnProperty('technique')) {
- technique = value['technique']['value'];
- object += '<div class="col-auto">' + technique + '</div>';
- }
- if (value.hasOwnProperty('artist')) {
- artist = value['artist']['value'];
- object += '<div class="col-auto">' + artist + '</div>';
- }
- if (value.hasOwnProperty('depiction')) {
- depiction = value['depiction']['value'];
- object += '<div class="col-auto">' + depiction + '</div>';
- }
- if (value.hasOwnProperty('title')) {
- title = value['title']['value'];
- object += '<div class="col-auto">' + title + '</div>';
- }
- if (value.hasOwnProperty('type')) {
- type = value['type']['value'];
- object += '<div class="col-auto">' + type + '</div>';
- }
- if (value.hasOwnProperty('note')) {
- note = value['note']['value'];
- object += '<div class="col-auto">' + note + '</div>';
- }
- if (value.hasOwnProperty('ref')) {
- ref = value['ref']['value'];
- object += '<div class="col-auto">' + ref + '</div>';
- }
- if (value.hasOwnProperty('givenName')) {
- givenName = value['givenName']['value'];
- object += '<div class="col-auto">' + givenName + '</div>';
- }
- if (value.hasOwnProperty('familyName')) {
- familyName = value['familyName']['value'];
- object += '<div class="col-auto">' + familyName + '</div>';
- }
- if (value.hasOwnProperty('patronymic')) {
- patronymic = value['patronymic']['value'];
- object += '<div class="col-auto">' + patronymic + '</div>';
- }
- if (value.hasOwnProperty('birthPlace')) {
- birthPlace = value['birthPlace']['value'];
- object += '<div class="col-auto">' + birthPlace + '</div>';
- }
- if (value.hasOwnProperty('deathPlace')) {
- deathPlace = value['deathPlace']['value'];
- object += '<div class="col-auto">' + deathPlace + '</div>';
- }
- if (value.hasOwnProperty('genere')) {
- genere = value['genere']['value'];
- object += '<div class="col-auto">' + genere + '</div>';
- }
- if (value.hasOwnProperty('Birth_TS')) {
- Birth_TS = value['Birth_TS']['value'];
- object += '<div class="col-auto">' + Birth_TS + '</div>';
- }
- if (value.hasOwnProperty('Death_TS')) {
- Death_TS = value['Death_TS']['value'];
- object += '<div class="col-auto">' + Death_TS + '</div>';
- }
- if (value.hasOwnProperty('qualification')) {
- qualification = value['qualification']['value'];
- object += '<div class="col-auto">' + qualification + '</div>';
- }
- if (value.hasOwnProperty('occupation')) {
- occupation = value['occupation']['value'];
- object += '<div class="col-auto">' + occupation + '</div>';
- }
- if (value.hasOwnProperty('group')) {
- group = value['group']['value'];
- object += '<div class="col-auto">' + group + '</div>';
- }
- if (value.hasOwnProperty('mittente')) {
- mittente = value['mittente']['value'];
- object += '<div class="col-auto">' + mittente + '</div>';
- }
- if (value.hasOwnProperty('destinatario')) {
- destinatario = value['destinatario']['value'];
- object += '<div class="col-auto">' + destinatario + '</div>';
- }
- if (value.hasOwnProperty('luogo_partenza')) {
- luogo_partenza = value['luogo_partenza']['value'];
- object += '<div class="col-auto">' + luogo_partenza + '</div>';
- }
- if (value.hasOwnProperty('luogo_arrivo')) {
- luogo_arrivo = value['luogo_arrivo']['value'];
- object += '<div class="col-auto">' + luogo_arrivo + '</div>';
- }
- if (value.hasOwnProperty('timeSpanSend')) {
- timeSpanSend = value['timeSpanSend']['value'];
- object += '<div class="col-auto">' + timeSpanSend + '</div>';
- }
- if (value.hasOwnProperty('timeSpanReceive')) {
- timeSpanReceive = value['timeSpanReceive']['value'];
- object += '<div class="col-auto">' + timeSpanReceive + '</div>';
- }
- if (value.hasOwnProperty('lingua')) {
- lingua = value['lingua']['value'];
- object += '<div class="col-auto">' + lingua + '</div>';
- }
- if (value.hasOwnProperty('area_linguistica')) {
- area_linguistica = value['area_linguistica']['value'];
- object += '<div class="col-auto">' + area_linguistica + '</div>';
- }
- if (value.hasOwnProperty('edizione')) {
- edizione = value['edizione']['value'];
- object += '<div class="col-auto">' + edizione + '</div>';
- }
- if (value.hasOwnProperty('lemma')) {
- lemma = value['lemma']['value'];
- object += '<div class="col-auto">' + lemma + '</div>';
- }
- if (value.hasOwnProperty('testo')) {
- testo = value['testo']['value'];
- object += '<div class="col-auto">' + testo + '</div>';
- }
- if (value.hasOwnProperty('date')) {
- date = value['date']['value'];
- object += '<div class="col-auto">' + date + '</div>';
- }
- if (value.hasOwnProperty('start')) {
- start = value['start']['value'];
- object += '<div class="col-auto">' + start + '</div>';
- }
- if (value.hasOwnProperty('end')) {
- end = value['end']['value'];
- object += '<div class="col-auto">' + end + '</div>';
- }
- if (value.hasOwnProperty('send_date')) {
- send_date = value['send_date']['value'];
- object += '<div class="col-auto">' + send_date + '</div>';
- }
- if (value.hasOwnProperty('receive_date')) {
- receive_date = value['receive_date']['value'];
- object += '<div class="col-auto">' + receive_date + '</div>';
- }
- if (value.hasOwnProperty('time_start')) {
- opera_start = value['time_start']['value'];
- object += '<div class="col-auto">' + opera_start + '</div>';
- }
- object += '</div>';
- i++;
- /*onclick=copy__Text("' + value['link']['value'] + '")*/
- $('#query_results').append(object);
-
- });
- if (i==0) {
- var message = '<p>Nessun risultato trovato</p>';
- $('#query_results').append(message);
- }
- $('#Loader').css("display", "none");
- document.getElementById("n_res").innerHTML = i;
- }
- function populateSelGraph(graphType) {
- let y = graphArray.length;
- collection_selector.innerHTML = "";
- if (graphType != "General") {
- collection_selector.style.color = '#202122';
- collection_selector.style.cursor = 'pointer';
- collection_selector.style.backgroundColor = '#f8f9fa';
- collection_selector.style.backgroundImage = 'linear-gradient(to top, #fff, #fff 33%)';
- } else {
- collection_selector.style.color = '#a1a1a1';
- collection_selector.style.cursor = 'not-allowed';
- collection_selector.style.backgroundColor = '#eee';
- collection_selector.style.backgroundImage = 'linear-gradient(to top, #ddd, #eee 33%)';
- }
- var genOpt = document.createElement("option");
- genOpt.value= "";
- genOpt.innerHTML = "Tutte";
- collection_selector.add(genOpt);
- for(var i=0; i<y; i++) {
- if (graphType == graphArray[i][2]) {
- 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
- collection_selector.add(opt);
- }
- }
- }
- function renameCol(param) {
- if (param == "label") {
- return ("Denominazione");
- }
- else if (param == "identifier") {
- return ("Identificatore");
- }
- else if (param == "dimension") {
- return ("Dimensioni");
- }
- else if (param == "material") {
- return ("Materiale");
- }
- else if (param == "location") {
- return ("Istituto di conservazione");
- }
- else if (param == "technique") {
- return ("Tecnica");
- }
- else if (param == "artist") {
- return ("Artista");
- }
- else if (param == "depiction") {
- return ("Soggetto");
- }
- else if (param == "title") {
- return ("Titolo");
- }
- else if (param == "type") {
- return ("Tipologia");
- }
- else if (param == "note") {
- return ("Note");
- }
- else if (param == "ref") {
- return ("Riferimenti");
- }
- else if (param == "givenName") {
- return ("Nome proprio");
- }
- else if (param == "familyName") {
- return ("Cognome");
- }
- else if (param == "birthPlace") {
- return ("Luogo di Nascita");
- }
- else if (param == "deathPlace") {
- return ("Luogo di morte");
- }
- else if (param == "genere") {
- return ("Genere");
- }
- else if (param == "Birth_TS") {
- return ("Data di nascita");
- }
- else if (param == "Death_TS") {
- return ("Data di morte");
- }
- else if (param == "qualification") {
- return ("Qualifica");
- }
- else if (param == "occupation") {
- return ("Occupazione");
- }
- else if (param == "mittente") {
- return ("Mittente");
- }
- else if (param == "destinatario") {
- return ("Destinatario");
- }
- else if (param == "luogo_partenza") {
- return ("Luogo di partenza");
- }
- else if (param == "luogo_arrivo") {
- return ("Luogo di arrivo");
- }
- else if (param == "timeSpanSend") {
- return ("Data partenza");
- }
- else if (param == "timeSpanReceive") {
- return ("Data arrivo");
- }
- else if (param == "area_linguistica") {
- return ("Area linguistica");
- }
- else if (param == "edizione") {
- return ("Edizione");
- }
- else if (param == "lemma") {
- return ("Lemma");
- }
- else if (param == "testo") {
- return ("Testo");
- }
- else if (param == "date") {
- return ("Data");
- }
- else if (param == "start") {
- return ("Data");
- }
- else if (param == "end") {
- return ("Fine");
- }
- else if (param == "send_date") {
- return ("Data partenza");
- }
- else if (param == "receive_date") {
- return ("Data arrivo");
- }
- else if (param == "time_start") {
- return ("Data");
- }
- else {
- return (param);
- }
- }
- function download_table_as_csv(separator = ',') {
- // Select rows from table_id
- var rows = document.querySelectorAll('#query_results .row');
- // Construct csv
- var csv = [];
- for (var i = 0; i < rows.length; i++) {
- var row = [], cols = rows[i].querySelectorAll('.col-auto');
- for (var j = 0; j < cols.length; j++) {
- // Clean innertext to remove multiple spaces and jumpline (break csv)
- var data = cols[j].innerText.replace(/(\r\n|\n|\r)/gm, '').replace(/(\s\s)/gm, ' ')
- // Escape double-quote with double-double-quote (see https://stackoverflow.com/questions/17808511/properly-escape-a-double-quote-in-csv)
- data = data.replace(/"/g, '""');
- // Push escaped string
- row.push('"' + data + '"');
- }
- csv.push(row.join(separator));
- }
- var csv_string = csv.join('\n');
- // Download it
- var filename = 'export_queryResults_' + new Date().toLocaleDateString() + '.csv';
- var link = document.createElement('a');
- link.style.display = 'none';
- link.setAttribute('target', '_blank');
- link.setAttribute('href', 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv_string));
- link.setAttribute('download', filename);
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- }
|