[re: 5.0a6]
Hi,
I'm a Jess newbie. I'm trying to convert a rulebase
from Sicstus Prolog into Jess, and am having some trouble
converting nested lists into a form which Jess can handle.
I'd like to be able to define lists of lists and have
rules which subsequently explode those lists into facts,
which is what the original application does, but 'foreach'
doesn't seem willing to return a multislot value; instead,
it's flattening my two-dimensional lists into one dimension.
;;; minimal code fragment to illustrate the problem:
(deftemplate FRAME
"(Frame, Relations) knowledge definition tuple"
(slot frame)
(multislot relations)
)
(deftemplate FRAME_RELATION
"(Frame, Relation) knowledge definition tuple"
(slot frame)
(multislot relation)
)
(defrule DecomposeFrame
"Convert a frame definition into multiple asserted relations"
(FRAME (frame ?concept) (relations ?rel))
=>
(foreach ?relation ?rel (assert (FRAME_RELATION (frame ?concept) (relation
?relation))))
)
(deffacts test_facts "Documentation comment"
(FRAME
(frame body_part)
(relations
(create$
(create$ isa organic_thing)
(create$ children wing head body arm leg tail beak eye foot))))
)
;;; end code fragment
When I run this, I expect DecomposeFrame to fire and assert two
new FRAME_RELATION facts (which would then fire additional rules
which are not yet implemented). Instead, 12 FRAME_RELATIONs are
generated, each with an atom in the relation slot instead of the
multislot I want (and expect) in there. Is this the correct
behavior for Jess?
I assume I can do a workaround by making a list of strings and
exploding them as needed, but that seems like a real kludge.
Am I missing something basic here?
[I'll be away from email for about a week, but I wanted to mail
this while it was fresh in my mind.]
--
Carl Burke
[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]
---------------------------------------------------------------------