JESS: Defrule bind get-member crashes: Bad slot value at token '('.
"Jevon Wright" <[email protected]> Fri, 4 Mar 2011 20:18:53 +1300
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <998_1299241430_p24CLOI8002216_AANLkTimsRRUbzsxdCPSo10pn_=2-yzbQ2qskr9uUhoUZ@mail.gmail.com> |
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 [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------