diff --git a/.gitignore b/.gitignore index 445477f8..95b4fe12 100644 --- a/.gitignore +++ b/.gitignore @@ -118,4 +118,7 @@ output_files/ pylode/_version.py -.pickle \ No newline at end of file +*.pickle + +actual.html +expected.html diff --git a/pylode/profiles/supermodel/query/__init__.py b/pylode/profiles/supermodel/query/__init__.py index 7c3f9bdc..e5951434 100644 --- a/pylode/profiles/supermodel/query/__init__.py +++ b/pylode/profiles/supermodel/query/__init__.py @@ -404,6 +404,11 @@ def __init__(self, graph: Graph) -> None: self.root_profile_iri = get_root_profile_iri(graph) self.db = load_profiles(self.root_profile_iri, graph.serialize()) self.graph = self.db.root_graph + + # We need this to see the prefixes in the loaded file + for prefix, namespace in graph.namespace_manager.namespaces(): + self.graph.namespace_manager.bind(prefix, namespace, override=True) + self.debug = True if (None, LODE.debug, None) in self.db.config_graph else False # An IRI index of classes that 'exist' within this documentation. diff --git a/pylode/utils.py b/pylode/utils.py index 4c2bfe5a..6389905e 100644 --- a/pylode/utils.py +++ b/pylode/utils.py @@ -293,6 +293,11 @@ def sort_ontology(ont_orig: Graph) -> Graph: trpls = ont_orig.triples((None, None, None)) trpls_srt = sorted(trpls) ont_sorted = Graph(bind_namespaces="core") + + # Recover the namespaces from the original file + for prefix, namespace in ont_orig.namespace_manager.namespaces(): + ont_sorted.namespace_manager.bind(prefix, namespace, override=True) + for trpl in trpls_srt: ont_sorted.add(trpl) return ont_sorted