[protege-owl] Interact with the Jess Bridge at the Java API level

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

[protege-owl] Interact with the Jess Bridge at the Java API level

N.Li
Interact with the Jess Bridge at the Java API level

Dear all,

I have been trying to find out how to use Jess bridge provided by Protege-OWL to reason about the SWRL rules created using SWRL factory at the Java API Level. The SWRL document, particularly the FAQ provide with me a point to start with as follows

import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
import edu.stanford.smi.protegex.owl.model.*;
import jess.*; SWRLJessBridge bridge;
OWLModel owlModel
Rete rete;

...
owlModel = ... // Create using normal Protege-OWL mechanisms.
rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.

...
try {
  bridge = new SWRLJessBridge(owlModel, rete);
} catch (SWRLRuleEngineBridgeException e) {
  ... // Deal with exception.
} // try 

It is fine by far, however, I do not know how to move to the next step to interact the created bridge with the SWRLImp which contains the SWRL rules body and head in the forms of AtomList, which seems to me needing to use the following methods
importSWRLRulesAndOWLKnowledge()
exportSWRLRulesAndOWLKnowledge()
runRuleEngine()
writeAssertedIndividualsAndProperties2OWL()
resetBridge()
resetRuleEngine()

etc.

Can anybody guide me throught this or direct me to the right document please?

Many thanks

Ning

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Interact with the Jess Bridge at the Java API level

Martin O'Connor

The SWRL Factory is used to interact with the SWRLImp objects that
contain SWRL rules. The  bridge does not modify or create SWRL rules so
it would not make any sense to use the bridge to work with SWRLImp
objects. If you want to work directly with SWRL rules, you do not need
the bridge - the factory should be all you need. It is documented here:

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

Martin


[hidden email] wrote:

> Dear all,
>
> I have been trying to find out how to use Jess bridge provided by
> Protege-OWL to reason about the SWRL rules created using SWRL factory
> at the Java API Level. The SWRL document, particularly the FAQ provide
> with me a point to start with as follows
>
> import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
> import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
> import edu.stanford.smi.protegex.owl.model.*;
> import jess.*; SWRLJessBridge bridge;
> OWLModel owlModel
> Rete rete;
>
> ...
> owlModel = ... // Create using normal Protege-OWL mechanisms.
> rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.
>
> ...
> try {
>   bridge = new SWRLJessBridge(owlModel, rete);
> } catch (SWRLRuleEngineBridgeException e) {
>   ... // Deal with exception.
> } // try
>
> It is fine by far, however, I do not know how to move to the next step
> to interact the created bridge with the SWRLImp which contains the
> SWRL rules body and head in the forms of AtomList, which seems to me
> needing to use the following methods
> importSWRLRulesAndOWLKnowledge()
> exportSWRLRulesAndOWLKnowledge()
> runRuleEngine()
> writeAssertedIndividualsAndProperties2OWL()
> resetBridge()
> resetRuleEngine()
>
> etc.
>
> Can anybody guide me throught this or direct me to the right document
> please?
>
> Many thanks
>
> Ning
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Interact with the Jess Bridge at the Java API level

N.Li
In reply to this post by N.Li
Thanks Martin. This seems clarify the situation a bit.
However, what I tend to achieve is to use jess rule engine to excute the SWRL rules. It is clear that SWRLImp contains the rules, which you could use it to create, or modify the rules. What if using Jess to reason upon these rules and produce more facts and then represent back to OWL knowledge base. I thought the rule engine bridge is developed particularly for this purpose to link the Jess with SWRL rules which are wrapped into SWRLImp objects, and the bridge should directly interact with the Jess and SWRLImp somehow? If that's the case, how is it done?

Best regards
Ning


-----Original Message-----
From: [hidden email] on behalf of Martin O'Connor
Sent: Tue 6/6/2006 3:49 PM
To: [hidden email]
Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
 

The SWRL Factory is used to interact with the SWRLImp objects that
contain SWRL rules. The  bridge does not modify or create SWRL rules so
it would not make any sense to use the bridge to work with SWRLImp
objects. If you want to work directly with SWRL rules, you do not need
the bridge - the factory should be all you need. It is documented here:

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

Martin


[hidden email] wrote:

> Dear all,
>
> I have been trying to find out how to use Jess bridge provided by
> Protege-OWL to reason about the SWRL rules created using SWRL factory
> at the Java API Level. The SWRL document, particularly the FAQ provide
> with me a point to start with as follows
>
> import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
> import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
> import edu.stanford.smi.protegex.owl.model.*;
> import jess.*; SWRLJessBridge bridge;
> OWLModel owlModel
> Rete rete;
>
> ...
> owlModel = ... // Create using normal Protege-OWL mechanisms.
> rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.
>
> ...
> try {
>   bridge = new SWRLJessBridge(owlModel, rete);
> } catch (SWRLRuleEngineBridgeException e) {
>   ... // Deal with exception.
> } // try
>
> It is fine by far, however, I do not know how to move to the next step
> to interact the created bridge with the SWRLImp which contains the
> SWRL rules body and head in the forms of AtomList, which seems to me
> needing to use the following methods
> importSWRLRulesAndOWLKnowledge()
> exportSWRLRulesAndOWLKnowledge()
> runRuleEngine()
> writeAssertedIndividualsAndProperties2OWL()
> resetBridge()
> resetRuleEngine()
>
> etc.
>
> Can anybody guide me throught this or direct me to the right document
> please?
>
> Many thanks
>
> Ning
>
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html



winmail.dat (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Interact with the Jess Bridge at the Java API level

Martin O'Connor

When you create a SWRL/Jess bridge, you pass it an OWL model (which
presumably contains SWRL rules) and an instance of a Jess rule engine,
e.g.,

SWRLJessBridge bridge;
OWLModel owlModel;
Rete rete; // Instance of Jess rule engine.

...
owlModel = ... // Create using normal Protege-OWL mechanisms.
rete = new Rete(); // Create Jess rule engine.

bridge = new SWRLJessBridge(owlModel, rete); // Create bridge

The bridge knows how to extract SWRL rules from the OWL model supplied
to it. It uses the factory and its associated SWRLImp objects to perform
this extraction, but this process is not visible to the user of the bridge.

If you want the bridge to execute SWRL rules and put the inferred
information back into the supplied OWL model, you do the steps you list
in your first email:

bridge.importSWRLRulesAndOWLKnowledge() // Import SWRL rules/knowledge from OWL kb
bridge.exportSWRLRulesAndOWLKnowledge() // Export that knowledge to engine
bridge.runRuleEngine() // Run inference
bridge.writeAssertedIndividualsAndProperties2OWL() // Pass inferred knowledge to OWL kb

There should be no reason to interact directly with SWRLImp objects when
using the bridge.

I have updated the FAQ to hopefully explain process more clearly:

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

Martin

[hidden email] wrote:

>Thanks Martin. This seems clarify the situation a bit.
>However, what I tend to achieve is to use jess rule engine to excute the SWRL rules. It is clear that SWRLImp contains the rules, which you could use it to create, or modify the rules. What if using Jess to reason upon these rules and produce more facts and then represent back to OWL knowledge base. I thought the rule engine bridge is developed particularly for this purpose to link the Jess with SWRL rules which are wrapped into SWRLImp objects, and the bridge should directly interact with the Jess and SWRLImp somehow? If that's the case, how is it done?
>
>Best regards
>Ning
>
>
>-----Original Message-----
>From: [hidden email] on behalf of Martin O'Connor
>Sent: Tue 6/6/2006 3:49 PM
>To: [hidden email]
>Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
>
>
>The SWRL Factory is used to interact with the SWRLImp objects that
>contain SWRL rules. The  bridge does not modify or create SWRL rules so
>it would not make any sense to use the bridge to work with SWRLImp
>objects. If you want to work directly with SWRL rules, you do not need
>the bridge - the factory should be all you need. It is documented here:
>
>http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ
>
>Martin
>
>
>[hidden email] wrote:
>
>  
>
>>Dear all,
>>
>>I have been trying to find out how to use Jess bridge provided by
>>Protege-OWL to reason about the SWRL rules created using SWRL factory
>>at the Java API Level. The SWRL document, particularly the FAQ provide
>>with me a point to start with as follows
>>
>>import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
>>import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
>>import edu.stanford.smi.protegex.owl.model.*;
>>import jess.*; SWRLJessBridge bridge;
>>OWLModel owlModel
>>Rete rete;
>>
>>...
>>owlModel = ... // Create using normal Protege-OWL mechanisms.
>>rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.
>>
>>...
>>try {
>>  bridge = new SWRLJessBridge(owlModel, rete);
>>} catch (SWRLRuleEngineBridgeException e) {
>>  ... // Deal with exception.
>>} // try
>>
>>It is fine by far, however, I do not know how to move to the next step
>>to interact the created bridge with the SWRLImp which contains the
>>SWRL rules body and head in the forms of AtomList, which seems to me
>>needing to use the following methods
>>importSWRLRulesAndOWLKnowledge()
>>exportSWRLRulesAndOWLKnowledge()
>>runRuleEngine()
>>writeAssertedIndividualsAndProperties2OWL()
>>resetBridge()
>>resetRuleEngine()
>>
>>etc.
>>
>>Can anybody guide me throught this or direct me to the right document
>>please?
>>
>>Many thanks
>>
>>Ning
>>
>>    
>>
>
>-------------------------------------------------------------------------
>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>
>  
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] SPARQL queries

JMiller

Is it possible to do a SPARQL query using the rdf:ID?  If so, can I get an example?  I can successfully query using other properties, but the rdf:ID query returns 0 every time.

I am trying this with Protege GUI, build 321, and also via the API, with the same results.

Jim
Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: SPARQL queries

yijeong
메시지
SPARQL examples:
 
SELECT ?res
 
 
WHERE (?res rdf:type Person)
 
 
"?res" is a rdf:ID
 
----------------------------------------------------------------------------
()솔트룩스 / Since 1979
정용일 전임연구원(Natural Language Processing Team, Associate Research Engineer)
TEL: 02-3402-0081(#214)
FAX: 02-3402-0082
HP: 016-508-3190
[hidden email], www.saltlux.com
[hidden email]
-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of James A Miller
Sent: Wednesday, June 07, 2006 4:52 AM
To: [hidden email]
Subject: [protege-owl] SPARQL queries


Is it possible to do a SPARQL query using the rdf:ID?  If so, can I get an example?  I can successfully query using other properties, but the rdf:ID query returns 0 every time.

I am trying this with Protege GUI, build 321, and also via the API, with the same results.

Jim
Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: SPARQL queries

JMiller

Thanks yieong;

What I was trying to do was:  if I know the rdf:ID, what is the SPARQL query to get the matching resource?

I suspect that I have just answered my question:  I think I need to use an owlModel.getRDFResource(name) call, not any SPARQL query at all, correct?  (but is the name of an RDF property == its rdf:ID?)

Jim



"yijeong" <[hidden email]>
Sent by: [hidden email]

06/06/2006 09:08 PM

Please respond to
[hidden email]

To
<[hidden email]>
cc
Subject
[protege-owl] Re: SPARQL queries





SPARQL examples:
 
SELECT ?res
 
 
WHERE (?res rdf:type Person)
 
 
"?res" is a rdf:ID
 
----------------------------------------------------------------------------
(
)솔트룩스 / Since 1979
정용일 전임연구원(
Natural Language Processing Team, Associate Research Engineer)
TEL: 02-3402-0081(#214)
FAX: 02-3402-0082
HP: 016-508-3190

yijeong@..., www.saltlux.com
yijeong@...
-----Original Message-----
From:
[hidden email] [mailto:[hidden email]] On Behalf Of James A Miller
Sent:
Wednesday, June 07, 2006 4:52 AM
To:
[hidden email]
Subject:
[protege-owl] SPARQL queries


Is it possible to do a SPARQL query using the rdf:ID?  If so, can I get an example?  I can successfully query using other properties, but the rdf:ID query returns 0 every time.


I am trying this with Protege GUI, build 321, and also via the API, with the same results.


Jim

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: SPARQL queries

Olivier Dameron
On Tue, 6 Jun 2006 21:24:28 -0500, James A Miller
<[hidden email]> wrote:

> (but is the name of an RDF property == its rdf:ID?)

yes.
Olivier
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Interact with the Jess Bridge at the Java API level

N.Li
In reply to this post by N.Li
Thanks Martin.

You confimed what I have been believing in. The reason I asked is when I used eclipse to write this java application, the auto complete functions should help to come up with a list of the options importSWRLRulesAndOWLKnowledge() exportSWRLRulesAndOWLKnowledge(),runRuleEngine() and etc. after I typed in bridge. but it didn't. I did suspect whether the bridge is created sussessfully. Anyway, I typed in everything after getting your email. Then when I tried to compile it, it always came up with "<identifier> expected" from "bridge = new SWRLJessBridge(owlModel, rete)" and onwards. It seems to me either owlModel or rete is not sussessfully created and thus recognised. I used the family.swrl.owl to create owlModel and used tried version of jess. I kind of wonder whether the trial version of jess does not fully functional and cause the rete not created properly, on any other possible reasons?

Many thanks

Ning


-----Original Message-----
From: [hidden email] on behalf of Martin O'Connor
Sent: Tue 6/6/2006 6:35 PM
To: [hidden email]
Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
 

When you create a SWRL/Jess bridge, you pass it an OWL model (which
presumably contains SWRL rules) and an instance of a Jess rule engine,
e.g.,

SWRLJessBridge bridge;
OWLModel owlModel;
Rete rete; // Instance of Jess rule engine.

...
owlModel = ... // Create using normal Protege-OWL mechanisms.
rete = new Rete(); // Create Jess rule engine.

bridge = new SWRLJessBridge(owlModel, rete); // Create bridge

The bridge knows how to extract SWRL rules from the OWL model supplied
to it. It uses the factory and its associated SWRLImp objects to perform
this extraction, but this process is not visible to the user of the bridge.

If you want the bridge to execute SWRL rules and put the inferred
information back into the supplied OWL model, you do the steps you list
in your first email:

bridge.importSWRLRulesAndOWLKnowledge() // Import SWRL rules/knowledge from OWL kb
bridge.exportSWRLRulesAndOWLKnowledge() // Export that knowledge to engine
bridge.runRuleEngine() // Run inference
bridge.writeAssertedIndividualsAndProperties2OWL() // Pass inferred knowledge to OWL kb

There should be no reason to interact directly with SWRLImp objects when
using the bridge.

I have updated the FAQ to hopefully explain process more clearly:

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

Martin

[hidden email] wrote:

>Thanks Martin. This seems clarify the situation a bit.
>However, what I tend to achieve is to use jess rule engine to excute the SWRL rules. It is clear that SWRLImp contains the rules, which you could use it to create, or modify the rules. What if using Jess to reason upon these rules and produce more facts and then represent back to OWL knowledge base. I thought the rule engine bridge is developed particularly for this purpose to link the Jess with SWRL rules which are wrapped into SWRLImp objects, and the bridge should directly interact with the Jess and SWRLImp somehow? If that's the case, how is it done?
>
>Best regards
>Ning
>
>
>-----Original Message-----
>From: [hidden email] on behalf of Martin O'Connor
>Sent: Tue 6/6/2006 3:49 PM
>To: [hidden email]
>Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
>
>
>The SWRL Factory is used to interact with the SWRLImp objects that
>contain SWRL rules. The  bridge does not modify or create SWRL rules so
>it would not make any sense to use the bridge to work with SWRLImp
>objects. If you want to work directly with SWRL rules, you do not need
>the bridge - the factory should be all you need. It is documented here:
>
>http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ
>
>Martin
>
>
>[hidden email] wrote:
>
>  
>
>>Dear all,
>>
>>I have been trying to find out how to use Jess bridge provided by
>>Protege-OWL to reason about the SWRL rules created using SWRL factory
>>at the Java API Level. The SWRL document, particularly the FAQ provide
>>with me a point to start with as follows
>>
>>import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
>>import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
>>import edu.stanford.smi.protegex.owl.model.*;
>>import jess.*; SWRLJessBridge bridge;
>>OWLModel owlModel
>>Rete rete;
>>
>>...
>>owlModel = ... // Create using normal Protege-OWL mechanisms.
>>rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.
>>
>>...
>>try {
>>  bridge = new SWRLJessBridge(owlModel, rete);
>>} catch (SWRLRuleEngineBridgeException e) {
>>  ... // Deal with exception.
>>} // try
>>
>>It is fine by far, however, I do not know how to move to the next step
>>to interact the created bridge with the SWRLImp which contains the
>>SWRL rules body and head in the forms of AtomList, which seems to me
>>needing to use the following methods
>>importSWRLRulesAndOWLKnowledge()
>>exportSWRLRulesAndOWLKnowledge()
>>runRuleEngine()
>>writeAssertedIndividualsAndProperties2OWL()
>>resetBridge()
>>resetRuleEngine()
>>
>>etc.
>>
>>Can anybody guide me throught this or direct me to the right document
>>please?
>>
>>Many thanks
>>
>>Ning
>>
>>    
>>
>
>-------------------------------------------------------------------------
>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>
>  
>
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html



winmail.dat (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Interact with the Jess Bridge at the Java API level

Martin O'Connor

I don't use Eclipse so cannot help you there. Why not try compiling on
the command line and see what specific Java error you get?

Martin

[hidden email] wrote:

>Thanks Martin.
>
>You confimed what I have been believing in. The reason I asked is when I used eclipse to write this java application, the auto complete functions should help to come up with a list of the options importSWRLRulesAndOWLKnowledge() exportSWRLRulesAndOWLKnowledge(),runRuleEngine() and etc. after I typed in bridge. but it didn't. I did suspect whether the bridge is created sussessfully. Anyway, I typed in everything after getting your email. Then when I tried to compile it, it always came up with "<identifier> expected" from "bridge = new SWRLJessBridge(owlModel, rete)" and onwards. It seems to me either owlModel or rete is not sussessfully created and thus recognised. I used the family.swrl.owl to create owlModel and used tried version of jess. I kind of wonder whether the trial version of jess does not fully functional and cause the rete not created properly, on any other possible reasons?
>
>Many thanks
>
>Ning
>
>
>-----Original Message-----
>From: [hidden email] on behalf of Martin O'Connor
>Sent: Tue 6/6/2006 6:35 PM
>To: [hidden email]
>Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
>
>
>When you create a SWRL/Jess bridge, you pass it an OWL model (which
>presumably contains SWRL rules) and an instance of a Jess rule engine,
>e.g.,
>
>SWRLJessBridge bridge;
>OWLModel owlModel;
>Rete rete; // Instance of Jess rule engine.
>
>...
>owlModel = ... // Create using normal Protege-OWL mechanisms.
>rete = new Rete(); // Create Jess rule engine.
>
>bridge = new SWRLJessBridge(owlModel, rete); // Create bridge
>
>The bridge knows how to extract SWRL rules from the OWL model supplied
>to it. It uses the factory and its associated SWRLImp objects to perform
>this extraction, but this process is not visible to the user of the bridge.
>
>If you want the bridge to execute SWRL rules and put the inferred
>information back into the supplied OWL model, you do the steps you list
>in your first email:
>
>bridge.importSWRLRulesAndOWLKnowledge() // Import SWRL rules/knowledge from OWL kb
>bridge.exportSWRLRulesAndOWLKnowledge() // Export that knowledge to engine
>bridge.runRuleEngine() // Run inference
>bridge.writeAssertedIndividualsAndProperties2OWL() // Pass inferred knowledge to OWL kb
>
>There should be no reason to interact directly with SWRLImp objects when
>using the bridge.
>
>I have updated the FAQ to hopefully explain process more clearly:
>
>http://protege.cim3.net/cgi-bin/wiki.pl?SWRLRuleEngineBridgeFAQ
>
>Martin
>
>[hidden email] wrote:
>
>  
>
>>Thanks Martin. This seems clarify the situation a bit.
>>However, what I tend to achieve is to use jess rule engine to excute the SWRL rules. It is clear that SWRLImp contains the rules, which you could use it to create, or modify the rules. What if using Jess to reason upon these rules and produce more facts and then represent back to OWL knowledge base. I thought the rule engine bridge is developed particularly for this purpose to link the Jess with SWRL rules which are wrapped into SWRLImp objects, and the bridge should directly interact with the Jess and SWRLImp somehow? If that's the case, how is it done?
>>
>>Best regards
>>Ning
>>
>>
>>-----Original Message-----
>>From: [hidden email] on behalf of Martin O'Connor
>>Sent: Tue 6/6/2006 3:49 PM
>>To: [hidden email]
>>Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
>>
>>
>>The SWRL Factory is used to interact with the SWRLImp objects that
>>contain SWRL rules. The  bridge does not modify or create SWRL rules so
>>it would not make any sense to use the bridge to work with SWRLImp
>>objects. If you want to work directly with SWRL rules, you do not need
>>the bridge - the factory should be all you need. It is documented here:
>>
>>http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ
>>
>>Martin
>>
>>
>>[hidden email] wrote:
>>
>>
>>
>>    
>>
>>>Dear all,
>>>
>>>I have been trying to find out how to use Jess bridge provided by
>>>Protege-OWL to reason about the SWRL rules created using SWRL factory
>>>at the Java API Level. The SWRL document, particularly the FAQ provide
>>>with me a point to start with as follows
>>>
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
>>>import edu.stanford.smi.protegex.owl.model.*;
>>>import jess.*; SWRLJessBridge bridge;
>>>OWLModel owlModel
>>>Rete rete;
>>>
>>>...
>>>owlModel = ... // Create using normal Protege-OWL mechanisms.
>>>rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.
>>>
>>>...
>>>try {
>>> bridge = new SWRLJessBridge(owlModel, rete);
>>>} catch (SWRLRuleEngineBridgeException e) {
>>> ... // Deal with exception.
>>>} // try
>>>
>>>It is fine by far, however, I do not know how to move to the next step
>>>to interact the created bridge with the SWRLImp which contains the
>>>SWRL rules body and head in the forms of AtomList, which seems to me
>>>needing to use the following methods
>>>importSWRLRulesAndOWLKnowledge()
>>>exportSWRLRulesAndOWLKnowledge()
>>>runRuleEngine()
>>>writeAssertedIndividualsAndProperties2OWL()
>>>resetBridge()
>>>resetRuleEngine()
>>>
>>>etc.
>>>
>>>Can anybody guide me throught this or direct me to the right document
>>>please?
>>>
>>>Many thanks
>>>
>>>Ning
>>>
>>>  
>>>
>>>      
>>>
>>-------------------------------------------------------------------------
>>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>>
>>
>>
>>
>>    
>>
>
>-------------------------------------------------------------------------
>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>
>  
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Interact with the Jess Bridge at the Java API level

N.Li
In reply to this post by N.Li
This section of the description was actually telling the result of editing the file in plain editor and compiling it from the command line.

"Then when I tried to compile it, it always came up with "<identifier> expected" from "bridge = new SWRLJessBridge(owlModel, rete)" and onwards. It seems to me either owlModel or rete is not sussessfully created and thus recognised. I used the family.swrl.owl to create owlModel and used tried version of jess. I kind of wonder whether the trial version of jess does not fully functional and cause the rete not created properly, on any other possible reasons?"

Many thanks
Ning

-----Original Message-----
From: [hidden email] on behalf of Martin O'Connor
Sent: Wed 6/7/2006 3:56 PM
To: [hidden email]
Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
 

I don't use Eclipse so cannot help you there. Why not try compiling on
the command line and see what specific Java error you get?

Martin

[hidden email] wrote:

>Thanks Martin.
>
>You confimed what I have been believing in. The reason I asked is when I used eclipse to write this java application, the auto complete functions should help to come up with a list of the options importSWRLRulesAndOWLKnowledge() exportSWRLRulesAndOWLKnowledge(),runRuleEngine() and etc. after I typed in bridge. but it didn't. I did suspect whether the bridge is created sussessfully. Anyway, I typed in everything after getting your email. Then when I tried to compile it, it always came up with "<identifier> expected" from "bridge = new SWRLJessBridge(owlModel, rete)" and onwards. It seems to me either owlModel or rete is not sussessfully created and thus recognised. I used the family.swrl.owl to create owlModel and used tried version of jess. I kind of wonder whether the trial version of jess does not fully functional and cause the rete not created properly, on any other possible reasons?
>
>Many thanks
>
>Ning
>
>
>-----Original Message-----
>From: [hidden email] on behalf of Martin O'Connor
>Sent: Tue 6/6/2006 6:35 PM
>To: [hidden email]
>Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
>
>
>When you create a SWRL/Jess bridge, you pass it an OWL model (which
>presumably contains SWRL rules) and an instance of a Jess rule engine,
>e.g.,
>
>SWRLJessBridge bridge;
>OWLModel owlModel;
>Rete rete; // Instance of Jess rule engine.
>
>...
>owlModel = ... // Create using normal Protege-OWL mechanisms.
>rete = new Rete(); // Create Jess rule engine.
>
>bridge = new SWRLJessBridge(owlModel, rete); // Create bridge
>
>The bridge knows how to extract SWRL rules from the OWL model supplied
>to it. It uses the factory and its associated SWRLImp objects to perform
>this extraction, but this process is not visible to the user of the bridge.
>
>If you want the bridge to execute SWRL rules and put the inferred
>information back into the supplied OWL model, you do the steps you list
>in your first email:
>
>bridge.importSWRLRulesAndOWLKnowledge() // Import SWRL rules/knowledge from OWL kb
>bridge.exportSWRLRulesAndOWLKnowledge() // Export that knowledge to engine
>bridge.runRuleEngine() // Run inference
>bridge.writeAssertedIndividualsAndProperties2OWL() // Pass inferred knowledge to OWL kb
>
>There should be no reason to interact directly with SWRLImp objects when
>using the bridge.
>
>I have updated the FAQ to hopefully explain process more clearly:
>
>http://protege.cim3.net/cgi-bin/wiki.pl?SWRLRuleEngineBridgeFAQ
>
>Martin
>
>[hidden email] wrote:
>
>  
>
>>Thanks Martin. This seems clarify the situation a bit.
>>However, what I tend to achieve is to use jess rule engine to excute the SWRL rules. It is clear that SWRLImp contains the rules, which you could use it to create, or modify the rules. What if using Jess to reason upon these rules and produce more facts and then represent back to OWL knowledge base. I thought the rule engine bridge is developed particularly for this purpose to link the Jess with SWRL rules which are wrapped into SWRLImp objects, and the bridge should directly interact with the Jess and SWRLImp somehow? If that's the case, how is it done?
>>
>>Best regards
>>Ning
>>
>>
>>-----Original Message-----
>>From: [hidden email] on behalf of Martin O'Connor
>>Sent: Tue 6/6/2006 3:49 PM
>>To: [hidden email]
>>Subject: [protege-owl] Re: Interact with the Jess Bridge at the Java API level
>>
>>
>>The SWRL Factory is used to interact with the SWRLImp objects that
>>contain SWRL rules. The  bridge does not modify or create SWRL rules so
>>it would not make any sense to use the bridge to work with SWRLImp
>>objects. If you want to work directly with SWRL rules, you do not need
>>the bridge - the factory should be all you need. It is documented here:
>>
>>http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ
>>
>>Martin
>>
>>
>>[hidden email] wrote:
>>
>>
>>
>>    
>>
>>>Dear all,
>>>
>>>I have been trying to find out how to use Jess bridge provided by
>>>Protege-OWL to reason about the SWRL rules created using SWRL factory
>>>at the Java API Level. The SWRL document, particularly the FAQ provide
>>>with me a point to start with as follows
>>>
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
>>>import edu.stanford.smi.protegex.owl.model.*;
>>>import jess.*; SWRLJessBridge bridge;
>>>OWLModel owlModel
>>>Rete rete;
>>>
>>>...
>>>owlModel = ... // Create using normal Protege-OWL mechanisms.
>>>rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.
>>>
>>>...
>>>try {
>>> bridge = new SWRLJessBridge(owlModel, rete);
>>>} catch (SWRLRuleEngineBridgeException e) {
>>> ... // Deal with exception.
>>>} // try
>>>
>>>It is fine by far, however, I do not know how to move to the next step
>>>to interact the created bridge with the SWRLImp which contains the
>>>SWRL rules body and head in the forms of AtomList, which seems to me
>>>needing to use the following methods
>>>importSWRLRulesAndOWLKnowledge()
>>>exportSWRLRulesAndOWLKnowledge()
>>>runRuleEngine()
>>>writeAssertedIndividualsAndProperties2OWL()
>>>resetBridge()
>>>resetRuleEngine()
>>>
>>>etc.
>>>
>>>Can anybody guide me throught this or direct me to the right document
>>>please?
>>>
>>>Many thanks
>>>
>>>Ning
>>>
>>>  
>>>
>>>      
>>>
>>-------------------------------------------------------------------------
>>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>>
>>
>>
>>
>>    
>>
>
>-------------------------------------------------------------------------
>To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>
>  
>
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html



winmail.dat (7K) Download Attachment