SPARQL Endpoint

Europeana datasets can be explored, accessed and downloaded through the SPARQL endpoint.

Europeana datasets can be explored, accessed and downloaded through the SPARQL endpoint available at http://sparql.europeana.eu/sparql. The data can be downloaded in JSON or RDF.

The SPARQL endpoint reflects the current state of the Europeana datasets as in the portal europeana.eu and is regularly updated.

The terms of use and external data sources appearing at data.europeana.eu are provided on the Europeana Data sources page.

How to use the SPARQL endpoint

Things to know before starting

  • Europeana data is represented as a triple:
<subject> <predicate> <object>

Each subject, predicate and an object represent a node within Europeana’s network of resources. These statements are usually represented as URIs to which certain labels might correspond.

For instance

<http://data.europeana.eu/item/2021604/C2D27CB79870761BE291A3FACAB963F62D7CA39B> <http://purl.org/dc/terms/creator> “Moltzheim, A. de” .
  • A SPARQL query requires the declaration of PREFIXes that are shortcuts to the labels of given predicates.
  • The different packages of information contained in the Europeana data are described using several classes in the Europeana Data Model (EDM). We invite you to consult our Data structure page and the EDM documentation if you need more details on the model.
  • When formulating a query don’t forget to adjust the LIMIT value which indicates the number of results to be returned by the query. Note that the query may take longer if the number of results asked is high.
  • If you set a LIMIT value but still want to be able to select the range of results you will get within the dataset, adjust the OFFSET value.

A first query

  1. Add your prefixes by selecting them in the SPARQL editor as described above.

For instance a selection of the namespaces dc, edm and ore will give you:

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
  1. Then SELECT the things you want to find and define names for these variables.

We want all the results with a title, a creator, a media URL and a year.

SELECT ?title ?creator ?mediaURL ?year
  1. Define the variables
WHERE {
  ?item edm:type "SOUND" ;
      ore:proxyIn ?proxy;
      dc:title ?title ;
      dc:creator ?creator .
  ?proxy edm:isShownBy ?mediaURL .
  ?EuropeanaProxy edm:year ?year .
}

In this example you restrict the results to the resources with the edm:type SOUND.

  1. Define a LIMIT
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
SELECT ?title ?creator ?mediaURL ?date
WHERE {
  ?CHO edm:type "SOUND" ;
      ore:proxyIn ?proxy;
      dc:title ?title ;
      dc:creator ?creator ;
      dc:date ?date .
  ?proxy edm:isShownBy ?mediaURL .
}
LIMIT 100

You obtain all the first 100 SOUND resources which have a title, a creator, a media URL and a year.

How to define more complex queries

You can start defining more complex queries which will group, list, filter or order your results. The commands COUNT, GROUP BY and ORDER BY can be used for this purpose.

For instance we want to order our results by year (ascending order)

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
SELECT ?title ?creator ?mediaURL ?date
WHERE {
  ?CHO edm:type "SOUND" ;
      ore:proxyIn ?proxy;
      dc:title ?title ;
      dc:creator ?creator;
      dc:date ?date .
  ?proxy edm:isShownBy ?mediaURL .
  FILTER (?date > "1780" && ?date < "1930")
}
ORDER BY asc (?date)
LIMIT 100

You will notice that this type of query takes longer as we are asking to the database to not only return results but also to order them.

More examples of SPARQL queries

1. List of data providers which contributed content to Europeana

PREFIX edm: <http://www.europeana.eu/schemas/edm/>

SELECT ?DataProvider
WHERE { ?Aggregation edm:dataProvider ?DataProvider }`

2. List of datasets from Italy

PREFIX edm: <http://www.europeana.eu/schemas/edm/>

SELECT DISTINCT ?Dataset
WHERE {
  ?Aggregation edm:datasetName ?Dataset ;
      edm:country "Italy"
}
3. Objects provided to Europeana from the 18th and from France
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>

SELECT DISTINCT ?ProvidedCHO ?year
WHERE {
  ?Aggregation edm:aggregatedCHO ?ProvidedCHO ;
      edm:country "France" .
  ?Proxy ore:proxyFor ?ProvidedCHO ;
      edm:year ?year .
  FILTER (?year > "1700" && ?year < "1800")
}
ORDER BY asc(?year)
LIMIT 100
4. Listing of edm:Agent
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>

SELECT ?Agent
WHERE { ?Agent rdf:type edm:Agent }
LIMIT 100
5. Objects provided to Europeana linking to edm:Place
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>

SELECT DISTINCT ?ProvidedCHO
WHERE {
  ?Place rdf:type edm:Place .
  ?Proxy ?property ?Place ;
      ore:proxyIn ?Aggregation .
  ?Aggregation edm:aggregatedCHO ?ProvidedCHO
}
6. Objects provided to Europeana linking to skos:Concept from the Getty target vocabulary
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>

SELECT DISTINCT ?ProvidedCHO
WHERE {
  ?Concept rdf:type skos:Concept .
  FILTER strstarts(str(?Concept), "http://vocab.getty.edu/aat/") .
  ?Proxy ?property ?Concept ;
      ore:proxyIn ?Aggregation .
  ?Aggregation edm:aggregatedCHO ?ProvidedCHO
}
LIMIT 100

Further reading

For more details on SPARQL and its different commands, you can refer to those two resources:

We got inspired by these two blogs for writing this page

We thank the authors for their interest in data.europeana.eu!

See the Europeana LOD Google Group for a discussion on this topic.