Created
April 8, 2011 19:32
-
-
Save JeniT/910558 to your computer and use it in GitHub Desktop.
These SPARQL queries can be run on http://services.data.gov.uk/reference/sparql. The first gets a list of public bodies in the triplestore (which includes all departments but not all public bodies). The second gets a list of units and the public body that
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX gov: <http://reference.data.gov.uk/def/central-government/> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
SELECT DISTINCT ?body ?label | |
WHERE { | |
{ ?body a gov:PublicBody . } | |
UNION | |
{ ?body a gov:Department . } | |
?body rdfs:label ?label . | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX gov: <http://reference.data.gov.uk/def/central-government/> | |
PREFIX org: <http://www.w3.org/ns/org#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
SELECT DISTINCT ?unit ?label ?body | |
WHERE { | |
?unit org:unitOf ?body . | |
?unit rdfs:label ?label . | |
} |
Figured it out, I needed to add a foaf PREFIX to top of query:
PREFIX gov: <http://reference.data.gov.uk/def/central-government/> PREFIX org: <http://www.w3.org/ns/org#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * WHERE { ?unit gov:hasPost ?hasPost . ?unit org:unitOf ?unitOf . ?unit rdfs:label ?unitLabel . ?hasPost rdfs:comment ?hasPostComment . ?hasPost gov:heldBy ?heldBy . ?heldBy foaf:phone ?phone . ?heldBy foaf:name ?name . ?heldBy foaf:mbox ?mbox . } LIMIT 4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do I get the name, phone, email for a person holding a post with a unit?
This query works to get posts by unit:
I tried this to get phone numbers and it didn't work: