Using non-atomic concepts on the left-hand side of a statement

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

Using non-atomic concepts on the left-hand side of a statement

stelios
Hi all,

I have come upon this error:


Traceback (most recent call last):
  File "/usr/share/pycharm/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/usr/share/pycharm/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/media/CaviarBlue/Data/University/UOA_MSc/Thesis/ProverPlayground/src/main.py", line 64, in <module>
    (Human | Infected).is_a.append(Infectious)
AttributeError: 'tuple' object has no attribute 'append'


The code that creates it is:


from owlready2 import *

on = get_ontology("http://tetete.com/ontology.owl")

class Human(Thing):
    namespace = on

class Infected(Thing):
    namespace = on

class Infectious(Thing):
    namespace = on

(Human | Infected).is_a.append(Infectious)


I have managed to use conjunction (with &) on the left-hand side, but not disjunction.

Before I actually run this, I get this warning:


Unresolved attribute reference 'is_a' for class 'Union'



My setup is:

Python 3.9
Owlready2 0.35

and for java -version:

openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8)
OpenJDK 64-Bit Server VM (build 11.0.13+8, mixed mode)

Do you have any insight?

Stelios
Reply | Threaded
Open this post in threaded view
|

Re: Using non-atomic concepts on the left-hand side of a statement

Jiba
Administrator
Hi,

Non-atomic concepts on the left-hand side can only be supported with general axioms, but Owlready has very limited support for that yet.

The easier solution is to create a named class that is equivalent to the non-atomic concept, e.g.

class HumanOrInfected(Thing):
    namespace = on
    equivalent_to = [Human | Infected]

HumanOrInfected.is_a.append(Infectious)


Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Using non-atomic concepts on the left-hand side of a statement

stelios
Oh, alright. Thanks for the response and the tip.

Best,
Stelios