summaryrefslogtreecommitdiff
path: root/examples/simple_example.py
diff options
context:
space:
mode:
authorGunnar Aastrand Grimnes <gromgull@gmail.com>2016-11-19 07:44:22 +0100
committerGunnar Aastrand Grimnes <gromgull@gmail.com>2017-01-30 17:43:04 +0100
commitfbf32e11862ca4d07b745a36b4389e900c60c00d (patch)
treed44c38852bc98fef2a903c56a2ac980ae0385f6f /examples/simple_example.py
parentf007dace0a39c242ae450611b18463c774696253 (diff)
downloadrdflib-fbf32e11862ca4d07b745a36b4389e900c60c00d.tar.gz
converted examples
Diffstat (limited to 'examples/simple_example.py')
-rw-r--r--examples/simple_example.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/examples/simple_example.py b/examples/simple_example.py
index 7b44ff79..5ed4be62 100644
--- a/examples/simple_example.py
+++ b/examples/simple_example.py
@@ -19,35 +19,34 @@ if __name__=='__main__':
store.add((donna, FOAF.name, Literal("Donna Fales")))
# Iterate over triples in store and print them out.
- print "--- printing raw triples ---"
+ print("--- printing raw triples ---")
for s, p, o in store:
- print s, p, o
+ print(s, p, o)
# For each foaf:Person in the store print out its mbox property.
- print "--- printing mboxes ---"
+ print("--- printing mboxes ---")
for person in store.subjects(RDF.type, FOAF["Person"]):
for mbox in store.objects(person, FOAF["mbox"]):
- print mbox
+ print(mbox)
# Serialize the store as RDF/XML to the file donna_foaf.rdf.
store.serialize("donna_foaf.rdf", format="pretty-xml", max_depth=3)
# Let's show off the serializers
- print "RDF Serializations:"
+ print("RDF Serializations:")
# Serialize as XML
- print "--- start: rdf-xml ---"
- print store.serialize(format="pretty-xml")
- print "--- end: rdf-xml ---\n"
+ print("--- start: rdf-xml ---")
+ print(store.serialize(format="pretty-xml"))
+ print("--- end: rdf-xml ---\n")
# Serialize as Turtle
- print "--- start: turtle ---"
- print store.serialize(format="turtle")
- print "--- end: turtle ---\n"
+ print("--- start: turtle ---")
+ print(store.serialize(format="turtle"))
+ print("--- end: turtle ---\n")
# Serialize as NTriples
- print "--- start: ntriples ---"
- print store.serialize(format="nt")
- print "--- end: ntriples ---\n"
-
+ print("--- start: ntriples ---")
+ print(store.serialize(format="nt"))
+ print("--- end: ntriples ---\n")