Semantic knowledge base
Federated queries do sound like a complex area of the semantic technologies environment but are quite simply to understand if approached by components.
We have designed an example of a federated query that perfectly describes how such a technique can make use of existing alignments to enrich one resource with properties found in another. In addition it does this by using an intermediary dataset. This example shows the power behind the Linked Open Data principles.
We have started with 3 resources:
Not all of them are linked directly, but alignments have been done between the following pairs:
- EuroVoc – wikidata.org
- EuroVoc - Country Authority table
The demonstration will make use of both alignments to associate a set of properties from wikidata.org to a concept found in the Country Authority table.
The objective will be to find some properties that define the concept Luxembourg, that in the Country Authority table is identified with the following URI: http://publications.europa.eu/resource/authority/country/LUX
The relation will be constructed using the two existing alignments and accessing the datasets thru their respective SPARQL endpoints.
The federated query will be executed on the SPARQL endpoint of the Publications Office ( http://publications.europa.eu/webapi/rdf/sparql ) where the Country Authority table can be found.
The other two resources will be accessed on their SPARQL endpoints as well:
- for EuroVoc, we will use the same SPARQL endpoint of the Publications office: http://publications.europa.eu/webapi/rdf/sparql
- for wikidata.org: https://query.wikidata.org/sparql
In summary, the scope of the query is to add to a country concept fund in the Country Authority table a set of properties from wikidata.org, using the link that EuroVoc creates between those two resources.
The SPARQL script is listed below with the necessary comments to make it easy to understand.
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX
wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Define the structure of the result
SELECT ?countryLabel
?capital ?headOfGov ?population ?flag ?anthem ?geoshape
WHERE {
# Extract the EuroVoc URI of the concept from the Country
Authority table
service
<http://publications.europa.eu/webapi/rdf/sparql> {
# Identify the EuroVoc ID of the Country concept
?EuroVocID skos:closeMatch|skos:exactMatch
<http://publications.europa.eu/resource/authority/country/LUX> .
# Select the prefLabel (preferred label) of the
concept
?EuroVocID skos:prefLabel ?countryLabel
# Keep just the English version of the prefLabel
FILTER (lang(?countryLabel)="en").
}
# Indicate the SPARQL endpoint where EuroVoc mappings can be
found
service
<http://publications.europa.eu/webapi/rdf/sparql> {
# Get the Wikidata URI associated with the EuroVoc
concepts
?EuroVocID skos:closeMatch|skos:exactMatch
?wikiURI .
}
# Look into the SPARQL endpoint of wikidata.org
service
<https://query.wikidata.org/sparql> {
# Get Wikidata properties associated with the URI
?wikiURI wdt:P36 ?capital .
?wikiURI wdt:P6 ?headOfGov
.
?wikiURI wdt:P1082 ?population .
?wikiURI
wdt:P41 ?flag .
?wikiURI wdt:P85 ?anthem .
?wikiURI wdt:P3896 ?geoshape
}
}
Labels
Recentste
How to extract a list of concepts from a vocabulary
18 september 2024
About the use of Authority tables
12 augustus 2024
Identifiers and how to use more than one
6 oktober 2022
useContext property and how to use it
18 mei 2022
Dissemination formats
24 januari 2022
Resource alignments: Main elements of a proper methodology
23 oktober 2021
Semantic technologies in practice
23 oktober 2021
About reference data
23 oktober 2021
|
Populairste
Dissemination formats
57020 Weergaven
useContext property and how to use it
55467 Weergaven
Resource alignments: Main elements of a proper methodology
54240 Weergaven
About the use of Authority tables
53200 Weergaven
Labels and data models, why and how to use them
52491 Weergaven
Identifiers and how to use more than one
50444 Weergaven
About reference data
37808 Weergaven
Semantic technologies in practice
36004 Weergaven
|