Annotaion on subclassOf constraint not correctly get

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Annotaion on subclassOf constraint not correctly get

ryey
This post was updated on .
I'm trying to query an annotation property of a subclassOf constraint of a class. However, it yields errors on the `annotation.py` file in the owlready2 library.

The code I used is `onto.annotationType[onto.Widget, rdfs_subclassof, swp]`
 where `annotationType` is my annotation property, `Widget` is my class, and `swp` is my retrieved subclass-of constraint (`size max 1 float`).

The error is on line 88 (of `annotation.py`), and the error message is: NameError: name 'self' is not defined

I was able to manually "fix" it by replacing `self` with `Annot` (i.e. the first parameter of the __getitem__ method in that class).
Then it complained about `source_orig` referenced before assignment (on the `return` statement). I made another "fix" by inserting `source_orig = source`.

With these modifications, the result is an empty list, which is incorrect.

However, if I declare that owl class `Widget` in my code with the code below, it works (without the need to do the "fix" above) and would return the correct result.

```
with onto:
    class Widget(Thing):
        pass
```

and the corresponding "query" code is: `onto.annotationType[Widget, rdfs_subclassof, swp]`
  (the difference is on the `Widget`, i.e. without `onto.`)


Is there a fix? Or did I do anything wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Annotaion on subclassOf constraint not correctly get

Jiba
Administrator
Hi,

I tried with the following very small ontology : t.owl , but I was unable to reproduce the problem.

Since I have changed annotations recently, the problem is possibly fixed in the development version on Bitbucket; could you try it please?

If it does not work, could you send me a small example ontology to reproduce the problem?

Jiba