Introduction #
In 007, we constructed a query that accessed all persons, returning a CSV result that contained basic information on 200,034 individuals.† In this entry, we do the same for activities.
The reason to treat it as a separate entry is that there are many more activities (4,764,209 as of 05-04-2026). A “naive” SPARQL query, structured on the lines in 007, won’t work. There are too many resources to be accessed, too many triples to check, and too much data to be sent back to the user via the endpoint. The method outlined here is tailored more to the particular data storage structure of GPI’s LOD data. For this reason, it works. In this entry, we introduce a slightly different access method, one that will be used minimally in SPRQL (largely because it adds a layer of complexity that doesn’t help newcomers understand the structure and logic of queries): querying by “named graph.”
What is a named-graph? It would be helpful to consult the Wikipedia article, which is relatively detailed. But in our case, it is the difference between individual RDF files, which contain triples, and the JSON-LD files that are the primary contact point for Provenance—and that are synonymous with the URIs that we use to refer to resources.
RDF is the basis on which a newcomer learns about semantic, linked data in courses and introductory videos. Individual files that contain “triples” (combinations of subject-predicate-object that structure graph connections to other resources). This isn’t to say RDF is obsolete—but there are layers on top that can help to structure masses of RDF files. Named graphs are such a layer. In our case, the named graphs are entities (persons, activities, groups) that are represented by JSON-LD files
Query #
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?s WHERE {
graph ?s {
?s rdf:type crm:E7_Activity .
}
}
Commentary #
- Line 4: This is the line that instructs the query to proceed by named graphs. There is no further modification of the script. The only difference between this and a naive script that queries all of the triples in the triple store is that this one resolves faster, and therefore works.
Notes #
†: Over time, data cleaning and project contributions will change that number. As of 06-04-2026, the number is 195,939.