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] Create Rules in Eclipse using Protege 3.4.4 - run Rules in EulerGUI

Jean-Marc Vanel jeanmarc.vanel at
Fri Jul 23 02:42:42 PDT 2010

2010/7/21 Jean-Marc Vanel <jeanmarc.vanel at>:
> 2010/7/21 aros <aros at>
>> Hi Jean-Marc,
>> Thanks for the fast reply. Here is the ontology plus a simple SWRL rule.
>> This ontology is a very simple ontology that I have been using to test SWRL
>> rules and Jess. It has only 2 individuals and one rule (the ones mentioned
>> in the post).
>> In my java program I am using Protégé 3.4.4 to create new individuals and
>> retrieve information of the ontology (like what properties does a class
>> have). I use Jess to execute SWRL queries. This queries are usually done to
>> retrieve information about individuals (mainly properties and the
>> individuals link by the properties). So I am interested that my RuleEngine
>> works with the some ontology and that if a rule is executed it makes the
>> modifications in my ontology, so when I query it I obtain the correct values
>> and not the initial values.
>  I wrote a small program (57 lines) for the EulerGUI API that takes your
> OWL+SWRL unmodified, updates the value of the light switch from On to Off,
> and displays all tripls about :light1 :
> Before firing rules it prints :
>  <http://www.simple-ontology.owl#light1>
> <http://www.simple-ontology.owl#hasState> "On" .
> After firing rules it prints both :
> <http://www.simple-ontology.owl#light1>
> <http://www.simple-ontology.owl#hasState> "On" .
> <http://www.simple-ontology.owl#light1>
> <http://www.simple-ontology.owl#hasState> "Off" .
> That is, both the consequence of the new fact, and the original  "On" fact
> that was asserted in the ontology. This latter  "On" fact , the engine has
> no reason to remove it of course.
> To achieve what you want, that is having only light1 "Off" after new fact
> and inference, there are two solutions in EulerGUI.
> First, you can write an N3 rule that explicitely removes the existing value
> of hasState :
> {?t0 a ns1:Light.
>  ?t0 ns1:hasControl ?t1.
>  ?t1 ns1:hasState ?t2.
>  ?t0 ns1:hasState ?oldValue.
> } => {
>  _:d kb:retract ( ?t0 ns1:hasState ?oldValue ).
>  ?t0 ns1:hasState ?t2.
> }.
> Note that the non bold lines above are exactly the N3 translation of your
> original SWRL rule.
> The second solution is more declarative and hence preferable. It leverages
> on "truth maintenance" capabilities of Drools :
> insertLogical(new Something()); is similar to insert, but the object will be
> automatically retracted when there are no more facts to support the truth of
> the currently firing rule.
> (see
> ) .
> But currently we don't use insertLogical() when generating rules for the
> Drools engine. I'll add this feature today and let you know .

I changed the translation into Drools of N3 and SWRL rules, to use
optionalilly logicalInsert() . So now it  benefits of the automatic

Your rule base has a single rule essentially saying "if the switch has
a state, then the light has the same state". Now there is no need to
explicitely remove the lamp's old state. After firing rules, there is
always a single value of property hasState.

The before mentioned program has been updated :

It works with a snapshot of EulerGUI here:

This snapshot includes the binaries of the Prolog engine Yap (for
Windows and Linux) used for the translation of SWRL rules.

Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
EulerGUI, a turntable GUI for Semantic Web + rules, XML, UML, eCore,
Java bytecode
+33 (0)6 89 16 29 52 -- +33 (0)1 39 55 58 16
( we rarely listen to voice messages, please send a mail instead )

More information about the protege-owl mailing list