-
-
Save jindrichmynarz/a947af0712682e0d23584719f0b6b400 to your computer and use it in GitHub Desktop.
SPARQL: It's just HTTP!
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
#!/usr/bin/env python | |
import urllib | |
from rdflib import Graph | |
def main(): | |
endpoint = "https://query.wikidata.org/sparql" | |
query = """ | |
CONSTRUCT WHERE { | |
?s ?p ?o . | |
} | |
LIMIT 10 | |
""" | |
url = endpoint + "?" + urllib.urlencode({"query": query}) | |
g = Graph() | |
g.parse(url) | |
print(g.serialize(format = "n3")) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment