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] problem with SWRLRuleEngineBridge

Martin O'Connor martin.oconnor at stanford.edu
Wed Aug 8 14:51:47 PDT 2007


The getAssertedProperties call work fine for me with your ontology.  
Lots of code depends on the getAssertedProperties call (including the  
SWRLJessTab displays) so I would rewrite your printing code (which is  
very confusing).

Martin

  (and Quoting Hrishikesh Sharma <hrishikesh.sharma at gmail.com>:

> There seems to be a serious bug?? with with getAssertedProperties(). I
> was suggested(see the mail chain below) to extend SWRLJessBridge class
> to do what I required.
> I am using the attached ontology and sample instances to run some rules.
> When I use the Protege editor(front-end) and use JessTab and execute
> JESS rule engine, I can see all the asserted properties, right ones,
> in the appropriate pane as follows.
>
> (assert (needsBatAlarm Lenovo "true"))
> (assert (needsCharging Lenovo "true"))
> (assert (possCharging Lenovo "true"))
>
> While when I use SWRLJessBridge and enumerate all the asserted
> properties, I get garbled output.
>
> Lenovo
> true
> Lenovo
> true
> Didier_Bourse
> true
> Lenovo
> true
>
> The subclass that I implemented on your suggestion is also attached. I
> am almost sure it is a bug with the bridge code. I desperately need to
> have/demonstrate a standalone application in Java which uses
> SWRLJessBridge. Please help.
>
> Regards
>          Hrishikesh.
>
> On 7/25/07, Martin O'Connor <martin.oconnor at stanford.edu> wrote:
>>
>>
>> The bridge is documented extensively here:
>> http://protege.cim3.net/cgi-bin/wiki.pl?SWRLRuleEngineBridgeFAQ
>>
>> You can access protected methods using the standard Java subclassing
>> technique, viz:
>>
>>
>>
>> public class MyBridge extends JessRuleEngineBridge
>>
>> {
>>
>>    .
>>
>>    public Set<RuleInfo> myGetImportedSWRLRules() { return
>> getImportedSWRLRules(); }
>>
>>
>>
>> etc.
>>
>>
>>
>> Martin
>>
>>
>>
>>   _____
>>
>> From: protege-owl-bounces at lists.stanford.edu
>> [mailto:protege-owl-bounces at lists.stanford.edu] On Behalf Of Hrishikesh
>> Sharma
>> Sent: Wednesday, July 25, 2007 7:21 AM
>> To: protege-owl at lists.stanford.edu
>> Subject: Re: [protege-owl] problem with SWRLRuleEngineBridge
>>
>>
>> Essentially my problem is (at least) twofold:
>> 1. The javadocs for SWRLRuleEngineBridge and SWRLJessBridge give too less
>> information. Various methods I try to invoke based on some approximate
>> understanding misfire!
>> 2. How to get hold of the delta between new overall knowledge after a Jess
>> run, and the old knowledge in Java code. In the front end, I am able to do
>> same by examining the "Asserted Properties/Individuals" sub-tab within Jess
>> Tab.
>>
>>
>> Sincerely,
>>
>>         Hrishikesh.
>>
>>
>> On 7/24/07, Martin O'Connor <martin.oconnor at stanford.edu> wrote:
>>
>>
>> You are trying to call a protected method in this code fragment.
>> Invoking through the SWRLJessBridge does not make it unprotected - only
>> code inside the SWRLJessBridge can access it.
>>
>> Martin
>>
>> Hrishikesh Sharma wrote:
>>
>> > Hi,
>> >     I am having problem with getAssertedProperties() method of
>> > SWRLRuleEngineBridge Class. From the javadoc, I gather it is a
>> > protected method. However, in the simple java code file attached,
>> > where I invoke this method from a subclass called SWRLJessBridge, I
>> > get a compilation error
>> >
>> > RunSwrlOnOnt.java:30: getAssertedProperties() has protected access in
>> > edu.stanford.smi.protegex.owl.swrl.bridge.SWRLRuleEngineBridge
>> >          Collection ass_p = bridge.getAssertedProperties();
>> >                                   ^
>> > It is a bit surprising, for SWRLJessBridge is supposed to be subclass
>> > and hence have access to protected methods of the superclass from
>> > within objects of that type. Am I missing something trivial here? Or
>> > is it a bug(missing 'extends' definition for SWRLJessBridge)? Or is
>> > the method getAssertedProperties() an abstract method?
>> >
>> > Sincerely,
>> >        Hrishikesh
>





More information about the protege-owl mailing list