I am looking to add triples in a certain order using Python's RDFLib Library. I'm aware RDF triples have no ordering, however, I was hoping to add the triples in the order in which the add() function is called. For example,
If I add the following triples
bob = URIRef("http://example.org/people/Bob")
name = Literal("Bob")
g.add((bob, RDF.type, FOAF.Person))
g.add((bob, FOAF.name, name))
The output generated
ex:Bob foaf:name "Bob";
rdf:type foaf:Person.
Would there be a way to ensure the order in which the add function is called correlates with the output file? E.g
ex:Bob rdf:type foaf:Person.
foaf:name "Bob".
Thanks for any help!