Skip to content

Instantly share code, notes, and snippets.

@jvsoest
Last active May 17, 2017 09:33
Show Gist options
  • Save jvsoest/b66afe91f4035c57efd315b4263b56f7 to your computer and use it in GitHub Desktop.
Save jvsoest/b66afe91f4035c57efd315b4263b56f7 to your computer and use it in GitHub Desktop.
bio2rdf_location.sparql
prefix dcterm: <http://purl.org/dc/terms/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ctvoc: <http://bio2rdf.org/clinicaltrials_vocabulary:>
prefix ctres: <http://bio2rdf.org/clinicaltrials_resource:>
prefix ct: <http://bio2rdf.org/clinicaltrials:>
select ?trial ?location ?cityName ?countryName
where {
BIND(ct:NCT00005636 AS ?trial).
?trial ctvoc:location ?locationRes.
?locationRes dcterm:title ?location.
?locationRes ctvoc:address ?addressRes.
?addressRes ctvoc:city ?city.
?addressRes ctvoc:country ?country.
?addressRes ctvoc:zip ?zip.
BIND (IRI(CONCAT("http://bio2rdf.org/", ?city)) AS ?cityRes).
?cityRes dcterm:title ?cityName.
BIND (IRI(CONCAT("http://bio2rdf.org/", ?country)) AS ?countryRes).
?countryRes dcterm:title ?countryName.
BIND (IRI(CONCAT("http://bio2rdf.org/", ?zip)) AS ?zipRes).
OPTIONAL {?zipRes dcterm:title ?zipCode.}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment