ontology-tools / py-horned-owl

A library for Web Ontology Language in Python created using a bridge from horned-owl to python using PyO3.
https://ontology-tools.github.io/py-horned-owl/
GNU Lesser General Public License v3.0
14 stars 6 forks source link

add_prefix_mapping disappeared in the transition from 1.0.0 to 1.0.1 #34

Closed cmungall closed 6 hours ago

cmungall commented 2 weeks ago

This example here:

https://github.com/ontology-tools/py-horned-owl/blob/main/docs/source/quickstart.rst#L26

shows a method add_prefix_mapping

This worked in 1.0.0, and I have been using it in my code

This disappeared in 1.0.1

Example:

>>> import pyhornedowl
>>> ontology = pyhornedowl.open_ontology("./tests/test_frameworks/hornedowl/input/ro.ofn")
>>> axioms = ontology.get_axioms()
>>> ontology.add_prefix_mapping(":", "https://example.com/test#")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'builtins.PyIndexedOntology' object has no attribute 'add_prefix_mapping'. Did you mean: 'prefix_mapping'?

This is where it disappears:

https://github.com/ontology-tools/py-horned-owl/compare/v1.0.0...v1.0.1#diff-584789db210d70434439494120067217ff5dfe2745f333ae8de7e89e3329eae0L30-L35

cmungall commented 2 weeks ago

Aside: the link to the changelog in https://github.com/ontology-tools/py-horned-owl/releases/tag/v1.0.1 goes to the wrong version...

cmungall commented 2 weeks ago

It looks like there is now a separate PrefixMapping object. This makes sense, but it seems to work differently

This used to work:

o = PyIndexedOntology()
o.add_prefix_mapping("", "http://example.org/")
C = o.clazz("C")

This is my attempt to migrate to 1.0.1:

o = PyIndexedOntology()
o.prefix_mapping.add_prefix("", "http://example.org/")
C = o.clazz("C")

ValueError: Invalid curie: MissingDefault

so in addition to the method disappearing, there seems to be a different way to add base prefixes?

b-gehrke commented 2 weeks ago

The removal of the add_prefix_mapping was unintentional. In the future, I'd like to replace the add_prefix_mapping with prefix_mapping.add_prefix but of course, there should be no breaking changes. I will re-add it.

b-gehrke commented 6 hours ago

Fixed in 1.0.2