Hi Jevon,

Read number 17 in our FAQ: http://www.jessrules.com/jess/FAQ.shtml#Q17

The right way to write your final rule might be something like this, depending on what kind of facts these are:

(defrule debug-four
        (BooleanPropertyImpl (OBJECT ?property))
        (PageImpl (OBJECT ?container))
        (test (progn
                (bind ?children (get-member ?container children)))
                (member$ ?property ?children)))
        =>
        ((System.out) println "...")
)


On Mar 4, 2011, at 2:18 AM, Jevon Wright wrote:

Hi all,

I am trying to write a Jess rule program to perform inference on an
EMF-based model instance. I can successfully load all of the model
elements into Jess, and check that these facts all exist:

(defrule debug-one
        ?property <- (BooleanPropertyImpl)
        =>
        ((System.out) println "Found property:")
        ((System.out) println ?property)
)

This rule works fine, and all of the BooleanPropertyImpl in the model
are found successfully. But I am having trouble with accessing members
of the elements, using either get-member, or call, or bind.

(defrule debug-three
        ?container <- (BooleanPropertyImpl)
        (bind ?name (get-member ?container name))
        =>
        ((System.out) println "Found name:")
        ((System.out) println ?name)
)

I expect this to bind object.getName() to ?name, but instead the parse fails:

Jess reported an error in routine Jesp.parsePattern.
 Message: Bad slot value at token '('.
 Program text: ( defrule debug-three ?container <- (
BooleanPropertyImpl ) ( bind ?name (  at line 44 in file
rules/jess-test.clp.
        at jess.Jesp.error(Unknown Source)

What does this mean? Is this a syntax error? Is this an error with my
Java objects? Am I missing a runtime library? Should I be importing
other packages? I can't think of any other way to approach this
problem.

The reason I am using get-member is that I was trying to see if an
elements' List contains another element:

(defrule debug-four
        ?property <- (BooleanPropertyImpl)
        ?container <- (PageImpl)
        (bind ?children (get-member ?container children)))
        (member$ ?property ?children)
        =>
        ((System.out) println "...")
)

However, this also fails with the exception above. Any ideas or
suggestions would be most welcome. :)

Thanks
Jevon


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov .
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            ejfr...@sandia.gov
Livermore, CA 94550                             http://www.jessrules.com




Reply via email to