SPARQL Query Collection
Examples to find your way through the Culture Knowledge Graph
The following collection of SPARQL queries is designed to provide an entry point into the Culture Knowledge Graph. Each example illustrates a typical use case, from simple counts to structured retrieval of entities, and can be adapted to more complex queries. You can live execute all queries by clicking on the little paper plane icon in the top right corner of each query.
Basic Queries
Count all triples
| Query |
|---|
| PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT (COUNT (*) AS?tripleCount) WHERE {
?s ?p ?o
}
|
List of all types
| Query |
|---|
| SELECT ?type (COUNT (?s) AS ?instanceCount)
WHERE {
?s a ?type .
}
GROUP BY ?type
ORDER BY DESC(?instanceCount)
|