-
Notifications
You must be signed in to change notification settings - Fork 577
Description
rdflib
version 6.3.2 (latest)
This problem seems like it might be related to #1997, but is different inasmuch as it is affected by serialization step of a parsed graph, rather than the parsing step.
I have an RDF file (in RDF/XML format, and a *.owl filename extension in case that matters) with several prefixes defined at the beginning. All of the prefixes are preserved in the result of:
from rdflib import Graph
g = Graph().parse("myfile.owl")
list(g.namespaces)
If I serialize via `g.serialize(format="xml") then some of the prefixes are lost - it looks like any prefixes that aren't actually used in the input RDF are dropped, which is surprising (after parsing, does the Graph object retain that information?). The presence of the mapped namespaces in URIs used in the RDF does not seem to matter (i.e., those namespaces are found in some of the URIs in the content).
If I serialize via `g.serialize(format="turtle") then my original prefixes are preserved. Yay, but... eh?