## Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through

# [protege-owl] How to encode the logical OR in SWRL?!

Thomas Russ tar at ISI.EDU
Sun Dec 9 01:09:35 PST 2007

```On Dec 7, 2007, at 3:38 AM, ahmed nabel wrote:

>
> Say that we have 3 bags. Each has a weight.
>
> Class: Bag
>
> Property: hasMoreWeightThan     Domain: Bag      Range: Bag
>              hasLessWeight             Domain: Bag      Range: Bag
>              hasEqualWeight           Domain: Bag      Range: Bag
>
> Our knowledgebase is:
>
> Bag(bag_1),
> Bag(bag_2),
> Bag(bag_3),
> hasMoreWeightThan(bag_1, bag_2),
> hasMoreWeightThan(bag_1, bag_3)
>
> We want a rule which states all the possible combinations of weight
> relations between all the individuals in the KB. Something like:
>
> Bag(?x), Bag(?y), Bag(?z), hasMoreWeightThan(?x, ?y),
> hasMoreWeightThan(?x, ?z) -> hasMoreWeight(?y, ?z) OR hasLessWeight
> (?y, ?z)
>
> (This is because we have another axiom like: NOT hasEqualWeight(?
> y, ?z), so we are not looking for all the combinations of the
> relations but rather for a constrained subset of them)
>
> ******************************
>
> So this is what I'm trying to do.
>
> So I need the OR and the consequent.

Well, you can't do it using OWL and SWRL.

You would need to look for a more expressive logic than OWL in order
to write rules of this nature.

I'm not sufficiently conversant with OWL 1.1 to know if you are
allowed to define properties that are the complements of each other
there.  If that were possible, then you could perhaps define
hasEqualWeight and hasNonEqualWeight as complements of each other.
Then the consequent of your rule would be hasNonEqualWeight.

"hasMoreWeightThan" property correctly, your rule isn't correct.

I assume that

hasMoreWeightThan(?x, ?y) =>  Weight(?x) > Weight(?y)

If that is correct, you can't really say anything about the relative
weights of ?y and ?z given the information that you have in the
antecedent.  Perhaps your meaning of "having another axiom" means
that you exclude having the same weight that way.  But if you want
this used in general rules, you would need to express it in the
antecedent.  I guess if no two bags have the same weight, then a
general-purpose universally quantified restriction would be
appropriate.  But in any case, this is outside the expressive power
of the OWL family of logics.

```