SWRL rule using "OR"-type statement

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

SWRL rule using "OR"-type statement

McArthur, Christian
Howdy all!

I never know which mailing list to ask this type of question as it doesn't directly involve Protege, the OWL API or any one reasoner.  However, I figure someone on this list will be able to point me in the right direction.  I'm trying to figure out a way of implementing a SWRL rule that would need to make use of an OR type statement. Here is the scenario: The ontology has a class "MachineTool" which has an object property of "hasProcess" and a number of classes of processes. We want to be able to get a list of individuals of MachineTool which has a hasProcess value of either "EndMilling" or "Drilling".

If 'or' statements were allowed the SWRL rule would look something like:
     MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ (EndMilling OR Drilling)(?p) -> MyMachineTools(?mt)

But that rule isn't legal. Does someone know of a rule (or set of rules) that can accomplish what we are looking for? I had thought one alternative could be (but haven't tested it, Protege is being weird at the moment with running the reasoner):

EndMilling(?p) -> MyProcesses(?p)
Drilling(?p) -> MyProcesses(?p)
MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ MyProcesses(?p) -> MyMachineTools(?mt)

I welcome all thoughts on this problem.  Thanks.
--Christian
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Reply | Threaded
Open this post in threaded view
|

Re: SWRL rule using "OR"-type statement

Thomas Russ

On Jul 6, 2011, at 9:31 AM, McArthur, Christian wrote:

> Howdy all!
>
> I never know which mailing list to ask this type of question as it doesn't directly involve Protege, the OWL API or any one reasoner.  However, I figure someone on this list will be able to point me in the right direction.  I'm trying to figure out a way of implementing a SWRL rule that would need to make use of an OR type statement. Here is the scenario: The ontology has a class "MachineTool" which has an object property of "hasProcess" and a number of classes of processes. We want to be able to get a list of individuals of MachineTool which has a hasProcess value of either "EndMilling" or "Drilling".
>
> If 'or' statements were allowed the SWRL rule would look something like:
>     MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ (EndMilling OR Drilling)(?p) -> MyMachineTools(?mt)
>
> But that rule isn't legal. Does someone know of a rule (or set of rules) that can accomplish what we are looking for? I had thought one alternative could be (but haven't tested it, Protege is being weird at the moment with running the reasoner):
>
> EndMilling(?p) -> MyProcesses(?p)
> Drilling(?p) -> MyProcesses(?p)
> MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ MyProcesses(?p) -> MyMachineTools(?mt)
>
> I welcome all thoughts on this problem.  Thanks.
> --Christian

I think you are on the right track with this.

Having multiple rules effectively gives you the disjunction effect.  As long as you don't have too many disjunctions in a single rule, then it doesn't get too unwieldy.

If you don't want to introduce an intermediate class like "MyProcesses", you can just do the expansion as two rules:

  MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ EndMilling(?p) -> MyMachineTools(?mt)
  MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ Drilling(?p) -> MyMachineTools(?mt)

If you have really long rules or many disjunctions, then you may want to introduce the intermediate classes like in your solution.





_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Reply | Threaded
Open this post in threaded view
|

Re: SWRL rule using "OR"-type statement

McArthur, Christian
In reply to this post by McArthur, Christian
Thomas, your e-mail came through right about the same time as I got Pellet working in Protege for some trial and error.  It looks like the rules we both used works.  I'll be using the intermediate classes as I was up to six SWRL rules from the various properties of machine tools before getting to processes.  The multiple rules makes things a little easier to read and understand I think.  

Thanks again for the help.
--Christian
________________________________________
Date: Wed, 6 Jul 2011 10:30:04 -0700
From: Thomas Russ <[hidden email]>
To: User support for the Protege-OWL editor
        <[hidden email]>
Subject: Re: [protege-owl] SWRL rule using "OR"-type statement
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=us-ascii


On Jul 6, 2011, at 9:31 AM, McArthur, Christian wrote:

> Howdy all!
>
> I never know which mailing list to ask this type of question as it doesn't directly involve Protege, the OWL API or any one reasoner.  However, I figure someone on this list will be able to point me in the right direction.  I'm trying to figure out a way of implementing a SWRL rule that would need to make use of an OR type statement. Here is the scenario: The ontology has a class "MachineTool" which has an object property of "hasProcess" and a number of classes of processes. We want to be able to get a list of individuals of MachineTool which has a hasProcess value of either "EndMilling" or "Drilling".
>
> If 'or' statements were allowed the SWRL rule would look something like:
>     MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ (EndMilling OR Drilling)(?p) -> MyMachineTools(?mt)
>
> But that rule isn't legal. Does someone know of a rule (or set of rules) that can accomplish what we are looking for? I had thought one alternative could be (but haven't tested it, Protege is being weird at the moment with running the reasoner):
>
> EndMilling(?p) -> MyProcesses(?p)
> Drilling(?p) -> MyProcesses(?p)
> MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ MyProcesses(?p) -> MyMachineTools(?mt)
>
> I welcome all thoughts on this problem.  Thanks.
> --Christian

I think you are on the right track with this.

Having multiple rules effectively gives you the disjunction effect.  As long as you don't have too many disjunctions in a single rule, then it doesn't get too unwieldy.

If you don't want to introduce an intermediate class like "MyProcesses", you can just do the expansion as two rules:

  MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ EndMilling(?p) -> MyMachineTools(?mt)
  MachineTool(?mt) ^ hasProcess(?mt, ?p) ^ Drilling(?p) -> MyMachineTools(?mt)

If you have really long rules or many disjunctions, then you may want to introduce the intermediate classes like in your solution.
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03