Hi Sander, The actual exception that was thrown would be returned by the JessException.getNextException() method. It's not a JessException; it's some other kind of Exception which occurs and Jess wraps in a JessException -- hence the vague wording "Error during LHS execution." Can you modify your Java code so that when it catches a JessException it does what is described in the last paragraph of Jess manual section 4.1. The stack trace from the contained exception should tell us what's really going wrong.
I think Sander Faas wrote: > Hello Ernest, > > Congratulations on the release of Jess 6.1a1. I just downloaded it and tried > to match a backward-chaining pattern to a defglobal (see message below). My > test rule looks like this: > > (defrule test-rule > (have (possession_type ?*book*)) > => > (printout t "I have a book" crlf) > > The defglobal ?*book* represents the Book.class java class: > Jess> (ppdefglobal *book*) > "(defglobal ?*book* = <External-Address:java.lang.Class>)" > > The fact on the LHS is a backward-chaining definstance fact: > (ppdeftemplate have) > "(deftemplate MAIN::have extends MAIN::__fact \"$JAVA-OBJECT$ > storyagents.storyworldontology.Have\" > (slot class (default <External-Address:jess.SerializablePD>)) > (slot owner (default <External-Address:jess.SerializablePD>)) > (slot owner_type (default <External-Address:jess.SerializablePD>)) > (slot possession (default <External-Address:jess.SerializablePD>)) > (slot possession_type (default <External-Address:jess.SerializablePD>)) > (slot OBJECT (type 2048)))" > > Now when I try to define the testrule, the following error message appears: > Jess> Jess reported an error in routine Node1TECT.call > while executing rule LHS (TECT). > Message: Error during LHS execution. > Program text: ( defrule test-rule ( have ( possession_type ?*book* ) ) = > > ( printout t "I have a book" crlf ) ) at line 7. > at jess.Node1TECT.callNodeRight(jess/Node1TECT.java:54) > at jess.Rete.updateNodes(jess/Rete.java:890) > at jess.ReteCompiler.addRule(jess/ReteCompiler.java:87) > at jess.Rete.addDefrule(jess/Rete.java:708) > at jess.Jesp.addARule(jess/Jesp.java:1024) > at jess.Jesp.doParseDefrule(jess/Jesp.java:978) > at jess.Jesp.parseDefrule(jess/Jesp.java:901) > at jess.Jesp.parseSexp(jess/Jesp.java:159) > at jess.Jesp.parse(jess/Jesp.java:62) > at storyagents.LoadJessFileBehaviour.action(LoadJessFileBehaviour.java:59) > at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:246) > at jade.core.Agent.mainLoop(Agent.java:1705) > at jade.core.Agent.run(Agent.java:1525) > at java.lang.Thread.run(Unknown Source) > > Am I doing something wrong, or is the matching to defglobals still shaky? > > Sander > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]]On > > Behalf Of [EMAIL PROTECTED] > > Sent: zaterdag 23 maart 2002 16:20 > > To: [EMAIL PROTECTED] > > Subject: Re: JESS: Backward chaining definstance facts > > > > > > > > I'm sorry, I guess I was writing in a kind of shorthand -- should have > > taken a bit more time. Of course, you can't have a bare function call > > as a slot value in a pattern, and as you observed, you can't use a > > function call at all in a backward-chaining pattern. I'd suggest that > > you use a defglobal to hold the Class object, but matching to > > defglobals is a little shaky in Jess 6.0. In the next release (which > > I've been promising "any day now" for several weeks, sorry) matching > > to defglobals will be fine, so that'd be one way to approach this. > > > > > > I think Sander Faas wrote: > > > Although I don't want to modify the objects in my ontology > > (as I mentioned > > > in my previous message), I couldn't resist to put this > > principle aside in > > > order to test if the trick works. The deftemplate of the > > have predicate now > > > looks like this: > > > > > > "(deftemplate MAIN::have extends MAIN::__fact \"$JAVA-OBJECT$ > > > storyagents.storyworldontology.Have\" > > > (slot class (default <External-Address:jess.SerializablePD>)) > > > (slot owner (default <External-Address:jess.SerializablePD>)) > > > (slot ownerType (default <External-Address:jess.SerializablePD>)) > > > (slot possession (default <External-Address:jess.SerializablePD>)) > > > (slot possessionType (default > > <External-Address:jess.SerializablePD>)) > > > (slot OBJECT (type 2048)))" > > > > > > The corresponding class: > > > class Have implements Predicate > > > { > > > PhysicalObject possession; > > > HumanBeing owner; > > > Class possessionType; > > > Class ownerType; > > > } > > > > > > (The setPossession and setOwner methods of this class update the > > > corresponding types by calling > > setPossessionType(possession.getClass()) and > > > setOwnerType(owner.getClass()) respectively) > > > > > > Now when I try to perform the trick: > > > > > > (defrule test-rule > > > (have (possessionType (class (call Class forName "Pencil")))) > > > => > > > (printout t "I have a pencil" crlf) > > > ) > > > > > > I receive the error message "Bad slot value". > > > > > > When I try: > > > (have (possessionType (call Class forName "Pencil"))) > > > > > > the same error shows up, and: > > > (have (possessionType ?pt&=(call Class forName "Pencil"))) > > > > > > results in "Can't use funcalls in backchained patterns MAIN::have" > > > > > > Any ideas would be greatly appreciated. > > > > > > Sander > > > > > > > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] > > > > [mailto:[EMAIL PROTECTED]]On > > > > Behalf Of [EMAIL PROTECTED] > > > > Sent: dinsdag 19 maart 2002 20:11 > > > > To: [EMAIL PROTECTED] > > > > Subject: Re: JESS: Backward chaining definstance facts > > > > > > <cut> > > > > > > > OK, anyway, the trick is to use > > > > > > > > (have (possession-type (class (call Class forName > > > > "package.pencil")))) > > > > > > > > where you've got "(have (possession ?pencil <of type pencil>))" > > > > below. Then the need-have fact should have the posession-type slot > > > > filled in with the appropriate class object, which you can use to > > > > synthesize the "pencil" object and "have" fact. > > > > > > <cut> > > > > > > > > > -------------------------------------------------------------------- > > > To unsubscribe, send the words 'unsubscribe jess-users > > [EMAIL PROTECTED]' > > > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > > > (use your own address!) List problems? Notify > > [EMAIL PROTECTED] > > > -------------------------------------------------------------------- > > > > > > > > > > > --------------------------------------------------------- > > Ernest Friedman-Hill > > Distributed Systems Research Phone: (925) 294-2154 > > Sandia National Labs FAX: (925) 294-2234 > > Org. 8920, MS 9012 [EMAIL PROTECTED] > > PO Box 969 http://herzberg.ca.sandia.gov > > Livermore, CA 94550 > > > > -------------------------------------------------------------------- > > To unsubscribe, send the words 'unsubscribe jess-users > > [EMAIL PROTECTED]' > > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > > (use your own address!) List problems? Notify > > [EMAIL PROTECTED] > > -------------------------------------------------------------------- > > > > > > > -------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] > -------------------------------------------------------------------- > --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
