Query Semantic Resources

To query semantic resources, access the <a href="https://schema.gov.it/en/sparql/">Virtuoso SPARQL Endpoint Page</a> messo a disposizione da schema. Ti comparirà una schermata dove è possibile inserire una query da specificare utilizzando il <a href="https://www.w3.org/TR/sparql11-query/">SPARQL language</a>

<img class="alignnone wp-image-736" src="https://schema.gov.it/wp-content/uploads/2025/12/SPARQL-endpoint.png" alt="Descriptive image of the screen that allows you to write a SPARQL query" width="721" height="236" />

Once the query is written, you can select in which format to return the results. Several options are possible including HTML, CSV, JSON, and several RDF serializations such as RDF/Turtle, RDF/XML, and N-Triples.
By clicking on the “Execute Query” button, you can run the query to get the results you are looking for.
To cancel everything you typed and chose as a result, you can use the Reset button.

<img class="alignnone wp-image-737" src="https://schema.gov.it/wp-content/uploads/2025/12/SPARQL-opzioni-riguardanti-i-risultati.jpg" alt="Descriptive image of options regarding query result format, query execution and query cancellation " width="719" height="70" />

Note:

To facilitate the definition of the query, it is suggested to browse the various semantic resources currently published on the schema via the Web. The resources are navigable through software made available such as LODE and LodView. To do this, simply use the URI of the resources themselves in your browser.

Examples of SPARQL queries

Below are some examples of queries on schema semantic resources in natural language. Each query corresponds to a SPARQL query that can be executed by Virtuoso as described above.

Below are some examples of queries on schema semantic resources in natural language. Each query corresponds to a SPARQL query that can be executed by Virtuoso as described above.
<ul>
<li><strong>Quali sono i comuni italiani, con relativo codice belfiore, dell’archivio storico ad essere validi ad oggi?</strong>
<pre><code>PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX clv: &lt;https://w3id.org/italia/onto/CLV/&gt;
PREFIX ti: &lt;https://w3id.org/italia/onto/TI/&gt;
PREFIX l0: &lt;https://w3id.org/italia/onto/l0/&gt;
SELECT ?s ?ID ?idCadastral ?name ?starttime ?endTime
WHERE {?s a skos:Concept ;
skos:inScheme &lt;https://w3id.org/italia/controlled-vocabulary/territorial-classifications/cities&gt; ;
skos:notation ?ID ;
skos:prefLabel ?name ;
clv:hasSOValidity/ti:endTime ?endTime ;
clv:hasSOValidity/ti:startTime ?starttime ;
?identifier a clv:Identifier ;
clv:identifierType ?idType ;
l0:identifier ?idCadastral .
FILTER (str(?endTime)="9999-12-31")
FILTER (str(?idType) = "Codice Catastale")
FILTER (lang(?idType) = "it")
}</code></pre>
</li>
<li><strong>In quale risorsa semantica è definito il concetto di “Servizio Pubblico” e qual è la sua definizione?</strong>
<pre><code>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&gt;
PREFIX dct: &lt;http://purl.org/dc/terms/&gt;
SELECT ?URIResource ?titleResource ?URIConcept ?label ?definition
where {
?URIConcept rdfs:isDefinedBy ?URIResource ;
rdfs:label ?label ;
rdfs:comment ?definition .
?URIResource dct:title ?titleResource .
FILTER ((str(?label)="Servizio Pubblico"))
FILTER (lang(?label) = 'it')
FILTER (lang(?definition) = 'it')
FILTER (lang(?titleResource) = 'it')
}</code></pre>
</li>
<li><strong>What are the licenses that fall under the open license type?</strong>
<pre><code>PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX clv: &lt;https://w3id.org/italia/onto/CLV/&gt;
SELECT ?s ?ID ?name ?nameOpen
WHERE {?s a skos:Concept ;
skos:inScheme &lt;https://w3id.org/italia/controlled-vocabulary/licences&gt; ;
clv:hasRankOrder "3" ;
skos:notation ?ID ;
skos:prefLabel ?name ;
skos:broader*/skos:prefLabel ?nameOpen .
FILTER (str(?nameOpen)="Licenza Aperta")
FILTER (lang(?nameOpen) = 'it')
FILTER (lang(?name) = 'it')
}</code></pre>
</li>
<li><strong>Which are the Italian provinces valid to date and to which region do they belong?</strong>
<pre><code>PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX clv: &lt;https://w3id.org/italia/onto/CLV/&gt;
SELECT ?s ?province ?name ?IDISTATProv ?IDISTATReg ?nameRegion
WHERE {
?s a skos:Concept ;
skos:inScheme &lt;https://w3id.org/italia/controlled-vocabulary/territorial-classifications/provinces&gt; ;
skos:notation ?IDISTATProv ;
skos:prefLabel ?name ;
clv:acronym ?province ;
skos:broader ?region .
?region a skos:Concept ;
skos:inScheme &lt;https://w3id.org/italia/controlled-vocabulary/territorial-classifications/regions&gt; ;
skos:notation ?IDISTATReg ;
skos:prefLabel ?nameRegion .
}</code></pre>
<strong>Quali sono invece le città metropolitane?</strong>
<pre><code>PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
PREFIX clv: &lt;https://w3id.org/italia/onto/CLV/&gt;
PREFIX l0: &lt;https://w3id.org/italia/onto/l0/&gt;
SELECT ?s ?province ?name ?IDISTATProv ?IDISTATReg ?nameRegion ?identifier ?idMetropolitanCode
WHERE {
?s a skos:Concept ;
skos:inScheme &lt;https://w3id.org/italia/controlled-vocabulary/territorial-classifications/provinces&gt; ;
skos:notation ?IDISTATProv ;
skos:prefLabel ?name ;
clv:acronym ?province ;
clv:hasIdentifier ?identifier ;
skos:broader ?region .
?identifier a clv:Identifier ;
clv:identifierType ?idType ;
l0:identifier ?idMetropolitanCode .
?region a skos:Concept ;
skos:inScheme &lt;https://w3id.org/italia/controlled-vocabulary/territorial-classifications/regions&gt; ;
skos:notation ?IDISTATReg ;
skos:prefLabel ?nameRegion .
FILTER (str(?idType) = "Codice Città Metropolitana")
FILTER (lang(?idType) = 'it')
}</code></pre>
</li>
<li><strong>In quale risorsa semantica è definito il “Numero Civico”?</strong>
<pre><code>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&gt;
PREFIX dct: &lt;http://purl.org/dc/terms/&gt;
SELECT ?URIResource ?titleResource ?URIConcept ?label
where {
?URIConcept rdfs:isDefinedBy ?URIResource ;
rdfs:label ?label .
?URIResource dct:title ?titleResource .
FILTER ((str(?label)="Numero Civico"))
FILTER (lang(?label) = 'it')
FILTER (lang(?titleResource) = 'it')
}</code></pre>
</li>
</ul>