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 determine the execution sequence of swrl rules?

Martin O'Connor martin.oconnor at
Wed Aug 1 10:48:32 PDT 2007

One approach is to partition rules into different abstraction layers, 
with rules in lower level layers computing fairly straightforward 
abstractions and higher level layers using those computed results to 
generate successively more complex abstractions.

In general, if you if there are complex interrelationships between 
rules, the rule base is going to be hard to debug - and the problem will 
only get worse as the number of rules increases.

That said, you can determine what each rule is doing during an inference 
run by generating SWRL queries for those rules to examine the 
information matched during each successful firing.

Say we have the following two rules:

A(?a) ^ B(?b) -> C(?c)
C(?c) -> D(?d)

We can determine what ?a and ?bs were matched for each successful firing 
of the first rule by cloning the rule in the editor and replacing the 
head with a query built-in:

A(?a) ^ B(?b) -> query:select(?a, ?b)

Queries and rules are executed simultaneously in the SWRLTab so when you 
examine the results of this query in the SWRLQueryTab you will see 
exactly what values each variables were bound to when the rule fired.

You could even just add the query built-in to the original rule head:

A(?a) ^ B(?b) -> C(?c) ^ query:select(?a, ?b)

but in general it is probably best to separate queries and rules.


Timothy Redmond wrote:

>I can give a generic rule-system answer.
>The usual answer with rule systems is that you should not and can not  
>predict the sequence.  Rules are allowed to fire at any time when  
>their preconditions have been met.  The advice that is usually given  
>is to not think procedurally or about the sequence.  Just try to make  
>each rule be a valid statement of what is supposed to happen  
>regardless of the timing.
>In practice there are occasions where this is hard to do.  Some rule  
>systems have facilities to help the user  constrain rule execution  
>sequence when it absolutely becomes necessary  (e.g. rule priorities  
>and rule modules).  But I don't know how or if this could be applied  
>to SWRL.
>On Aug 1, 2007, at 2:43 AM, daphne wrote:
>>Hello everyone!
>>I am very curious about how to determine the execution sequence of  
>>the swrl
>>Sometimes the execution of one rule lies in the reasoning results  
>>of another
>>However, I find sometimes it does not work as I expected, in that I  
>>can not
>>decide which is the first to execute.
>>If anyone can give me an answer, I will be very appreciated!
>>View this message in context: 
>>Sent from the Protege - OWL mailing list archive at
>>protege-owl mailing list
>>protege-owl at
>>Instructions for unsubscribing: 
>protege-owl mailing list
>protege-owl at
>Instructions for unsubscribing: 

More information about the protege-owl mailing list