Skip to content

Instantly share code, notes, and snippets.

@ewg118
Created October 30, 2018 15:56
Show Gist options
  • Save ewg118/c2d5a24c919cbc9431df8ca142e95dc5 to your computer and use it in GitHub Desktop.
Save ewg118/c2d5a24c919cbc9431df8ca142e95dc5 to your computer and use it in GitHub Desktop.
Get the total number of specimens at the parent type level given subtypes in Seleucid Coins Online
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX dcmitype: <http://purl.org/dc/dcmitype/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX nmo: <http://nomisma.org/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?s (count(?coin) as ?count) WHERE {
?s a nmo:TypeSeriesItem ;
dcterms:source nm:seleucid_coins .
FILTER NOT EXISTS {?s skos:broader ?broader} .
OPTIONAL {
{?coin nmo:hasTypeSeriesItem ?type .
?type skos:broader ?s}
UNION {?coin nmo:hasTypeSeriesItem ?s}
}
} GROUP BY ?s ORDER BY ?s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment