HOW-TO - GIOCOnDa Sparql endpoint

This page presents some examples of HOW-TO access the LOD datasets and get some data in one of the available formats (JSON, CSV, RDF/XML, Turtle, etc.) exposed by our SPARQL endpoint. Data from Tessin and Lombardy regions are available, which are identified, respectively, by "TI_" and "IT_" prefix in the graph name.


Query form

On the https://gioconda.supsi.ch/sparql page you can fill in some input fields of a form to run a SPARQL query to the GIOCOnDa platform, as shown in the following image:

Sparql endpoint

List of available datasets

As a first step, on the https://gioconda.supsi.ch/sparql you can run the default query with the "Run Query" button in order to see all the available dataset graphs (Graph IRIs) which a query can be made to. The IRI is used to identify the dataset in a query, by filling in the "Default Data Set Name (Graph IRI)" field at the top of the query page. IRIs that end with "_voc_{n}" represent reference vocabularies that are used by some of the other graphs.

For example, the "http://gioconda.supsi.ch:8890/IT_hotel" graph identifies the dataset of all the Lombardy hotels.


Writing a query

On the https://gioconda.supsi.ch/sparql page you can:


In the sparql query text some prefixes that identify specific ontologies should be included; they are defined according to the OntoPiA reference definition detailed on https://github.com/italia/daf-ontologie-vocabolari-controllati/

General prefixes
            prefix rdfs:     <http://www.w3.org/2000/01/rdf-schema#>
            prefix xsd:      <http://www.w3.org/2001/XMLSchema#>
            prefix cis:      <http://dati.beniculturali.it/cis/>
            prefix clvapit:  <https://w3id.org/italia/onto/CLV/>
            prefix smapit:   <https://w3id.org/italia/onto/SM/>
            prefix acapit:   <https://w3id.org/italia/onto/AccessCondition/>
            prefix pot:      <https://w3id.org/italia/onto/POT/>
            prefix poiapit:  <https://w3id.org/italia/onto/POI/>
            prefix accoapit: <https://w3id.org/italia/onto/ACCO/>
            prefix ti:       <https://w3id.org/italia/onto/TI/>
            prefix l0:       <https://w3id.org/italia/onto/l0/>
            prefix mu:       <https://w3id.org/italia/onto/MU/>
        

Example queries

The following examples show the settings and the corresponding results of some data.

Example 1 Museum

This query returns the list of all the museums in Tessin from the TI_musei dataset described by some properties such as name, coordinates (lat, lon), etc.

Tessin Museums (example graph http://gioconda.supsi.ch:8890/TI_musei)
            select * where {
                ?a a cis:Museum .
                optional{?a rdfs:label ?museum_name .}
                optional{?a cis:institutionalName ?museum_istitutional_name .}
                # site
                optional{
                    ?a cis:hasSite ?b .
                    # name
                    optional{?b rdfs:label ?site_name .}
                    # address
                    optional{
                        ?b cis:siteAddress ?c .
                        ?c clvapit:fulladdress ?full_address .
                    }
                    # geometry
                    optional{
                        ?b clvapit:hasGeometry ?d .
                        optional{?d rdfs:label ?epsg .}
                        optional{?d clvapit:coordinateSystem ?coordinate .}
                        optional{?d clvapit:lat ?lat .}
                        optional{?d clvapit:long ?lon .}
                    }
                }
                # discipline
                optional{
                    ?a cis:hasDiscipline ?e .
                    ?e rdfs:label ?discipline .
                }
                # online_contact_point
                optional{
                    ?a smapit:hasOnlineContactPoint ?f .
                    # email
                    optional{
                        ?f smapit:hasEmail ?g .
                        ?g smapit:emailAddress ?email .
                    }
                    # telephone
                    optional{
                        ?f smapit:hasTelephoneNumber ?h .
                        ?h smapit:telephoneNumber ?telephone .
                    }
                    # website
                    optional{
                        ?f smapit:hasWebSite ?i .
                        ?i smapit:URL ?website .
                    }
                }
                # access_condition
                optional{
                    ?a acapit:hasAccessCondition ?l .
                    # opening_closing_decription
                    optional{?l l0:description ?opening_closing_desccription .}
                    # closing_reason
                    optional{?l acapit:reasonClosure ?closing_reason .}
                    # admission_type notes
                    optional{
                        ?l acapit:hasAdmissionType ?m .
                        ?m l0:description ?admission_notes .
                    }
                }
                # offer
                optional{
                    ?a pot:hasTicket ?n .
                    # price_specification
                    optional{
                        ?n pot:hasPriceSpecification ?o .
                        ?o pot:hasCurrencyValue ?ticket_price .
                    }
                    # ticket
                    optional{
                        ?n pot:includes ?p .
                        ?p pot:name ?ticket_name .
                    }
                }
                # service
                optional{
                    ?a cis:providesService ?q .
                    ?q cis:name ?service_name .
                }
            }
        
Partial output
a museum_name museum_istitutional_name b site_name c full_address d epsg coordinate lat lon e discipline f g email h telephone i website l opening_closing_desccription closing_reason m admission_notes n o ticket_price p ticket_name q service_name
https://gioconda.supsi.ch:8890/resource/musei_TI/CulturalInstituteOrSite_Museum_Q29527382_museum
"Museo Vincenzo Vela"
https://gioconda.supsi.ch:8890/resource/musei_TI/PointOfInterest_Site_Q29527382_site
"Museo Vincenzo Vela"
https://gioconda.supsi.ch:8890/resource/musei_TI/Address_Q29527382_full_address
"Largo Vincenzo Vela, 5, 6853, Mendrisio, Svizzera"
https://gioconda.supsi.ch:8890/resource/musei_TI/Geometry_Q29527382_geometry
"EPSG:4326"
"WGS84"
"45.86403"
"8.95012"
https://gioconda.supsi.ch:8890/resource/musei_TI/OnlineContactPoint_Q29527382_online_contact_point https://gioconda.supsi.ch:8890/resource/musei_TI/Email_Q29527382_email
"mailto:museo.vela@bak.admin.ch"
https://gioconda.supsi.ch:8890/resource/musei_TI/Telephone_Q29527382_telephone_number
"+41-58-481-30-40"
https://gioconda.supsi.ch:8890/resource/musei_TI/WebSite_Q29527382_website
"http://www.museo-vela.ch"
https://gioconda.supsi.ch:8890/resource/musei_TI/CulturalInstituteOrSite_Museum_Q56876208_museum
"Casa Besta"
https://gioconda.supsi.ch:8890/resource/musei_TI/PointOfInterest_Site_Q56876208_site
"Casa Besta"
https://gioconda.supsi.ch:8890/resource/musei_TI/Address_Q56876208_full_address
"Borgo 276, 7743 Brusio, 7743, Brusio, Svizzera"
https://gioconda.supsi.ch:8890/resource/musei_TI/Geometry_Q56876208_geometry
"EPSG:4326"
"WGS84"
"46.255981637826"
"10.127085515344"
https://gioconda.supsi.ch:8890/resource/musei_TI/OnlineContactPoint_Q56876208_online_contact_point https://gioconda.supsi.ch:8890/resource/musei_TI/Email_Q56876208_email
"mailto:casabesta@polomuseale.ch"
https://gioconda.supsi.ch:8890/resource/musei_TI/Telephone_Q56876208_telephone_number
"+41-81-846-55-18"
https://gioconda.supsi.ch:8890/resource/musei_TI/WebSite_Q56876208_website
"https://www.brusio.ch/cultura-e-tempo-libero/attrattive/casa-besta"
https://gioconda.supsi.ch:8890/resource/musei_TI/CulturalInstituteOrSite_Museum_Q16574566_museum
"m.a.x.museo"
https://gioconda.supsi.ch:8890/resource/musei_TI/PointOfInterest_Site_Q16574566_site
"m.a.x.museo"
https://gioconda.supsi.ch:8890/resource/musei_TI/Address_Q16574566_full_address
"via Dante Alighieri 6, 6830, Chiasso, Svizzera"
https://gioconda.supsi.ch:8890/resource/musei_TI/Geometry_Q16574566_geometry
"EPSG:4326"
"WGS84"
"45.83694"
"9.02671"
https://gioconda.supsi.ch:8890/resource/musei_TI/OnlineContactPoint_Q16574566_online_contact_point https://gioconda.supsi.ch:8890/resource/musei_TI/Email_Q16574566_email
"mailto:info@maxmuseo.ch"
https://gioconda.supsi.ch:8890/resource/musei_TI/Telephone_Q16574566_telephone_number
"+41-91-695-08-88"
https://gioconda.supsi.ch:8890/resource/musei_TI/WebSite_Q16574566_website
"http://maxmuseo.ch"
https://gioconda.supsi.ch:8890/resource/musei_TI/CulturalInstituteOrSite_Museum_Q16574566_museum
"m.a.x.museo"
https://gioconda.supsi.ch:8890/resource/musei_TI/PointOfInterest_Site_Q16574566_site
"m.a.x.museo"
https://gioconda.supsi.ch:8890/resource/musei_TI/Address_Q16574566_full_address
"via Dante Alighieri 6, 6830, Chiasso, Svizzera"
https://gioconda.supsi.ch:8890/resource/musei_TI/Geometry_Q16574566_geometry
"EPSG:4326"
"WGS84"
"45.83694"
"9.02671"
https://gioconda.supsi.ch:8890/resource/musei_TI/OnlineContactPoint_Q16574566_online_contact_point https://gioconda.supsi.ch:8890/resource/musei_TI/Email_Q16574566_email
"mailto:info@maxmuseo.ch"
https://gioconda.supsi.ch:8890/resource/musei_TI/Telephone_Q16574566_telephone_number
"+41-91-695-08-88"
https://gioconda.supsi.ch:8890/resource/musei_TI/WebSite_Q16574566_website
"http://www.centroculturalechiasso.ch"


Example 2 Hotels

This query returns the list of all the hotels in Lombardy from the IT_hotel dataset described by some properties such as name, address, coordinates (lat, lon), etc.

Lombardy Hotel Accomodation (example graph http://gioconda.supsi.ch:8890/IT_hotel)

            select * where {
                ?a a accoapit:Accomodation .
                optional{?a rdfs:label ?type_name .}
                optional{?a poiapit:POIofficialName ?acco_name .}
                optional{?a accoapit:hasAccommodationClassification ?acco_classification .}
                optional{?a accoapit:hasAccommodationTypology ?acco_typology .}

                # address
                optional{
                    ?a clvapit:hasAddress ?c .
                    ?c clvapit:fulladdress ?full_address .
                }

                # geometry
                optional{
                    ?a clvapit:hasGeometry ?d .
                    optional{?d rdfs:label ?epsg .}
                    optional{?d clvapit:coordinateSystem ?coordinate .}
                    optional{?d clvapit:lat ?lat .}
                    optional{?d clvapit:long ?lon .}
                }

                # online_contact_point
                optional{
                    ?a smapit:hasOnlineContactPoint ?f .
                    # email
                    optional{
                        ?f smapit:hasEmail ?g .
                        ?g smapit:emailAddress ?email .
                    }
                    # telephone
                    optional{
                        ?f smapit:hasTelephoneNumber ?h .
                        ?h smapit:telephoneNumber ?telephone_fax .
                    }
                    # website
                    optional{
                        ?f smapit:hasWebSite ?i .
                        ?i smapit:URL ?website .
                    }
                }

                # offer
                optional{
                    ?a pot:hasOffer ?n .
                    # price_specification
                    optional{
                        ?n pot:hasPriceSpecification ?o .
                        ?o pot:hasCurrencyValue ?ticket_price .
                        ?o pot:hasCurrency ?p .
                        ?p rdfs:label ?currency
                    }
                }

                # image
                optional{
                    ?a smapit:hasImage ?q .
                    ?q smapit:URL ?image_url .
                }
            } order by ?acco_name
        
Partial output
a type_name acco_name acco_classification acco_typology c full_address d epsg coordinate lat lon f g email h telephone_fax i website n o ticket_price p currency q image_url
https://gioconda.supsi.ch:8890/resource/hotel_IT/Accomodation_9754523_accomodation
"13 CIME RESIDENCE, Residenze turistico alberghiere 3 stelle"
"13 CIME RESIDENCE"
https://w3id.org/italia/controlled-vocabulary/classifications-for-accommodation-facilities/accommodation-typology/A1 https://gioconda.supsi.ch:8890/resource/hotel_IT/Address_9754523_full_address
"VIA VEDIG, VALFURVA, SO, 23030"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Geometry_9754523_geometry
"EPSG:4326"
"WGS84"
"46.41208304"
"10.49403118"
https://gioconda.supsi.ch:8890/resource/hotel_IT/OnlineContactPoint_9754523_online_contact_point https://gioconda.supsi.ch:8890/resource/hotel_IT/Telephone_9754523_telephone_fax
"0342 925654"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Accomodation_9754523_accomodation
"13 CIME RESIDENCE, Residenze turistico alberghiere 3 stelle"
"13 CIME RESIDENCE"
https://w3id.org/italia/controlled-vocabulary/classifications-for-accommodation-facilities/accommodation-typology/A1 https://gioconda.supsi.ch:8890/resource/hotel_IT/Address_9754523_full_address
"VIA VEDIG, VALFURVA, SO, 23030"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Geometry_9754523_geometry
"EPSG:4326"
"WGS84"
"46.41208304"
"10.49403118"
https://gioconda.supsi.ch:8890/resource/hotel_IT/OnlineContactPoint_9754523_online_contact_point https://gioconda.supsi.ch:8890/resource/hotel_IT/Telephone_9754523_telephone_number
"0342 935368"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Accomodation_9501524_accomodation
"2 C, Alberghi 3 stelle"
"2 C"
https://w3id.org/italia/controlled-vocabulary/classifications-for-accommodation-facilities/accommodation-typology/A1 https://gioconda.supsi.ch:8890/resource/hotel_IT/Address_9501524_full_address
"VIA COLLI DI SANT' ERASMO 51, LEGNANO, MI, 20025"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Geometry_9501524_geometry
"EPSG:4326"
"WGS84"
"45.59590233"
"8.93326581"
https://gioconda.supsi.ch:8890/resource/hotel_IT/OnlineContactPoint_9501524_online_contact_point https://gioconda.supsi.ch:8890/resource/hotel_IT/Telephone_9501524_telephone_fax
"0331 440090"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Accomodation_9501524_accomodation
"2 C, Alberghi 3 stelle"
"2 C"
https://w3id.org/italia/controlled-vocabulary/classifications-for-accommodation-facilities/accommodation-typology/A1 https://gioconda.supsi.ch:8890/resource/hotel_IT/Address_9501524_full_address
"VIA COLLI DI SANT' ERASMO 51, LEGNANO, MI, 20025"
https://gioconda.supsi.ch:8890/resource/hotel_IT/Geometry_9501524_geometry
"EPSG:4326"
"WGS84"
"45.59590233"
"8.93326581"
https://gioconda.supsi.ch:8890/resource/hotel_IT/OnlineContactPoint_9501524_online_contact_point https://gioconda.supsi.ch:8890/resource/hotel_IT/Telephone_9501524_telephone_number
"0331 440159"