Can I use like this
fromArrayList<Product> in rule file
p:Product(productType=="some")
If I use like above ,what will be the result.
Thanks
Prasad Raju Sagi
Mobile: 847-644-4103
________________________________
From: prasad raju sagi <prasadrajusagi(a)yahoo.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Wednesday, June 10, 2009 3:59:54 PM
Subject: Re: [rules-users] inserting fact as arraylist in orkingmemory / session
Hi ,
I am trying to insert fact as arraylist and then i wanted to get the objects from the
arraylist based on some condition.
like Arryalist<Product> fact was inserted into working memory, I want to get
some product from the arrylist based on condition ( productType==??).
Is there any solution for this .
Thanks
Prasad Raju Sagi
Mobile: 847-644-4103
________________________________
From: Greg Barton <greg_barton(a)yahoo.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Wednesday, June 10, 2009 3:25:39 PM
Subject: RE: [rules-users] Constaint evaluation
Correct. When there are no more instantiations (a rule plus a set of objects that match
the rule's conditions) on the agenda, then rule firing ceases. With version 5 of
drools they added the ability to keep the session ready and available to react even when
there are no instantiations on the agenda, but you must make a separate method call to do
that. (StatefulSession.fireUntilHalt() instead of fireAllRules())
--- On Wed, 6/10/09, Malenfant, Andre <andre.malenfant(a)cgi.com> wrote:
From: Malenfant, Andre <andre.malenfant(a)cgi.com>
Subject: RE: [rules-users] Constaint evaluation
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Date: Wednesday, June 10, 2009, 2:55 PM
Ok, so now I understand that the
"immutable" is really a concept but not necessarily
"enforced". So, the rule conditions get evaluated each time
the working memory is updated (and not globals) and rules
for which the conditions are true at each evaluation will
fire. The execution of the rules will end when there is no
more rules for which the conditions are true. Am I correct?
Thanks
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of Greg Barton
Sent: Wednesday, June 10, 2009 3:49 PM
To: Rules Users List
Subject: RE: [rules-users] Constaint evaluation
The ideas is that objects in working memory are those that
meant to be tracked: their changes are made visible to the
rules via the insert/update/retract methods. A global
is not in working memory, so it's changes cannot be
tracked. You can change the contents of a global all
day long and the rules would never be notified.
It's a similar concept to threads and
synchronization. You can have unsynchronized access to
member variables in a class when in a multithreaded
environment, but the results are unpredictable.
Likewise, you can use globals in conditions, and change the
value of the global as you go, but the results are
unpredictable.
--- On Wed, 6/10/09, Malenfant, Andre <andre.malenfant(a)cgi.com>
wrote:
> From: Malenfant, Andre <andre.malenfant(a)cgi.com>
> Subject: RE: [rules-users] Constaint evaluation
> To: "Kris Verlaenen" <Kris.Verlaenen(a)cs.kuleuven.be>
> Cc: "Rules Users List" <rules-users(a)lists.jboss.org>
> Date: Wednesday, June 10, 2009, 2:20 PM
> Thanks Kris,
>
> I will try with code constraints.
>
> But on the globals subject, I read in the
documentation
> that one should not use a global in a rule. I have
trouble
> understanding why. I don't think drools clones the
global
> object (might not be possible anyway). If my rule
> consequences change the state of a global (this usage
is
> considered valid as per the documentation as well)
then what
> is the harm of using it in a condition? I could
understand
> with immutable objects like String but...
>
> I can change my code to insert that global in the
working
> memory but I would like to understand why I should do
so...
> And if I do and the state of that object is changed by
a
> consequence of my rules, I have to call update? For
the same
> reason? I guess I am trying to understand the
underlying
> mechanism.
>
> Thanks
>
>
> -----Original Message-----
> From: Kris Verlaenen [mailto:Kris.Verlaenen@cs.kuleuven.be]
>
> Sent: Wednesday, June 10, 2009 11:38 AM
> To: Rules Users List; Malenfant, Andre
> Cc: Rules Users List
> Subject: Re: [rules-users] Constaint evaluation
>
> It depends on what type of constraint you are using.
>
> If you are using a rule constraint, that constraint
will be
> evaluated
> just the same as normal rules. This means that the
> constraints are
> evaluated when data is inserted / updated /
removed.
> Note that, if you
> want to make sure the engine is using up-to-date
> information, you must
> notify the engine (using update) when you change the
data
> in the working
> memory. Also note that globals are considered
> immutable. You should
> never write rules that depend on the state of a global
and
> where the
> global can be changed.
>
> If you are using code constraints, the constraint is
> evaluated at the
> point the code constraint is reached.
>
> Kris
>
> Quoting "Malenfant, Andre" <andre.malenfant(a)cgi.com>:
>
> > I have some trouble understanding how conditions
and
> constraints are
> > evaluated:
> >
> > I have a rule flow split node with constraints on
a
> global object.
> > The split node always takes the same path like if
the
> constraints are
> > evaluated at the beginning of the execution of
the
> process and not
> > when the process flow reaches that split node.
What I
> would expect is
> > that the split node constraints takes into
account the
> state of the
> > global object as modified by previous rules in
the
> flow.
> >
> > Am I right to think that rules conditions and
split
> nodes constraints
> > are evaluated only when inserting/updating
objects in
> the working
> > memory? The documentation is not really useful
(unless
> I haven't
> > found the appropriate one).
> >
> > Thanks
> >
> > André
> >
> > -----Original Message-----
> > From: rules-users-bounces(a)lists.jboss.org
> > [mailto:rules-users-bounces@lists.jboss.org]
> On Behalf Of Malenfant,
> > Andre
> > Sent: Wednesday, June 10, 2009 11:07 AM
> > To: Kris Verlaenen
> > Cc: Rules Users List
> > Subject: RE: [rules-users] Globals in ruleflow
> >
> > Thanks for trying this for me...
> >
> > As it turns out, while I was creating a test
sample
> for you I
> > realized
> > that my ruleflow was not loading properly and I
forgot
> to check for
> > errors on the builder. Now it works.
> >
> > Still, the behavior is strange. If my rule
doesn't
> load and even
> > though
> > my DRL loaded, my globals were not available.
Since
> the DRL declared
> > the
> > same globals it should not have given me that
error.
> >
> > Thanks
> >
> > -----Original Message-----
> > From: Kris Verlaenen [mailto:Kris.Verlaenen@cs.kuleuven.be]
>
> > Sent: Tuesday, June 09, 2009 5:51 PM
> > To: Rules Users List; Malenfant, Andre
> > Cc: Rules Users List
> > Subject: Re: [rules-users] Globals in ruleflow
> >
> > Andre,
> >
> > There should be no problem in using the same
global in
> both your
> > rules
> > and processes.
> >
> > I have tried a simple example as you described
but
> have not been able
> > to
> > reproduce the problem. Could you send me a
> self-contained example
> > that
> > shows the issue?
> >
> > Kris
> >
> > Quoting "Malenfant, Andre" <andre.malenfant(a)cgi.com>:
> >
> > > I am experimenting with rule flows and I get
the
> following error:
> > >
> > > Unexpected global [myglobal]
> > >
> > > When calling setGlobal on the session.
> > >
> > > This code works without the workflow
(globals
> declared in the drl)
> > > but
> > > fails when I include the rule flow. I
declared
> the same globals in
> > > the
> > > rule flow in the header section.
> > >
> > >
_______________________________________________
> > > rules-users mailing list
> > > rules-users(a)lists.jboss.org
> > >
https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> >
> >
> >
> >
> > Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/rules-users
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
>
>
> Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org