diff --git a/rdflib_jsonld/serializer.py b/rdflib_jsonld/serializer.py index ebd6d9f..4b0d7c2 100644 --- a/rdflib_jsonld/serializer.py +++ b/rdflib_jsonld/serializer.py @@ -175,7 +175,8 @@ def convert(self, graph): def from_graph(self, graph): nodemap = {} - for s in set(graph.subjects()): + subjects = list(graph.subjects()) + for s in sorted(set(subjects), key=subjects.index): ## only iri:s and unreferenced (rest will be promoted to top if needed) if isinstance(s, URIRef) or (isinstance(s, BNode) and not any(graph.subjects(None, s))):