Skip to content

Instantly share code, notes, and snippets.

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/af18f8c985fa0698ba8a62aa46858e8d to your computer and use it in GitHub Desktop.
Save cosmin-marginean/af18f8c985fa0698ba8a62aa46858e8d to your computer and use it in GitHub Desktop.
BODS RDF - Ultimate parents ownership chain
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 ?parentName ?childName
WHERE {
?ultimateParent bods:ownsOrControls* ?parent .
?ultimateParent rdf:type bods:Entity .
?parent foaf:name ?parentName .
?parent bods:ownsOrControls ?child .
?child foaf:name ?childName .
?child bods:ownsOrControls* bods-res:openownership-register-12337862642105981237.
FILTER NOT EXISTS {
?s bods:ownsOrControls ?ultimateParent .
?s rdf:type bods:Entity .
}
}
GROUP BY ?parentName ?childName # To avoid duplicate entries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment