Skip to content

Commit

Permalink
Added additional recognised prefixes (#734)
Browse files Browse the repository at this point in the history
# Description
Added additional recognised prefixes (expected to be used by FOOPS)

## Type of change
<!-- Put an `x` in the box that applies. -->
- [ ] Bug fix.
- [x] New feature.
- [ ] Documentation update.
- [ ] Test update.
  • Loading branch information
jesper-friis authored Mar 22, 2024
2 parents a160921 + 802232e commit c299d23
Showing 1 changed file with 11 additions and 7 deletions.
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

0 comments on commit c299d23

Please sign in to comment.