Support for ORing of clauses in User-defined/SWRL rules

0 views
Skip to first unread message

Andrea Westerinen

unread,
Dec 2, 2014, 11:17:03 PM12/2/14
to sta...@clarkparsia.com
I  know that SWRL rules have antecedents that are the conjunction of the component atoms/triples.  So, I can easily write a rule that says that someone who has taken training (A and B) is allowed to take training Z.

But, I would also like to say that anyone that has taken training (A or B or C) is allowed to take training Z. 

Is there any way to support this?  A disjunction of the atoms?

Thanks.

Andrea


Andrea Westerinen

unread,
Dec 3, 2014, 12:00:15 AM12/3/14
to sta...@clarkparsia.com
In rereading my question, I realized that I simplified it too much.  I can handle my use case by filtering on the training classes (the object of a person-hasTraining-class triple) and then ORing within the filter.

A better example is something like:
   IF a person has taken training A and lives in the states of MD or VA, or has taken training B and lives in the states of CA or NY, and
       the person has taken training C, and
       the person has a GMail or Outlook account, and has a drivers license with motorcycle or commercial endorsement,
   THEN something

The problem is the complex combination of atoms, not just a simple string or URI match.  Creating individual rules for each of the combinations would be a nightmare.

Andrea

Héctor Pérez-Urbina

unread,
Dec 11, 2014, 1:00:25 PM12/11/14
to stardog

I'm afraid SWRL does not allow disjunction in the body (or head).

A complex expression, representing the antecedent, can be put in disjunctive normal form

(A1 and ... and An) or .... or (Z1 and ... and Zm)

and then broken up to form the rules

(A1 and ... and An) -> consequent
...
(Z1 and ... and Zm) -> consequent

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Andrea Westerinen

unread,
Dec 11, 2014, 1:37:46 PM12/11/14
to Stardog
Thanks Hector.  That was what I was afraid of.

The concept of disjunctive normal form is not difficult ... However, the implementation can get ugly with many possible combinations.  It ends up being a kind of dot-product result.

Also, this brings into focus the differences between SPARQL (which allows the disjunction) and SWRL.  I was hoping that SparqlRule really meant SPARQL. 

To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.
330.gif

Kendall Clark

unread,
Dec 11, 2014, 3:00:43 PM12/11/14
to stardog

On Thu, Dec 11, 2014 at 1:37 PM, Andrea Westerinen <arwest...@gmail.com> wrote:
also, this brings into focus the differences between SPARQL (which allows the disjunction) and SWRL.  I was hoping that SparqlRule really meant SPARQL. 

I think the docs are pretty clear that Stardog Rules Syntax is just sugar for SWRL, no?

Cheers,
Kendall

Andrea Westerinen

unread,
Dec 11, 2014, 4:54:58 PM12/11/14
to Stardog
Probably.  But you know what happens when someone "assumes" something.

330.gif
Reply all
Reply to author
Forward
0 new messages