Created
February 7, 2013 21:27
-
-
Save lambdamusic/4734397 to your computer and use it in GitHub Desktop.
Python: RDFlib: access a triple store in 5 lines of code
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
ed@rorty:~$ python | |
Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) | |
[GCC 4.4.1] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import rdflib | |
>>> graph = rdflib.Graph('Sleepycat') | |
>>> graph.open('my-store', create=True) | |
>>> graph.parse('http://dbpedia.org/resource/Semantic_Web') | |
>>> for object in graph.objects(predicate=rdflib.namespace.OWL.sameAs): | |
... print object | |
... | |
http://dbpedia.org/resource/Semantic_Web | |
http://rdf.freebase.com/ns/guid.9202a8c04000641f8000000000039a20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment