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
}
}
Najnovije
How to extract a list of concepts from a vocabulary
2024. rujna 18
About the use of Authority tables
2024. kolovoza 12
Identifiers and how to use more than one
2022. listopada 06
useContext property and how to use it
2022. svibnja 18
Labels and data models, why and how to use them
2022. svibnja 05
Dissemination formats
2022. siječnja 24
Resource alignments: Main elements of a proper methodology
2021. listopada 23
Semantic technologies in practice
2021. listopada 23
About reference data
2021. listopada 23
|
Najpopularniji
Dissemination formats
57020 Pregledi
useContext property and how to use it
55467 Pregledi
Resource alignments: Main elements of a proper methodology
54240 Pregledi
About the use of Authority tables
53200 Pregledi
Labels and data models, why and how to use them
52491 Pregledi
Identifiers and how to use more than one
50444 Pregledi
About reference data
37808 Pregledi
Semantic technologies in practice
36004 Pregledi
|