Skip to content

Instantly share code, notes, and snippets.

@ostephens
Created November 20, 2014 16:49
Show Gist options
  • Save ostephens/d2bd979968e28f62dfca to your computer and use it in GitHub Desktop.
Save ostephens/d2bd979968e28f62dfca to your computer and use it in GitHub Desktop.
BM Satires with one line per ID
PREFIX crm: <http://erlangen-crm.org/current/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX thes: <http://collection.britishmuseum.org/id/thesauri/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bmo: <http://collection.britishmuseum.org/id/ontology/>
PREFIX thesIdentifier: <http://collection.britishmuseum.org/id/>
SELECT DISTINCT ?id (GROUP_CONCAT(?title; SEPARATOR = "|") as ?titles) (GROUP_CONCAT(?name; SEPARATOR = "|") as ?names) (GROUP_CONCAT(?desc; SEPARATOR = "|") as ?descs) (GROUP_CONCAT(?date; SEPARATOR = "|") as ?dates)
{
?object crm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/294> .
OPTIONAL {
?object crm:P48_has_preferred_identifier ?id }.
OPTIONAL {
?object bmo:PX_physical_description ?desc } .
OPTIONAL {
?object crm:P108i_was_produced_by ?prodevent.
?prodevent crm:P9_consists_of ?prodpart .
?prodpart crm:P4_has_time-span ?timespan.
?timespan rdfs:label ?date} .
OPTIONAL {
?object crm:P108i_was_produced_by ?prodevent2.
?prodevent2 crm:P9_consists_of ?prodpart2 .
?prodpart2 crm:P14_carried_out_by ?creator.
?creator skos:prefLabel ?name .
?creator skos:inScheme thesIdentifier:person-institution}
OPTIONAL {
?object rdfs:label ?title }
}
GROUP BY ?id
@ostephens
Copy link
Author

This "improves" on the previous query (https://gist.github.com/ostephens/d2bd979968e28f62dfca) in that it groups all fields so the query produces only one line per 'preferred ID'.

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