A user interface for the SPARQL endpoint is available at https://cdli.earth/resources/sparql.
Query
The interface contains three fields:
- Endpoint sets the SPARQL endpoint used for the query.
- Display sets the way the results of the query are displayed (see Result displays).
- Query is the SPARQL query that will be executed (see Examples).
Additionally, the interface shows a collapsible list of prefixes. These are automatically included in the query, so instead of <http://www.cidoc-crm.org/cidoc-crm/P87_is_identified_by> you can write crm:P87_is_identified_by.
Result displays
Table
The table displays the data as-is, though URIs are prefixed. The results are not paginated, so be sure to limit your query where necessary.
Network graph
The network graph can be used to show hierarchical structures as well as other relations between data points. Regular nodes are colored in gray, blank nodes in light blue, and literal values in white.
It connects the first parameter to each of the other parameters. Optionally, text can be added to each of those links with the ?edgeLabel parameter. To display human-readable labels for nodes, include an additional parameter suffixed with Label (e.g. ?genre and ?genreLabel). URIs in nodes are strongly compacted, but the full URI is visible when hovering over a node.
Map
The map view can display coordinates and associated data on a geographical map. It takes the parameter ?geometry for GeoJSON strings. Such data is available for the following entities:
- Collections are connected to their locations with
crm:P53_has_former_or_current_location. For these locations,geo:hasCentroidis available. - Proveniences are connected to their locations with
crm:P161_has_spatial_projection / crm:P189i_is_approximated_byandpleiades:hasLocation. For these locations,geo:hasCentroidand/orgeo:hasGeometryis available. - Regions are themselves locaations, and have
geo:hasGeometryavailable.
Additional fields are displayed in a popup. To display human-readable labels for nodes, include an additional parameter suffixed with Label (e.g. ?provenience and ?provenienceLabel).
Examples
Hierarchical view of genres
SELECT * WHERE {
?genre a cdli:terms\/type\/genre; rdfs:label ?genreLabel .
OPTIONAL { ?genre crm:P127_has_broader_term ?parent }
}
Map of proveniences associated with artifacts at Harvard University
SELECT ?provenience ?provenienceLabel ?geometry (COUNT(?artifact) AS ?count) WHERE {
VALUES ?collection { cdli:collections\/17 }
?artifact crm:P46i_forms_part_of ?collection ;
crma:AP21i_is_contained_in / crma:AP5i_was_partially_or_totally_removed_by / crm:P7_took_place_at / crm:P89_falls_within ?provenience .
?provenience crm:P161i_is_spatial_projection_of / rdfs:label ?provenienceLabel ;
crm:P189i_is_approximated_by / geo:hasCentroid / geo:asGeoJSON ?geometry .
} GROUP BY ?provenience ?provenienceLabel ?geometry
Federated query to fetch Wikimedia Commons images associated with artifacts
SELECT ?artifact ?wikidata ?image WHERE {
?artifact a crm:E22_Human-Made_Object; crm:P1_is_identified_by [
crm:P37i_was_assigned_by / crm:P14_carried_out_by cdli:external-resources\/267 ;
crm:P190_has_symbolic_content ?wikidataUri
] .
BIND(IRI(?wikidataUri) AS ?wikidata)
SERVICE <https://query.wikidata.org/sparql> {
?wikidata <http://www.wikidata.org/prop/direct/P18> ?image
}
}
Top 20 of seals with most impressions
SELECT ?seal ?sealLabel (COUNT(?impression) AS ?count) WHERE {
?seal crm:P16i_was_used_for / crm:P31_has_modified ?impression ;
rdfs:label ?sealLabel .
FILTER(?seal != cdli:P533185) # dummy composite seal for unidentified seals
} GROUP BY ?seal ?sealLabel ORDER BY DESC(?count) LIMIT 20