lambdamusic
2/7/2013 - 9:26 PM

Python: Open an RDF graph

Python: Open an RDF graph

import rdflib
# added one comment 

from rdflib.Graph import Graph
g = Graph()

myfile = "/Users/mac/Code/Java/Jena-2.3/doc/inference/data/demoData.rdf"
g.parse(myfile, format="xml")

print "the lenght of the graph is: ", len(g)

for st in g:
    print st