Skip to content

Instantly share code, notes, and snippets.

@edsu
Created December 2, 2010 22:47
Show Gist options
  • Select an option

  • Save edsu/726250 to your computer and use it in GitHub Desktop.

Select an option

Save edsu/726250 to your computer and use it in GitHub Desktop.
>>> g = rdflib.Graph()
>>> g.add((rdflib.URIRef('urn:uuid:0031'), rdflib.URIRef('http://example.com/foo'), rdflib.Literal('bar')))
>>> print g.serialize(format='nt')
<urn:uuid:0031> <http://example.com/foo> "bar" .
>>> print g.serialize(format='turtle')
@prefix ns1: <http://example.com/> .
<urn:uuid:0031> ns1:foo "bar" .
>>> print g.serialize(format='n3')
@prefix ns1: <http://example.com/> .
<urn:uuid:0031> ns1:foo "bar" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment