Skip to content

Instantly share code, notes, and snippets.

@cosmin-marginean
Created February 6, 2023 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosmin-marginean/db21b51e88841c5848580584d286dbcc to your computer and use it in GitHub Desktop.
Save cosmin-marginean/db21b51e88841c5848580584d286dbcc to your computer and use it in GitHub Desktop.
BODS RDF - Identifying ultimate parents for a target
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bods: <http://bods.openownership.org/vocabulary/>
PREFIX bods-res: <http://bods.openownership.org/resource/>
SELECT ?ultimateParent ?ultimateParentName
WHERE {
?ultimateParent bods:ownsOrControls+ bods-res:openownership-register-12337862642105981237 .
?ultimateParent foaf:name ?ultimateParentName .
?ultimateParent rdf:type bods:Entity .
# An ultimate parent is an entity that isn't controlled by another entity
FILTER NOT EXISTS {
?s bods:ownsOrControls ?ultimateParent .
?s rdf:type bods:Entity .
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment