Hello list!
I have a question concerning something like "persistent facts"...
I deal with problems where I have to reason about states (stored persistently in relational databases) and events (e.g. insert, update, and delete events in a database). I can subscribe to the events and then actively assert a corresponding "event fact". The question is how to efficiently deal with "state facts" corresponding to relational tuples.
A relation corresponds to a JESS template defining an unordered fact:
(deftemplate <relation-name>
(slot <column-1> ...)
...
(slot <column-n> ...)
)
Each tuple corresponds to one fact, e.g.:
(<relation-name> (<column-1> <val-1>) ... (<column-n> <val-n>)).
How can I use these "state facts" in JESS rules
- elegantly (yes, I do like "beautiful" code ;-))
- in a uniform fashion (rendering itself to generation mechanisms)
- on-demand (without prior "bulk assertion")
It would be nice to be able to write a rule like the following:
(defrule myrule
(some-triggering-event (key ?val) ...)
(<relation-name> (key ?val) (<column-1> <val-1>) ... (<column-n> <val-n>))
=>
(assert (some-other-fact (key ?val) (<column-1> <val-1>) ... (column-n> <val-n>)))
)
What would be the best way to solve this problem? I think a good solution could be of very general use...
Greetings
Thomas Barnekow
________________________________
Dipl.-Inform. Thomas Barnekow
Fraunhofer IAO, Competence Center Software Technology
mail: | Nobelstraße 12, D-70569 Stuttgart, Germany |
phone: | +49 (0) 711 / 970 - 2346 |
fax: | +49 (0) 711 / 970 - 2300 |
email: | [EMAIL PROTECTED] |
web: | http://www.swt.iao.fhg.de |