Create Rules in Eclipse using Protege 3.4.4

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

Create Rules in Eclipse using Protege 3.4.4

aros

Hi,

 

I am new with rules and I would like a little advice. I have been creating my java application using Protégé 3.4.4. I managed to load and modify my ontology and make queries using SQWRL. Now I would like to integrate some rules.

 

My ontology consists of the set of appliance that can be found at home: lights, button, TV, washing machine, etc. I want to create rules that given an event can modify my ontology. For example:

 

If button1 is pressed then turn on light 1.

In other words:

If button1 hasState ==On then light1 hasState ==On

 

 

I was thinking of using SWRL but I have read that in my case SWRL is not a good option as it does not modify the ontology. Can anyone please recommend me a tutorial/documentation that can help me find a way to do this?

 

Thanks!

 

Ana Rossello Busquet

 


_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

Martin O'Connor
Ana Rossello Busquet wrote:
>
>  
>
> I was thinking of using SWRL but I have read that in my case SWRL is
> not a good option as it does not modify the ontology.
>

I am not sure what you mean by this. SWRL can certainly generate new
inferences in an ontology.

Martin
_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

aros
Hi,

I haven't actually tried to use SWRL to modify my ontology but I found this:

source: http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ

Does SWRL support Nonmonotonic Inference?

No. Like OWL, SWRL supports monotonic inference only. Hence, SWRL rules cannot be used to modify information in an ontology. If SWRL rules allowed ontology modifications nonmonotonicity  would ensue. For this reason, it is also not possible to retract or remove information from an ontology using SWRL.    (9LH)

For example, assume we have a rule that indicates that a driver older than 25 is insurable by assigning a boolean property to true:    (9L4)

    * Driver(?d) ^ hasAge(?d, ?age) ^ swrlb:greaterThan(?age, 25) -> isInsurable(?d, true)    (9L5)

This rule will add the value of true to the isInsurable property for all drivers that satisfy the antecedent. It does not change the existing value for that property. If, for example, a driver has a previous assignment of false for that property, a successful firing of this rule for that driver will result in the property having two values. If the isInsurable value if functional (which it most likely should be), an OWL reasoner will indicate an inconsistency when applied to the resulting ontology.
Reply | Threaded
Open this post in threaded view
|

Re: Create Rules in Eclipse using Protege 3.4.4

Martin O'Connor

That should probably have read:

SWRL rules cannot be used to modify *existing* information in an ontology.

SWRL can modify an ontology in the sense that rule can generate new
inferences in the ontology.

If you want modify existing information you will generally need to do it
programmatically (or via the GUI).

Martin

aros wrote:

> Hi,
>
> I haven't actually tried to use SWRL to modify my ontology but I found this:
>
> source: http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ
>
> Does SWRL support Nonmonotonic Inference?
>
> No. Like OWL, SWRL supports monotonic inference only. Hence, SWRL rules
> cannot be used to modify information in an ontology. If SWRL rules allowed
> ontology modifications nonmonotonicity  would ensue. For this reason, it is
> also not possible to retract or remove information from an ontology using
> SWRL.    (9LH)
>
> For example, assume we have a rule that indicates that a driver older than
> 25 is insurable by assigning a boolean property to true:    (9L4)
>
>     * Driver(?d) ^ hasAge(?d, ?age) ^ swrlb:greaterThan(?age, 25) ->
> isInsurable(?d, true)    (9L5)
>
> This rule will add the value of true to the isInsurable property for all
> drivers that satisfy the antecedent. It does not change the existing value
> for that property. If, for example, a driver has a previous assignment of
> false for that property, a successful firing of this rule for that driver
> will result in the property having two values. If the isInsurable value if
> functional (which it most likely should be), an OWL reasoner will indicate
> an inconsistency when applied to the resulting ontology.
>
>  

_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

aros

Is there any way to design rules that can modify the already existing content on my ontology through my java application?

 

I am modeling a home scenario where I have an ontology with all the appliances. An example of a rule that I want to build in is:

 

If (light_sensor detects >80% light) then turn off lamp

 

In my ontology this would mean:

light_sensor(?s) ^ hasState(?s,?state) ^swrlb:greaterThan(?state, 80) -> light(?l) ^hasState(?l, false)

 

light_sensor state can change at any time and more than once (as the light sensor state can go down and up again).

 

Can I use Jess to do this? Do you have any example code of how to do it?

 

Thanks

 

 

Ana Rossello Busquet

Ph.D. Student

Networks Technology and Service Platforms

DTU Fotonik

 

Technical University of Denmark

http://www.dtu.dk/images/DTU_email_logo_01.gif

Department of Photonics Engineering

Ørsteds Plads

Building 343

2800  Kgs. Lyngby

Direct +45 45256380

Mob. +45 2830 0805

[hidden email]

www.fotonik.dtu.dk

 

 

From: Martin O'Connor [via Protege Ontology Editor & Knowledge Acquisition System] [mailto:[hidden email]]
Sent: 16. juli 2010 20:32
To: Ana Rossello Busquet
Subject: Re: Create Rules in Eclipse using Protege 3.4.4

 


That should probably have read:

SWRL rules cannot be used to modify *existing* information in an ontology.

SWRL can modify an ontology in the sense that rule can generate new
inferences in the ontology.

If you want modify existing information you will generally need to do it
programmatically (or via the GUI).

Martin

aros wrote:


> Hi,
>
> I haven't actually tried to use SWRL to modify my ontology but I found this:
>
> source: http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ
>
> Does SWRL support Nonmonotonic Inference?
>
> No. Like OWL, SWRL supports monotonic inference only. Hence, SWRL rules
> cannot be used to modify information in an ontology. If SWRL rules allowed
> ontology modifications nonmonotonicity  would ensue. For this reason, it is
> also not possible to retract or remove information from an ontology using
> SWRL.    (9LH)
>
> For example, assume we have a rule that indicates that a driver older than
> 25 is insurable by assigning a boolean property to true:    (9L4)
>
>     * Driver(?d) ^ hasAge(?d, ?age) ^ swrlb:greaterThan(?age, 25) ->
> isInsurable(?d, true)    (9L5)
>
> This rule will add the value of true to the isInsurable property for all
> drivers that satisfy the antecedent. It does not change the existing value
> for that property. If, for example, a driver has a previous assignment of
> false for that property, a successful firing of this rule for that driver
> will result in the property having two values. If the isInsurable value if
> functional (which it most likely should be), an OWL reasoner will indicate
> an inconsistency when applied to the resulting ontology.
>
>  


_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

Jean-Marc Vanel
2010/7/19 aros <[hidden email]>

Is there any way to design rules that can modify the already existing content on my ontology through my java application?

No, this is not at the level of writing rules , but modifications will occur by a explicit action from the API or in the Jess tab by the relevant button.

I am modeling a home scenario where I have an ontology with all the appliances. An example of a rule that I want to build in is:

If (light_sensor detects >80% light) then turn off lamp

In my ontology this would mean:

light_sensor(?s) ^ hasState(?s,?state) ^swrlb:greaterThan(?state, 80) -> light(?l) ^hasState(?l, false)

light_sensor state can change at any time and more than once (as the light sensor state can go down and up again).

 

Can I use Jess to do this?

Yes 

Do you have any example code of how to do it?

The best there is this : 

For running rules embedded inside an application you might also want try our EulerGUI API, based on Drools, an Open Source RETE engine. Indeed Jess has license issues and AFAIK gets invalid after 1 month.

See "Using the EulerGUI API" :
"Running SWRL rules in EulerGUI"

And with extensions to the N3 rule language, explicit modification from within rules is possible:

Also non-monotonic and Unique Name Assumption reasonning are possible in EulerGUI (with the usual reservations about the unclean aspect).

--
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
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 )

_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

aros
Hi,

I tried to use Jess to implement some SWRL rules but I am getting some errors. It seems like I cannot change the value of Dataproperties, instead it creates a second value for the dataproperty. After executing the rule the dataproperty has 2 possible values. In my ontology I defined that the class should have exactly 1

My ontology is as follows:
-Class Lamp: has the following properties: hasControl (Object property with range class Switch, and has exactly 1), hasState (Dataproperty with Range String, and has exactly 1)
-Class Switchhas teh following properties: isControlof (Object property with range class Lamp), hasState (Dataproperty with range String, and has exactly 1)

I create 2 individuals:
-Lamp1, with hasControl Switch1 and hasState Off
-Switch1, with isControlOf Lamp1 and hasState Off

My rule is as follows: lamp1 should be in the same state as switch1
(if switch1 hasState off then lamp1 hasState off)

My Java program (I ommited try and catch):

//load ontology
FileReader owlFile = new FileReader(filepath);
JenaOwlModel owlModel = ProtegeOWL.createJenaOWLModelFromReader(owlFile);

//factory for SWRL Queries
factory = new SQWRLQueryEngineFactory();
queryEngine = SQWRLQueryEngineFactory.create(owlModel);

//Query to retrive state of lamp and switch
String query = new String("hasState(?dev, ?state)-> sqwrl:select(?dev, ?state)");
queryEngine.runSQWRLQuery("getStateQuery", query);
runMyQuery2("getStateQuery"); //function included at the end

//Creating Jess rule Engine
SWRLRuleEngineBridge bridge = BridgeFactory.createBridge("SWRLJessBridge",owlModel);
SWRLFactory factory2 = new SWRLFactory(owlModel);

//crerating rule
SWRLImp imp = factory2.createImp("Control_lamp", "Lamp(?lamp) ^ hasControl(?lamp, ?control)  ^ hasState(?control, ?statecontrol) -> hasState(?lamp, ?statecontrol)");
bridge.infer();

//change status of switch and check the devices status
changeMyState("switch1", "Off"); //function included at the end
runMyQuery2("getStateQuery");


//fucntion to retrive query results (i ommited try and catch)
public void runMyQuery2(String query){
        SQWRLResult result =  queryEngine.runSQWRLQuery(query);
        while (result.hasNext()) {
                String uri = result.getObjectValue("?dev").toString();
                String value = result.getDataValue("?state").toString();
                String[] tokens = uri.split("[#]");
                System.out.println(tokens[1]+": "+value);
                result.next();
}


//function to change status
public void changeMyState(String dev, String state){
        OWLIndividual ind = owlModel.getOWLIndividual(myBaseUri+dev);
        OWLProperty prop = owlModel.getOWLProperty(myBaseUri+"hasState");
        ind.setPropertyValue(prop, state);
}

And here is my console:

Loading triples for: null
    Completed triple loading after 265 ms
Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl from location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\sqwrl.owl
21-07-2010 10:43:02 edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel loadImportedAssertions
INFO: Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl from location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\sqwrl.owl
Loading triples for: http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
    Completed triple loading after 0 ms
Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\swrla.owl
21-07-2010 10:43:02 edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel loadImportedAssertions
INFO: Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\swrla.owl
Loading triples for: http://swrl.stanford.edu/ontologies/3.3/swrla.owl
    Completed triple loading after 15 ms
Postprocess: Process entities with incorrect Java type (0 entities) ... 0 ms
Postprocess: Process metaclasses (3 metaclasses) ... 0 ms
Postprocess: Process subclasses of rdf:List (1 classes) ... 0 ms
Postprocess: Instances with multiple types (15 instances) ... 0 ms
Postprocess: Add inferred superclasses ... 0 ms
Postprocess: Process orphan classes (9 classes) ... 0 ms
Postprocess: Generalized Concept Inclusion (0 axioms) ... 0 ms
Postprocess: Abstract classes... 0 ms
Postprocess: Domain and range of properties... 0 ms
Postprocess: Possibly typed entities (0 resources) ... 0 ms
Updating underlying frames model in 0 ms
21-07-2010 10:43:03 edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser doFinalPostProcessing
INFO: Updating underlying frames model in 0 ms
Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
21-07-2010 10:43:03 edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory registerBridge
INFO: Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.

//Result of the getStateQuery, The devices have one value for hasState property
switch1: On
lamp1: On

WARNING: [OWLFrameStore] Warning: Attempted to assign duplicate value to lamp1.hasState -- DuplicateValuesFrameStore.setDirectOwnSlotValues()
21-07-2010 10:43:04 edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore setDirectOwnSlotValues
WARNING: [OWLFrameStore] Warning: Attempted to assign duplicate value to lamp1.hasState
WARNING: [OWLFrameStore]  - On -- DuplicateValuesFrameStore.setDirectOwnSlotValues()
21-07-2010 10:43:04 edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore setDirectOwnSlotValues
WARNING: [OWLFrameStore]  - On
WARNING: [OWLFrameStore]  - On -- DuplicateValuesFrameStore.setDirectOwnSlotValues()
21-07-2010 10:43:04 edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore setDirectOwnSlotValues
WARNING: [OWLFrameStore]  - On

//Result of the getStateQuery, The lamp1 has 2 values for hasState property
lamp1: Off
switch1: Off
lamp1: On


I also tried to run these two rules instead:
SWRLImp imp = factory2.createImp("Control_lamp_Off", "Light(?lamp) ^ hasControl(?lamp, ?control)  ^ hasState(?control, ?statecontrol)^  swrlb:equal(?statecontrol, \"Off\") -> hasState(?lamp, \"Off\")");
SWRLImp imp2 = factory2.createImp("Control_lamp_On", "Light(?lamp) ^ hasControl(?lamp, ?control) ^ hasState(?control, ?statecontrol)^  swrlb:equal(?statecontrol, \"On\") -> hasState(?lamp, \"On\")");


but I got the same result. Am I doing something wrong? Or is it not possible to use SWRL rules and Jess to change dataproperties values??

Will I have the same problem if I try to use EulerGUI?

I have been looking around and there are a lot of rule engines, RuleML, Sweetrules, etc. Which one do you recomment to work together with my ontology? EulerGui?

Thanks,
Ana
Reply | Threaded
Open this post in threaded view
|

Re: Create Rules in Eclipse using Protege 3.4.4

Jean-Marc Vanel
Hi Aros
The problem is that OWL API is not meant to manage dynamic changes, it
is an monotonic logic
(http://en.wikipedia.org/wiki/Non-monotonic_logic).
Your function changeMyState() calls OWLIndividual.setPropertyValue() ;
you must understand this as "add Property Value pair to the existing
set of Property Value pairs". In OWL API (and SWRL) there is no method
replaceValue().

The underlying JESS engine, being a RETE engine, probably manages
replacement and deletion of Values. But SWRL not, by specification.

The N3 engine of EulerGUI (also an SWRL engine by translation of rule
languages) exposes the non-monotonic features of the underlying RETE
engine (Drools).

If you send me your OWL+SWRL ontology, I can play with it in EulerGUI,
and report that.

2010/7/21 aros <[hidden email]>:

>
> Hi,
>
> I tried to use Jess to implement some SWRL rules but I am getting some
> errors. It seems like I cannot change the value of Dataproperties, instead
> it creates a second value for the dataproperty. After executing the rule the
> dataproperty has 2 possible values. In my ontology I defined that the class
> should have exactly 1
>
> My ontology is as follows:
> -Class Lamp: has the following properties: hasControl (Object property with
> range class Switch, and has exactly 1), hasState (Dataproperty with Range
> String, and has exactly 1)
> -Class Switchhas teh following properties: isControlof (Object property with
> range class Lamp), hasState (Dataproperty with range String, and has exactly
> 1)
>
> I create 2 individuals:
> -Lamp1, with hasControl Switch1 and hasState Off
> -Switch1, with isControlOf Lamp1 and hasState Off
>
> My rule is as follows: lamp1 should be in the same state as switch1
> (if switch1 hasState off then lamp1 hasState off)
>
> My Java program (I ommited try and catch):
>
> //load ontology
> FileReader owlFile = new FileReader(filepath);
> JenaOwlModel owlModel = ProtegeOWL.createJenaOWLModelFromReader(owlFile);
>
> //factory for SWRL Queries
> factory = new SQWRLQueryEngineFactory();
> queryEngine = SQWRLQueryEngineFactory.create(owlModel);
>
> //Query to retrive state of lamp and switch
> String query = new String("hasState(?dev, ?state)-> sqwrl:select(?dev,
> ?state)");
> queryEngine.runSQWRLQuery("getStateQuery", query);
> runMyQuery2("getStateQuery"); //function included at the end
>
> //Creating Jess rule Engine
> SWRLRuleEngineBridge bridge =
> BridgeFactory.createBridge("SWRLJessBridge",owlModel);
> SWRLFactory factory2 = new SWRLFactory(owlModel);
>
> //crerating rule
> SWRLImp imp = factory2.createImp("Control_lamp", "Lamp(?lamp) ^
> hasControl(?lamp, ?control)  ^ hasState(?control, ?statecontrol) ->
> hasState(?lamp, ?statecontrol)");
> bridge.infer();
>
> //change status of switch and check the devices status
> changeMyState("switch1", "Off"); //function included at the end
> runMyQuery2("getStateQuery");
>
>
> //fucntion to retrive query results (i ommited try and catch)
> public void runMyQuery2(String query){
>        SQWRLResult result =  queryEngine.runSQWRLQuery(query);
>        while (result.hasNext()) {
>                String uri = result.getObjectValue("?dev").toString();
>                String value = result.getDataValue("?state").toString();
>                String[] tokens = uri.split("[#]");
>                System.out.println(tokens[1]+": "+value);
>                result.next();
> }
>
>
> //function to change status
> public void changeMyState(String dev, String state){
>        OWLIndividual ind = owlModel.getOWLIndividual(myBaseUri+dev);
>        OWLProperty prop = owlModel.getOWLProperty(myBaseUri+"hasState");
>        ind.setPropertyValue(prop, state);
> }
>
> And here is my console:
>
> Loading triples for: null
>    Completed triple loading after 265 ms
> Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl from
> location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\sqwrl.owl
> 21-07-2010 10:43:02
> edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
> loadImportedAssertions
> INFO: Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
> from location:
> M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\sqwrl.owl
> Loading triples for:
> http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>    Completed triple loading after 0 ms
> Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from location:
> M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\swrla.owl
> 21-07-2010 10:43:02
> edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
> loadImportedAssertions
> INFO: Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from
> location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\swrla.owl
> Loading triples for: http://swrl.stanford.edu/ontologies/3.3/swrla.owl
>    Completed triple loading after 15 ms
> Postprocess: Process entities with incorrect Java type (0 entities) ... 0 ms
> Postprocess: Process metaclasses (3 metaclasses) ... 0 ms
> Postprocess: Process subclasses of rdf:List (1 classes) ... 0 ms
> Postprocess: Instances with multiple types (15 instances) ... 0 ms
> Postprocess: Add inferred superclasses ... 0 ms
> Postprocess: Process orphan classes (9 classes) ... 0 ms
> Postprocess: Generalized Concept Inclusion (0 axioms) ... 0 ms
> Postprocess: Abstract classes... 0 ms
> Postprocess: Domain and range of properties... 0 ms
> Postprocess: Possibly typed entities (0 resources) ... 0 ms
> Updating underlying frames model in 0 ms
> 21-07-2010 10:43:03
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser
> doFinalPostProcessing
> INFO: Updating underlying frames model in 0 ms
> Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
> 21-07-2010 10:43:03 edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory
> registerBridge
> INFO: Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
>
> //Result of the getStateQuery, The devices have one value for hasState
> property
> switch1: On
> lamp1: On
>
> WARNING: [OWLFrameStore] Warning: Attempted to assign duplicate value to
> lamp1.hasState -- DuplicateValuesFrameStore.setDirectOwnSlotValues()
> 21-07-2010 10:43:04
> edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore
> setDirectOwnSlotValues
> WARNING: [OWLFrameStore] Warning: Attempted to assign duplicate value to
> lamp1.hasState
> WARNING: [OWLFrameStore]  - On --
> DuplicateValuesFrameStore.setDirectOwnSlotValues()
> 21-07-2010 10:43:04
> edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore
> setDirectOwnSlotValues
> WARNING: [OWLFrameStore]  - On
> WARNING: [OWLFrameStore]  - On --
> DuplicateValuesFrameStore.setDirectOwnSlotValues()
> 21-07-2010 10:43:04
> edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore
> setDirectOwnSlotValues
> WARNING: [OWLFrameStore]  - On
>
> //Result of the getStateQuery, The lamp1 has 2 values for hasState property
> lamp1: Off
> switch1: Off
> lamp1: On
>
>
> I also tried to run these two rules instead:
> SWRLImp imp = factory2.createImp("Control_lamp_Off", "Light(?lamp) ^
> hasControl(?lamp, ?control)  ^ hasState(?control, ?statecontrol)^
> swrlb:equal(?statecontrol, \"Off\") -> hasState(?lamp, \"Off\")");
> SWRLImp imp2 = factory2.createImp("Control_lamp_On", "Light(?lamp) ^
> hasControl(?lamp, ?control) ^ hasState(?control, ?statecontrol)^
> swrlb:equal(?statecontrol, \"On\") -> hasState(?lamp, \"On\")");
>
>
> but I got the same result. Am I doing something wrong? Or is it not possible
> to use SWRL rules and Jess to change dataproperties values??
>
> Will I have the same problem if I try to use EulerGUI?
>
> I have been looking around and there are a lot of rule engines, RuleML,
> Sweetrules, etc. Which one do you recomment to work together with my
> ontology? EulerGui?
>
> Thanks,
> Ana
> --
> View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Create-Rules-in-Eclipse-using-Protege-3-4-4-tp2288368p2296808.html
> Sent from the Protege OWL mailing list archive at Nabble.com.
> _______________________________________________
> 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
>



--
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
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 )
_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

aros

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.

 

Thanks a lot,

Best Regards,

 

Ana Rossello Busquet

Ph.D. Student

Networks Technology and Service Platforms

DTU Fotonik

 

Technical University of Denmark

http://www.dtu.dk/images/DTU_email_logo_01.gif

Department of Photonics Engineering

Ørsteds Plads

Building 343

2800  Kgs. Lyngby

Direct +45 45256380

Mob. +45 2830 0805

[hidden email]

www.fotonik.dtu.dk

 

 

From: Jean-Marc Vanel [via Protege Ontology Editor & Knowledge Acquisition System] [mailto:[hidden email]]
Sent: 21. juli 2010 12:09
To: Ana Rossello Busquet
Subject: Re: Create Rules in Eclipse using Protege 3.4.4

 

Hi Aros
The problem is that OWL API is not meant to manage dynamic changes, it
is an monotonic logic
(http://en.wikipedia.org/wiki/Non-monotonic_logic).
Your function changeMyState() calls OWLIndividual.setPropertyValue() ;
you must understand this as "add Property Value pair to the existing
set of Property Value pairs". In OWL API (and SWRL) there is no method
replaceValue().

The underlying JESS engine, being a RETE engine, probably manages
replacement and deletion of Values. But SWRL not, by specification.

The N3 engine of EulerGUI (also an SWRL engine by translation of rule
languages) exposes the non-monotonic features of the underlying RETE
engine (Drools).

If you send me your OWL+SWRL ontology, I can play with it in EulerGUI,
and report that.

2010/7/21 aros <[hidden email]>:


>
> Hi,
>
> I tried to use Jess to implement some SWRL rules but I am getting some
> errors. It seems like I cannot change the value of Dataproperties, instead
> it creates a second value for the dataproperty. After executing the rule the
> dataproperty has 2 possible values. In my ontology I defined that the class
> should have exactly 1
>
> My ontology is as follows:
> -Class Lamp: has the following properties: hasControl (Object property with
> range class Switch, and has exactly 1), hasState (Dataproperty with Range
> String, and has exactly 1)
> -Class Switchhas teh following properties: isControlof (Object property with
> range class Lamp), hasState (Dataproperty with range String, and has exactly
> 1)
>
> I create 2 individuals:
> -Lamp1, with hasControl Switch1 and hasState Off
> -Switch1, with isControlOf Lamp1 and hasState Off
>
> My rule is as follows: lamp1 should be in the same state as switch1
> (if switch1 hasState off then lamp1 hasState off)
>
> My Java program (I ommited try and catch):
>
> //load ontology
> FileReader owlFile = new FileReader(filepath);
> JenaOwlModel owlModel = ProtegeOWL.createJenaOWLModelFromReader(owlFile);
>
> //factory for SWRL Queries
> factory = new SQWRLQueryEngineFactory();
> queryEngine = SQWRLQueryEngineFactory.create(owlModel);
>
> //Query to retrive state of lamp and switch
> String query = new String("hasState(?dev, ?state)-> sqwrl:select(?dev,
> ?state)");
> queryEngine.runSQWRLQuery("getStateQuery", query);
> runMyQuery2("getStateQuery"); //function included at the end
>
> //Creating Jess rule Engine
> SWRLRuleEngineBridge bridge =
> BridgeFactory.createBridge("SWRLJessBridge",owlModel);
> SWRLFactory factory2 = new SWRLFactory(owlModel);
>
> //crerating rule
> SWRLImp imp = factory2.createImp("Control_lamp", "Lamp(?lamp) ^
> hasControl(?lamp, ?control)  ^ hasState(?control, ?statecontrol) ->
> hasState(?lamp, ?statecontrol)");
> bridge.infer();
>
> //change status of switch and check the devices status
> changeMyState("switch1", "Off"); //function included at the end
> runMyQuery2("getStateQuery");
>
>
> //fucntion to retrive query results (i ommited try and catch)
> public void runMyQuery2(String query){
>        SQWRLResult result =  queryEngine.runSQWRLQuery(query);
>        while (result.hasNext()) {
>                String uri = result.getObjectValue("?dev").toString();
>                String value = result.getDataValue("?state").toString();
>                String[] tokens = uri.split("[#]");
>                System.out.println(tokens[1]+": "+value);
>                result.next();
> }
>
>
> //function to change status
> public void changeMyState(String dev, String state){
>        OWLIndividual ind = owlModel.getOWLIndividual(myBaseUri+dev);
>        OWLProperty prop = owlModel.getOWLProperty(myBaseUri+"hasState");
>        ind.setPropertyValue(prop, state);
> }
>
> And here is my console:
>
> Loading triples for: null
>    Completed triple loading after 265 ms
> Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl from
> location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\sqwrl.owl
> 21-07-2010 10:43:02
> edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
> loadImportedAssertions
> INFO: Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
> from location:
> M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\sqwrl.owl
> Loading triples for:
> http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>    Completed triple loading after 0 ms
> Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from location:
> M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\swrla.owl
> 21-07-2010 10:43:02
> edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
> loadImportedAssertions
> INFO: Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from
> location: M:\eclipse\eclipse\plugins\edu.stanford.smi.protegex.owl\swrla.owl
> Loading triples for: http://swrl.stanford.edu/ontologies/3.3/swrla.owl
>    Completed triple loading after 15 ms
> Postprocess: Process entities with incorrect Java type (0 entities) ... 0 ms
> Postprocess: Process metaclasses (3 metaclasses) ... 0 ms
> Postprocess: Process subclasses of rdf:List (1 classes) ... 0 ms
> Postprocess: Instances with multiple types (15 instances) ... 0 ms
> Postprocess: Add inferred superclasses ... 0 ms
> Postprocess: Process orphan classes (9 classes) ... 0 ms
> Postprocess: Generalized Concept Inclusion (0 axioms) ... 0 ms
> Postprocess: Abstract classes... 0 ms
> Postprocess: Domain and range of properties... 0 ms
> Postprocess: Possibly typed entities (0 resources) ... 0 ms
> Updating underlying frames model in 0 ms
> 21-07-2010 10:43:03
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser
> doFinalPostProcessing
> INFO: Updating underlying frames model in 0 ms
> Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
> 21-07-2010 10:43:03 edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory
> registerBridge
> INFO: Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
>
> //Result of the getStateQuery, The devices have one value for hasState
> property
> switch1: On
> lamp1: On
>
> WARNING: [OWLFrameStore] Warning: Attempted to assign duplicate value to
> lamp1.hasState -- DuplicateValuesFrameStore.setDirectOwnSlotValues()
> 21-07-2010 10:43:04
> edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore
> setDirectOwnSlotValues
> WARNING: [OWLFrameStore] Warning: Attempted to assign duplicate value to
> lamp1.hasState
> WARNING: [OWLFrameStore]  - On --
> DuplicateValuesFrameStore.setDirectOwnSlotValues()
> 21-07-2010 10:43:04
> edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore
> setDirectOwnSlotValues
> WARNING: [OWLFrameStore]  - On
> WARNING: [OWLFrameStore]  - On --
> DuplicateValuesFrameStore.setDirectOwnSlotValues()
> 21-07-2010 10:43:04
> edu.stanford.smi.protegex.owl.model.framestore.DuplicateValuesFrameStore
> setDirectOwnSlotValues
> WARNING: [OWLFrameStore]  - On
>
> //Result of the getStateQuery, The lamp1 has 2 values for hasState property
> lamp1: Off
> switch1: Off
> lamp1: On
>
>
> I also tried to run these two rules instead:
> SWRLImp imp = factory2.createImp("Control_lamp_Off", "Light(?lamp) ^
> hasControl(?lamp, ?control)  ^ hasState(?control, ?statecontrol)^
> swrlb:equal(?statecontrol, \"Off\") -> hasState(?lamp, \"Off\")");
> SWRLImp imp2 = factory2.createImp("Control_lamp_On", "Light(?lamp) ^
> hasControl(?lamp, ?control) ^ hasState(?control, ?statecontrol)^
> swrlb:equal(?statecontrol, \"On\") -> hasState(?lamp, \"On\")");
>
>
> but I got the same result. Am I doing something wrong? Or is it not possible
> to use SWRL rules and Jess to change dataproperties values??
>
> Will I have the same problem if I try to use EulerGUI?
>
> I have been looking around and there are a lot of rule engines, RuleML,
> Sweetrules, etc. Which one do you recomment to work together with my
> ontology? EulerGui?
>
> Thanks,
> Ana
> --
> View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Create-Rules-in-Eclipse-using-Protege-3-4-4-tp2288368p2296808.html
> Sent from the Protege OWL mailing list archive at Nabble.com.
> _______________________________________________
> 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
>




--
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
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 )
_______________________________________________
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


 


simple-ontology.owl (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Create Rules in Eclipse using Protege 3.4.4

Jean-Marc Vanel


2010/7/21 aros <[hidden email]>

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 :

After firing rules it prints both :

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.

But currently we don't use insertLogical() when generating rules for the Drools engine. I'll add this feature today and let you know .

--
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
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 )

_______________________________________________
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: Create Rules in Eclipse using Protege 3.4.4

aros
Hi Jean-Marc,

Thanks for expending time doing the StatefulKB.java.

I included the StatefulKB.java into a project in Eclipse (I am working with OSGi framework).
I included eulergui-1.6-jar-with-dependencies.jar into the project's lib folder to handle the import of this class. (I obtained the jar from http://sourceforge.net/projects/eulergui/ and then included it in the project's manifest as Bundle-ClassPath:and also in the project's build path).
I run StatefulKB.java and it seems like the rule is not fired because I obtain that light1 did not change hasStatus to Off.  (YOuMiktex.JPG can see the printout at the end, I checked that switch1 changed hasState)

I dont really undertand why the rule is not fired. I used exactly the same ontology that I sent you. From StatefulKB.java I just changed this line, so it could find the ontology:

String url = "file:///M:/MyJessTest/simple-ontology.owl";

However I obtained a wierd problem when executing this line:
sourceFactory.addSource( new URL( url ), project );
A MiKTeX window pops up saying: Invalid YAP command-line. I have attached an image of this window in addition to the console marking the point were the window shows up. Maybe this has something to do with the rule not being executing?

Another problem I have is that by using euler I have two working databases: my OWLModel (from protege) and then ITripleStoreRETE (from euler). This means that if I make a change in the OWLModel the rule engine will not know about this change, and viceversa, that if a rule is fired the OWLModel will not be changed by the rule. Is there no rule engine that works with OWLModel (beside jess, which does not seems to work with the type of rules I want to use)


Console when running StatefulKB.java:


osgi>
22-07-2010 16:47:49 eulergui.project.ProjectChangeSupport addProjectListener
INFO: ProjectChangeSupport.addProjectListener(): added listener eulergui.tools.SWRLTranslator@3c2378
22-07-2010 16:47:49 n3_project.SourceFactory addSource
INFO: contentType: "application/xml"
22-07-2010 16:47:50 eulergui.inputs.N3SourceFromOtherFormat makeTemporaryFile
INFO: N3SourceFromOtherFormat.makeTemporaryFile()
22-07-2010 16:47:50 n3_project.N3SourceFromRDF doParseRDF
INFO: Reading RDF: file:///M:/MyJessTest/simple-ontology-jean.owl
22-07-2010 16:47:50 n3_project.N3SourceFromRDF doParseRDF
INFO: RDF parsed and translated: file:///M:/MyJessTest/simple-ontology-jean.owl
22-07-2010 16:47:50 n3_project.N3SourceFromRDF prepareRDF
INFO: N3SourceFromRDF.prepareRDF(): getSources: {}
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
22-07-2010 16:47:51 eulergui.project.Project restore
INFO: opening Project from URL "http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/swrl-n3-rules.n3p"
22-07-2010 16:47:52 eulergui.project.Project restore
INFO: opening Project from "C:\DOCUME~1\aros\LOCALS~1\Temp\project-5189818755950183466.n3p" ( http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/swrl-n3-rules.n3p )
22-07-2010 16:47:52 eulergui.project.Project restore
INFO: Project opened from "C:\Documents and Settings\aros\Local Settings\Temp\project-5189818755950183466.n3p" in local directory; 2 N3 sources.
22-07-2010 16:47:52 eulergui.project.Project prepare
INFO: Project.prepare() http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/swrl-n3-rules.n3p
22-07-2010 16:47:52 eulergui.project.Project prepare
INFO: Project.prepare(): loop: ./swrl-n3-rules.n3
22-07-2010 16:47:52 eulergui.project.Project prepare
INFO: Project http:../viewvc/deductions/n3_new/swrl-n3-rules.n3p prepare(): Thread start for reading ./swrl-n3-rules.n3
Project.prepare().new Thread() {...}.run():  Thread for http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/swrl-n3-rules.n3 finished.
22-07-2010 16:47:52 eulergui.project.Project prepare
INFO: Project.prepare(): loop: ./variableSubstitution.n3
Project.prepare().new Thread() {...}.run():  Thread for http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/variableSubstitution.n3 finished.
22-07-2010 16:47:52 eulergui.project.Project prepare
INFO: Project http:../viewvc/deductions/n3_new/swrl-n3-rules.n3p prepare(): Thread start for reading ./variableSubstitution.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
22-07-2010 16:47:55 eulergui.project.Project makeEulerArguments
INFO: Running eye --nope "http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/swrl-n3-rules.n3" "http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/variableSubstitution.n3" "C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3" --query http://deductions.svn.sourceforge.net/viewvc/deductions/n3_new/swrl-n3-rulesQ.n3
Here MiKTeX window pops up
22-07-2010 16:48:42 eulergui.project.Project reasonExternalProlog
INFO: External Process finished
22-07-2010 16:48:42 n3_project.helpers.N3SourcetoDrools removeResults
INFO: Retracted 0 objects in workingMemory, from a total of 0. So remains 0 objects.
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
22-07-2010 16:48:42 eulergui.project.Project translateN32Drools
INFO:
//////// translating file:/C:/DOCUME~1/aros/LOCALS~1/Temp/translation-2624329476196417451.n3 file:///M:/MyJessTest/simple-ontology-jean.owl class n3_project.N3SourceFromRDF ////////
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
22-07-2010 16:48:42 n3_project.helpers.N3SourcetoDrools removeRulePackage
INFO: removeRulePackage(): no facts corresponding to file:/C:/DOCUME~1/aros/LOCALS~1/Temp/translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
22-07-2010 16:48:43 n3_project.helpers.N3SourcetoDrools translate
INFO: // fact Count 100
N3SourceFromOtherFormat.makeOutputStreamToTemporaryFile(): getFileName() C:\DOCUME~1\aros\LOCALS~1\Temp\translation-2624329476196417451.n3
22-07-2010 16:48:43 n3_project.helpers.N3SourcetoDrools translate
INFO: // rule Count 0

Before fireAllRules
[<http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#isIn> <http://www.simple-ontology.owl#bedroom> .
, <http://www.simple-ontology.owl#light1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.simple-ontology.owl#Light> .
, <http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#hasState> "On" .
, <http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#hasControl> <http://www.simple-ontology.owl#switch1> .
]

Before fireAllRules
[<http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#hasState> "On" .
, <http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#isIn> <http://www.simple-ontology.owl#bedroom> .
, <http://www.simple-ontology.owl#switch1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.simple-ontology.owl#Switch> .
, <http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#isControl> <http://www.simple-ontology.owl#light1> .
]

After fireAllRules
[<http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#isIn> <http://www.simple-ontology.owl#bedroom> .
, <http://www.simple-ontology.owl#light1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.simple-ontology.owl#Light> .
, <http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#hasState> "On" .
, <http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#hasControl> <http://www.simple-ontology.owl#switch1> .
]
TripleStoreDrools.store( <http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#hasState> "Off" .

After hasState Off & fireAllRules
[<http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#isIn> <http://www.simple-ontology.owl#bedroom> .
, <http://www.simple-ontology.owl#light1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.simple-ontology.owl#Light> .
, <http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#hasState> "On" .
, <http://www.simple-ontology.owl#light1> <http://www.simple-ontology.owl#hasControl> <http://www.simple-ontology.owl#switch1> .
]

After hasState Off & fireAllRules
[<http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#isIn> <http://www.simple-ontology.owl#bedroom> .
, <http://www.simple-ontology.owl#switch1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.simple-ontology.owl#Switch> .
, <http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#hasState> "Off" .
, <http://www.simple-ontology.owl#switch1> <http://www.simple-ontology.owl#isControl> <http://www.simple-ontology.owl#light1> .
]


Again, Thanks A Lot,

Ana