Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional recognised prefixes #734

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions ontopy/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,15 +1004,19 @@ def save(
# Make a copy of the owlready2 graph object to not mess with
# owlready2 internals
graph = rdflib.Graph()
graph_owlready2 = self.world.as_rdflib_graph()
for triple in graph_owlready2.triples((None, None, None)):
for triple in self.world.as_rdflib_graph():
graph.add(triple)

# Add namespaces
graph.namespace_manager.bind("", rdflib.Namespace(self.base_iri))
graph.namespace_manager.bind(
"swrl", rdflib.Namespace("http://www.w3.org/2003/11/swrl#")
)
# Add common namespaces unknown to rdflib
extra_namespaces = [
("", self.base_iri),
("swrl", "http://www.w3.org/2003/11/swrl#"),
("bibo", "http://purl.org/ontology/bibo/"),
]
for prefix, iri in extra_namespaces:
graph.namespace_manager.bind(
prefix, rdflib.Namespace(iri), override=False
)

# Remove all ontology-declarations in the graph that are
# not the current ontology.
Expand Down
Loading