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]
--------------------------------------------------------------------

Reply via email to