Europeana SPARQL API

The SPARQL API is different from the other Europeana APIs in that it allows you to explore connections between Europeana data and outside data sources, like VIAF, Iconclass, Getty Vocabularies (AAT), Geonames, Wikidata, and DBPedia. If you are looking for a way to delve into the structured metadata of Europeana (for instance, to ask the question "What are all the French 18th-century painters with at least five artworks available through Europeana'), this is the API for you. If you want to simply search Europeana in an unstructured way (for instance 'give me all results for the word 'cat'), then using the Search API is a better choice. SPARQL is part of Europeana's Linked Open Data initiative.

Before start using this API, we recommend reading the introduction page for an overview of the EDM model and reading the Terms of Use. If you want to get started with this API, go directly to the Getting Started section or try it out directly on the Console.

If you want to learn more about SPARQL, we recommend the How to SPARQL and Wikibooks SPARQL tutorial. We also recommend reading the Finding Europeana audio with SPARQL and SPARQL for humanists as they were the inspiration for us to provide this API.

Europeana Linked Open Data feeds Irish place name database

Europeana Linked Open Data feeds Irish place name database

Europeana Linked Open Data feeds Irish place name database See more
Amsterdam Museum Linked Open Data

Amsterdam Museum Linked Open Data

Amsterdam Museum Linked Open Data- The Linked Open Data Cloud connects items from various domains, including cultural heritage. By using unique web-identifiers (URIs) for objects and a common framework for describing them (RDF), and by linking to existing resources, a web of semantically-linked data emerges.

See more
ECLAP Linked Open Graph

ECLAP Linked Open Graph

ECLAP Linked Open Graph allows users to see, explore and browse the relationships among the ECLAP content and other types of resource created on the ECLAP platform.

See more

Update

The SPARQL API is powered by a separate database (Virtuoso) which reflects the current state of the Europeana datasets as in the main Europeana APIs and is regularly updated.

Credits

The initial pilots were set up by Ontotext under the framework of the Europeana Creative project and using the Ontotext GraphDB semantic repository (which has been replaced by Virtuoso).

Discussion

Besides our main discussion channels, we have a dedicated Europeana LOD Google Group for a discussion on this topic.

Getting Started

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/>

2. 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

3. 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.

4. 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

Example 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 }`

Example 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"
}

Example 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

Example 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

Example 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
}

Example 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
top