Is it possible to Iteriate over a list of string values ?
by groovenarula
Hello all,
In one of my use cases, I need to insert a variable collections of facts
into working memory in order to be able to test for those values later :
So I was wondering if there's a way to do something like this
when
$vals : String() from [ "A 12345", "B 45678", "C 8695" ]
then
insert ( new Fact ( $vals ) );
With the intention that the rule will fire 3 times and insert the 3 new
facts with the values " A 12345" and "B 45678" and "C 8695".
Is this possible using rules or do I have to resort to using functions. The
problem I'm trying to overcome is to see if there's a way to get the "A
12345", "B 45678", "C 8695" from a single cell of a spreadsheet.
Thanks in advance,
G
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Ite...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
New to Drools. Is it possible to test inverse conditions?
by Manuel Ortiz
- Dear all:
My name is Manuel Ortiz, a very beginner in Drools, and have a question
related to Multi Restriction on Condition Elements.
In
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/ht...,
it can be found the following example:
*Example 4.52. Multi Restriction*
// Simple multi restriction using a single &&
Person( age > 30 && < 40 )
// Complex multi restriction using groupings of multi restrictions
Person( age ( (> 30 && < 40) ||
(> 20 && < 25) ) )
// Mixing muti restrictions with constraint connectives
Person( age > 30 && < 40 || location == "london" )
I need to test a multi restriction in a rule and the opposite restriction in
another. The multi restriction will be given by the user, and the
application will build rules which test both the original restriction and
the opposite. I would like to know if it is possible to write a Drools rule
which evals the opposite conditions based on the original, something like
Person( !(age > 30 && < 40) )
or I have to rebuild the multi restriction, something like
Person( age <= 30 || >= 40 )
Thank you in advance for your time.
Kind regards,
Manuel Ortiz
13 years, 9 months
maven-drools-plugin, anyone?
by Ansgar Konermann
Hi,
I prepared a tiny drools compiler plugin for Maven 3. It currently
contains the smallest feature-set which is potentially useful for my
colleagues at work, so up to now it's no more than a starting point for
my team. Nevertheless, I invite you to take a look at it, comment on it
and suggest features _you_ would like to see in the plugin in one of its
future releases.
There's some inital documentation here:
http://passion.forco.de/content/maven-drools-plugin
Looking forward to your comments.
Best regards
Ansgar
13 years, 9 months
join gateway
by Salina Fung/UFL - ICIL
Please give me some example to illustrate the difference between
'XOR', 'Discriminator', 'n of m'?
And my understanding of 'And' should be waiting for ALL incoming branches are completed
before move to the next node, is it correct? So, if I have 2 incoming branches are
from 2 human task, and the out-going branch is to an END node, if only one human
task is finished, the process will not be ended, until the second one is completed by user.
Is it correct?
Thanks
Salina
13 years, 9 months
Need Help writing then part in DSLR
by Saleem Lakhani
Hi,
This is what used to work in Drools 3: Sample from DSL:
[then]A validation error has occurred=ValErrTO valErrTO = new
ValErrTO(); java.util.HashMap variableMap = new java.util.HashMap();
[then]- The standard error level is "{standard_error_level}"=int
stdErrLevel={standard_error_level}; valErrTO.setErrorCode(stdErrLevel);
With Drools 5.2.1 it gives me the following error:
No modify was found to add the modifier to: - The standard error level
is "400"
How do I write the above 2 statements again in Drools 5.2.1, NOTE: I
need to write this in DSL.
Sample DSLR:
rule "Your First Rule"
when
There is a Coverage with
then
#actions
A validation error has occurred
- The standard error level is "400"
end
Thanks,
saleem
13 years, 9 months
New Questions about drools
by Carlos Santiago Moreno
Hi There! I have been reading some more about Drools, Guvnor, and JBPM5, and
I have a few new doubts, that I couldn't get solved from the documentation I
read. And here they are:
1) When rules are entered through the UI are they immediately added to the
rule base?
2) Does the edit UI require code to define new entities and associated
metadata?
3) What would our interface look like if we called it as a service for only
rule evaluation?
4) What is the rule scoping mechanism. That is, how do I say "evaluate this
set of information against
ruleset Q"?
5) I'm concerned about the "then" clause. It looks like it is always code.
If our "then" always consists of
assignments to some set of variables or parameters, what does the person
writing rules see?
6) Can I define a new workflow and connect it into some dispatcher for
invokation without writing any code and without stopping or upgrading the
app?
Thanks for your help.
Carlos S. Moreno
13 years, 9 months
not sure if this is a bug of drools or my bad usage...
by Simon Chen
Hi all,
An interesting finding:
I have three simple rules:
rule "A2B"
when
A()
then
insertLogical(new B());
end
rule "B2C"
when
B()
then
insertLogical(new C());
end
rule "C2B"
when
C()
then
insertLogical(new B());
end
Basically, once we have an A(), we'll logically insert a B(). Once we
have a B(), we'll logically insert a C(). Once we have a C(), we'll
logically insert a B().
So, I first insert an A(), print all the objects. Retract A(), and
print all the objects. Here's what I got:
com.sample.B@42
com.sample.C@43
com.sample.A@548997d1
after retract!
com.sample.B@42
com.sample.C@43
So, B() and C(), which should be logically depend on A(), somehow are
not retracted. The problem I see is the truth maintenance system allow
B() and C() to depend on each other, thus not affected by losing A().
Is this a bug or my bad usage?
Thanks.
-Simon
13 years, 9 months
Process instance status not completing when using JPA.
by Dan Nathanson
Hi,
I'm seeing some odd behavior in Drools Flow 5.1.1. When using JPA and
creating a StatefulKnowledgeSession using
JPAKnowledgeService.newStatefulKnowledgeSession(), processes look like they
run to completion, but calling RuleFlowProcessInstance.getState() on process
instances created froim this knowledge session returns 1 (STATE_ACTIVE).
Calling getActiveNodeIds() throws a NullPointerException.
If I get a StatefulKnowledgeSession without JPA by calling
KnowledgeBase.newStatefulKnowledgeSession(), getState() returns 2
(STATE_COMPLETED).
I added KnowledgeRuntimeLoggerFactory.newConsoleLogger(knowledgeSession) and
can see in both cases that the process is complete.
Has this been seen before? Is it a known bug? Am I doing something wrong?
Regards,
Dan Nathanson
13 years, 9 months
Best approach for handling parallel requests for a stateful rules session
by jkrupka
We've been over multiple ways of handling multiple parallel requests for a
stateful rules session and I want to make sure the approach we have settled
on makes sense.
We will be getting multiple requests at a time to run some score calculation
rules for various products. In the past we used stateless rules sessions to
do this and it worked fine. In the newer version of our application we are
using significantly more data to do our calculation and are pretty sure
stateful is the way to go. That being said, can we use the same session in
multiple threads? Based on our understanding, a session isn't inherently
thread safe, so we are thinking we will need to do one of two things:
1. Synchronize all updates to facts and the calling of fireAllRules so that
only one thread is doing this at a time. Is this the best (or only safe)
approach in this situation? Since all fact updates and rules running in
done in one thread, when is throughput a concern (obviously depends on
hardware, # of rules, # of facts, etc)?
2. Ensure that only one thread updates the facts related to a given product
at a time. Multiple threads could still call fireAllRules at the same time,
but after the rules finish, the calling class would grab the facts that
would have been updated for just the product that it's interested in. That
way, it doesn't matter if the rules were technically matched in a different
thread, as long as I'm grabbing just the data I'm interested in. Is this a
safe approach? Does it end up offering more throughput capability than
approach #1?
Josh
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Best-approach-for-han...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months