On 15 August 2010 14:09, Donald Winston <satchwins...@yahoo.com> wrote:

> Ok, that works. Thanks. It didn't make sense to me that I couldn't do this.
> I remember reading in the book "Jess in Action" (page 55) where it said eval
> and build were synonyms and (build ...) was used for constructs and eval for
> functions out of convention/tradition/historical reasons and not because
> they did things differently. It is an old book even though I bought it
> recently. Maybe things have changed since it was written.
>

Jess did change since that book was written. As with any SW product, go with
the doc that comes with it. The "reference" part is satisfactory.

In addition or maybe in place of data structures like maps, lists, and sets
> I'd like to load a jdom Document object into the rule engine and have the
> rules do their thing and read and write to it. That's why I want to be able
> to create assertions from a data structure and not a bean.
>
> For XML content into and out of WM, I've frequently used JAXB generated
Java classes. I've found this a satisfying, stable approach, with a small
footprint due to changes in the data. (Caveat: the XML structure should be
"reasonable".)

It looks like the add, addAll, and getObjects methods just load and retrieve
> java objects(beans) that are used for "shadow facts". Is this true?

Yes.


> So I'll be just using store and fetch because this seems to be the only way
> to get non shadow fact objects in and out of the rule base.


No: it is (assert) and (retract). The functions (fetch) and (store) are for
non-WM objects, in a (kind of) global Map provided for the CLIPS interface.


> The rules won't be doing anything else but reading and writing from and to
> the stored Document data structure and updating the fact base. No querying
> or updating databases, reading or writing files, reading and writing from
> sockets, sending e-mails, or spawning threads, i.e. no side effects. These
> things will be done outside the rule engine based on the info from the
> updated Document object.
>

Truth be told, I've never done much work in the marshalling direction, i.e.,
from WM to a DOM tree. But, here again, I'd investigate the option of
building an Object tree (with shadow facts) and use JAXB's marshalling for
serializing to XML.

-W


> On Aug 14, 2010, at 2:50 AM, Wolfgang Laun wrote:
>
> > (eval (str-cat "(assert (" ?key " " ((fetch request-parameter-map) get
> ?key) "))" ) )
>
>
>
>
>
> --------------------------------------------------------------------
> 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.
> --------------------------------------------------------------------
>
>

Reply via email to