Automatically concept creation by logical operations

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

Automatically concept creation by logical operations

cdemir
Hello,

I was wondering whether it is possible to operate the following computations:

Provided that  a class A, class B and a relation R exist, I would like to create/generate new class that may have the following forms

1) A AND B, A OR B, notA and B, ..., Forall R.A, Exist R.(A OR B) etc.

2) Following (1), I would like each newly created class contains individuals belonging to such class.


I have spent some time in the documentation and source code but failed to perform (1) and (2).

Kind regards,

Caglar Demir

Reply | Threaded
Open this post in threaded view
|

Re: Automatically concept creation by logical operations

Jiba
Administrator
Hi,

Owlready allows the creation of all usual OWL constructs, including restrictions (i.e. Forall / Exist) and logical operations (or, and, not).

See the doc here :

https://owlready2.readthedocs.io/en/latest/restriction.html#logical-operators-intersection-union-and-complement

Constructs are not Python classes, so they cannot be instanciated directly. But you can create an individual of an "anonymous" construct as follows:

class A(Thing): pass
class B(Thing): pass

individual = Thing()
individual.is_a.append(A & B)

Jiba