Created
July 31, 2013 20:40
-
-
Save lawlesst/6125944 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from vivo_utils import sparql | |
sparql = sparql.VIVOSparql() | |
sparql.login() | |
query = """ | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX vivo: <http://vivoweb.org/ontology/core#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
SELECT ?geoLocation ?label | |
WHERE | |
{ | |
?geoLocation rdf:type vivo:GeographicLocation | |
OPTIONAL { ?geoLocation rdfs:label ?label } | |
} | |
LIMIT 20 | |
""" | |
#Optionally pass in a filename or path to save the results to CSV. | |
#By default results will be saved to the current directory as results.csv | |
sparql.results_csv(query, filename="/tmp/myresults.csv") | |
sparql.logout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment