Skip to content

Instantly share code, notes, and snippets.

@edsu
Created January 6, 2009 04:22
Show Gist options
  • Save edsu/43667 to your computer and use it in GitHub Desktop.
Save edsu/43667 to your computer and use it in GitHub Desktop.
bibo.py
#!/usr/bin/env python
# awful hack to print out bibo classes, and the properties that hang off of
# them directly
import rdflib
g = rdflib.ConjunctiveGraph()
g.parse('http://purl.org/ontology/bibo/')
owl = rdflib.Namespace('http://www.w3.org/2002/07/owl#')
for klass in g.subjects(predicate=rdflib.RDF.type, object=owl.Class):
if not klass.startswith('http://purl.org/ontology/bibo/'):
continue
print
print klass
for property in g.subjects(predicate=rdflib.RDFS.domain, object=klass):
print " " + property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment