Skip to content

Instantly share code, notes, and snippets.

@ewg118
Last active July 19, 2017 17:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewg118/799177277e06c17d6d1eb69818df1b5a to your computer and use it in GitHub Desktop.
Save ewg118/799177277e06c17d6d1eb69818df1b5a to your computer and use it in GitHub Desktop.
SPARQL query of British Museum endpoint to get RIC 6, 7, 8, 10 coins for normalization
PREFIX bmo: <http://collection.britishmuseum.org/id/ontology/>
PREFIX crm: <http://erlangen-crm.org/current/>
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?s ?regno ?mint ?auth ?ref WHERE {
{?s ecrm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/3189>}
UNION {?s ecrm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/5591>}
UNION {?s ecrm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/3191>}
UNION {?s ecrm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/3193>}
UNION {?s ecrm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/5624>}
?s ecrm:P1_is_identified_by ?d2 .
?d2 ecrm:P2_has_type <http://collection.britishmuseum.org/id/thesauri/identifier/regno>;
rdfs:label ?regno .
?s bmo:PX_display_wrap ?ref . FILTER regex(?ref, "RIC[1-9]").
?s bmo:PX_display_wrap ?authStr . FILTER strStarts(?authStr, "Authority").
BIND (strBefore(strAfter(?authStr, ":: "), " ::") as ?auth)
OPTIONAL {?s ecrm:P108i_was_produced_by ?prod .
?prod ecrm:P9_consists_of ?event .
?event ecrm:P2_has_type <http://collection.britishmuseum.org/id/thesauri/production/T> ;
ecrm:P7_took_place_at ?mintUri .
?mintUri skos:prefLabel ?mint}
FILTER contains(str(?s), 'CGR')
} LIMIT 5
@ewg118
Copy link
Author

ewg118 commented Jul 27, 2016

Updated query to filter coins with CGR in the URI (since there are three URIs per object in the collection). Added the mint into the query for parsing references when the page number is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment