I tried to have two definstance calls on the same Java class.  Specifically,

(defclass market Market)
(defclass agent TradingAgent)
(defclass producer TradingAgent)

Instances of class Market have two public members: agentsList and producersList where the latter is a subset of the former.

These are then instantiated in two rules:

   (defrule agents
       (market (agentsList $?alist))
       =>
       (foreach ?a ?alist (definstance agent ?a static)))

and

   (defrule producers
       (market (producersList $?pList))
       =>
       (foreach ?p ?pList (definstance producer ?p static)))

In testing these rules, there were 10 TradingAgents in agentsList, of which three were also in producersList.

If the defrules are ordered as above, then no shadow facts are created for producer. If the producers rule is defined first, then three producers shadowfacts are created followed by seven agents shadow facts.

Is it the case that there cannot be two points to a single Java object? Is that the reason or is there some other reason why the ordering of the defrules determines the result?

This is probably a silly thing to do and work-arounds are easy to devise. On the other hand, is it a good idea for the order in which defrule is called to determine the outcome?

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