As I understand, the main difference between assert and deffacts is really
that when a (reset) is issued, the asserts are erased but the deffacts are
"re-asserted". In the documentation it is a bit confusing because the first
part of the paragraph implies that the main difference is that deffacts
allows you to do several asserts in "one go" and the (reset) issues is
presented as a "secondary side effect".

Speaking of (reset) my assumption is that in the context of an application
server handling several users on a single Rete engine, it is better to avoid
doing a (reset). Indeed, it is difficult to know in what state each user is.

The second assumption is that in what we call a "request-response loop" in
WebObjects, the best is to issue a (run) command each time. Therefore, when
selecting a command from the UI for example, first all submited data from a
HTTP/POST will be set in variables or Jess assert statements, then a
function will be called to perform some calculation and just before
generating the response, the (run) command will be issued to "calculate" the
new state... The only risk in that situation is that if another user is also
in the middle of a request-response loop AND the app is multi-threaded, then
there might be a (run) command issued randomly (at least seen from user 1).
Therefore the solutions are:
1. Have Jess handle the notion of transaction (like in a relational
database, before the commit, nothing is seen outside the scope of the user
session)
2. Do not allow multithreading multiple users requests
3. Only have rules with a LHS identifying a user session to avoid side
effects.

What I understand is that (1) is very complicated and Jess does not handle
it (correct?), (2) is possible during development and for simple tasks, (3)
is what I am trying to achieve.

Obviously some rules and asserts are not session dependent and therefore do
not cause any trouble if they change globally (it is knowledge base after
all).

Thanks for reading... Still getting into the shift of mind needed to go from
procedural programming to rule based (data driven).

Alex
-- 
Alexander Lamb 
Groupe Serveurs Applicatifs
Division d'Informatique Midicale
Htpitaux Universitaires de Genhve
21 rue Micheli-du-Crest
CH-1211 Genhve 4 / Switzerland
Tel: +41-22 372.48.46 Fax: +41-22 372.61.98
[EMAIL PROTECTED] / http://www.hcuge.ch

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to