SPARQL API Documentation
The SPARQL API allows you to use the SPARQL Query language to interact with Europeana’s database, and lets you 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 starting to use 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 sparql.dev tutorial and Wikidata SPARQL tutorial. We also recommend the SPARQL for humanists page to help you dive into the SPARQL Query Language.
The SPARQL API is powered by a separate database (Virtuoso) which reflects the state of the Europeana datasets as of July 2017. We are working on a monthly update for this endpoint so that it is kept in sync with the main Europeana APIs.
Getting Started
Things to know before starting
Europeana data is represented as triples:
<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, the following triple
<http://data.europeana.eu/item/90402/RP_P_1984_87> <http://purl.org/dc/terms/created> "1827 - 1832" .
explains that for the item that you can find at this URL (the subject) has a metadata field called dcTerms:created (the predicate) that is filled with the value “1827-1832”. The cultural heritage object at that URL was, in other words, created between 1827 and 1832.
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.
Where is the endpoint available?
https://sparql.europeana.eu/
A first query
1. Add your prefixes by selecting them in the SPARQL editor as described above.
2. Then SELECT the things you want to find and define names for these variables.
3. Define the variables
4. Define a LIMIT
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.
More examples of SPARQL Queries
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).