Open an RDF graph


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import rdflib
  2.  
  3.  
  4. from rdflib.Graph import Graph
  5. g = Graph()
  6.  
  7. myfile = "/Users/mac/Code/Java/Jena-2.3/doc/inference/data/demoData.rdf"
  8. g.parse(myfile, format="xml")
  9.  
  10. print "the lenght of the graph is: ", len(g)
  11.  
  12. for st in g:
  13. print st

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.