How to find inconsistencies on individuals/properties

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

How to find inconsistencies on individuals/properties

Charles
Hi,
I am very new to ontologies, so I learn at the same time writing ontologies and owlready2 :)
I try to define a 1-n relation between two classes. Here is the code snippet:

class Robot(Thing):
    pass
class Resource(Thing):
    pass
class belongs_to(Resource >> Robot):
    pass
class has_resource(Robot >> Resource):
    inverse_property = belongs_to
Resource.is_a = [belongs_to.max(1, Robot)]
AllDisjoint([Resource, Robot])

I hope this to define that a Robot can have multiple resources, but that a resource can belong to only 1 robot.

Then I define individuals for those:
a = Robot("a")
b = Robot("b")
r = Resource("r")
v = Resource("v")

r.belongs_to(a)
v.belongs_to(a)
r.belongs_to(b)

Then, if I call the reasoner, it results in saying that v also belongs to r, which was a bit surprising at the first time, but now I understand that it is the consequence of saying that a and b must be the same object :)

Then I added a AllDifferent([a, b, r, v]) in the ontology, and it results in a Inconsistency error.

The point is that now I don't know how to find the origin or explanation of the inconsistency (I would except the belongs_to property to be blamed) once I have catched the exception. The inconsistent_classes() list is empty.

Thanks,
Charles


Reply | Threaded
Open this post in threaded view
|

Re: How to find inconsistencies on individuals/properties

Jiba
Administrator
Hi,

From a theorical point of view, you can speak of an "inconsistent class", but not of an "inconsistent individual": if an individual is inconsistent, then the entire ontology becomes inconsistent and nothing can be inferred.

If you need to find which individual(s) is (are) involved in an inconsistency, you can either ask a reasoner for an explanation (Pellet supports that, but Olwready does not integrate explanation yet), or replace the candidate individuals by classes.

Jiba