Linked Data are a simple and standard method for publishing structured data on the web. Structured data that are linked together form a knowledge graph interpretable by machines using the semantics underlying the ontologies employed for publication. Each entity in the graph is a class from the ontology used to represent the information. Data are structured using the Resource Description Framework (RDF), a W3C standard, which uniquely identifies resources and assigns them a value through the triple structure:


subject, predicate, object

The use of RDF and SPARQL standards for querying, the assignment of unique URIs to resources, and the linking of data are the only rules that must be followed to publish Linked Data.


Once generated, RDF triples are stored in a triple store, which exposes a public SPARQL Endpoint that can be used to query the data.


SPARQL is pronounced like “sparkle” and is a recursive acronym meaning SPARQL Protocol And RDF Query Language. Although its syntax is relatively simple and reminiscent of the more widely known SQL, it is not always immediate or intuitive; a SPARQL query simply asks the system to extract all triples that match the triple patterns contained in the query’s WHERE clause.


Below are a series of example queries based on the environmental LOD data published on the Lazio Region endpoint.

Example Query

All measurement stations in the Region, with indications of their location and the network to which they belong

Execute Query
select  distinct ?stazione ?label ?placeLabel ?localita ?reteLabel

from <http://dati.lazio.it/lod/ambiente/> where {?stazione a <http://www.w3.org/ns/sosa/Platform>; rdfs:label ?label;

<http://www.w3.org/2006/vcard/ns#locality> ?localita;

<http://www.geonames.org/ontology#locatedIn> ?place; <http://purl.org/dc/terms/isPartOf> ?rete.

?place rdfs:label ?placeLabel.

?rete rdfs:label ?reteLabel.

} order by ?stazione

All stations in the municipality of Fiumicino

Execute Query
select  distinct *

from <http://dati.lazio.it/lod/ambiente/> where {?stazione a <http://www.w3.org/ns/sosa/Platform>; rdfs:label ?label;

<http://www.w3.org/2006/vcard/ns#locality> ?localita; <http://www.geonames.org/ontology#locatedIn> ?place.

?place rdfs:label ?placeLabel.

filter (regex(str(?placeLabel), 'fiumicino','i'))

}

All stations with the measured parameters

Execute Query
select  distinct ?stazione ?label ?placeLabel ?localita ?reteLabel ?labelGrandezza

from <http://dati.lazio.it/lod/ambiente/> where {?stazione a <http://www.w3.org/ns/sosa/Platform>; rdfs:label ?label;

<http://www.w3.org/2006/vcard/ns#locality> ?localita;

<http://www.geonames.org/ontology#locatedIn> ?place; <http://purl.org/dc/terms/isPartOf> ?rete.

?place rdfs:label ?placeLabel.

?rete rdfs:label ?reteLabel.

?grandezza <http://www.w3.org/ns/sosa/isHostedBy> ?stazione; rdfs:label ?labelGrandezza.} 

order by ?stazione

Hydrometric level data in Rome for the past month (daily measurements)

Execute Query
select  distinct ?stazione ?label ?localita ?labelSensor ?sensor ?labelObsProp ?observation ?value ?unitMeasure ?dataRil

from <http://dati.lazio.it/lod/ambiente/> where {?stazione a <http://www.w3.org/ns/sosa/Platform>; rdfs:label ?label;

<http://www.w3.org/2006/vcard/ns#locality> ?localita; <http://www.geonames.org/ontology#locatedIn> ?place.

?place rdfs:label ?placeLabel.

?sensor <http://www.w3.org/ns/sosa/isHostedBy> ?stazione; rdfs:label ?labelSensor.

?sensor <http://www.w3.org/ns/sosa/observes> ?obsProp.

?obsProp rdfs:label ?labelObsProp; <http://qudt.org/1.1/schema/qudt#unit> ?unitMeasure.

?observation <http://www.w3.org/ns/sosa/observedProperty> ?obsProp; <http://www.w3.org/ns/sosa/hasSimpleResult> ?value; <http://www.w3.org/ns/sosa/resultTime> ?dataRil; <http://schema.org/isRelatedTo> ?stazione

filter (?placeLabel = 'Roma')

filter (regex(str(?labelSensor),'idrometro','i'))

filter (regex(str(?labelObsProp),'Livello idrometrico giornaliero','i'))

filter ( str(?dataRil) >= '2020-05-11' AND str(?dataRil) <= '2020-05-18').

#filter (?stazione = <http://10.2.61.217/lod/station/pc_419600>)

}

order by ?dataRil