Posted By

magicrebirth on 12/22/09


Tagged

RDF rdflib


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adkatrit


Open an RDF graph


 / Published in: Python
 

  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  

You need to login to post a comment.