5.3.0: combination of KnowledgeAgent and declare broken
by Wolfgang Laun
5.3.0 Final
Using a KnowledgeAgent to build a KnowledgeBase containing a DRL with the
declaration of a new type may result in some rules not firing at all.
The very same code compiled via KnowledgeBuilder API works perfectly
correct.
-W
14 years, 1 month
Truth maintenance and RHS variables
by Juanker Atina
Hi there,
I'm working on a rule that will alert me when there is no events from the
sensors for a while.
So, first idea was to use time window and matches in condition side, to
match all types of sensors, and then to print that something is wrong.
rule "Alert if there is no activity"
when
not StateEvent(itemName matches "door.*|presence.*|luminosity.*") over
window:time( 1m ) from entry-point "EventStream"
then
System.out.println("Alert: one sensor is not working");
end
First change was to add a timer, as truth maintenance will fire this rule
the first time, but not forever. So i add a timer to fire the rule every 20
seconds, for example.
rule "Alert if there is no activity"
timer (cron:0/20 * * * * ?)
when
not StateEvent(itemName matches "door.*|presence.*|luminosity.*") over
window:time( 1m ) from entry-point "EventStream"
then
System.out.println("Alert: one sensor is not working");
end
The second thing i want to achieve is to print what specific sensor is not
working, but i understand that as there is no StateEvent, i can't declare a
variable, for example.
rule "Alert if there is no activity"
timer (cron:0/20 * * * * ?)
when
not $event: StateEvent(itemName matches
"door.*|presence.*|luminosity.*") over window:time( 1m ) from entry-point
"EventStream"
then
System.out.println("Alert: one sensor is not working: " +
$event.getItemName());
So, do you know how can i know which sensor is not working? must i rewrite
the rule to achieve this? is this possible?
Thanks for your help.
end
14 years, 1 month
problem binding variable to map value
by Ming Fang
Below is a very simple rule that binds a variable to a map value...
rule "how many times is map.get() called?"
when
p:Parameter(
$value:tags[1]==1,
$value == 1,
$value != 2,
$value != null,
$value in ("1","2")
)
then
System.out.println("value=" + $value);
end
The problem is map.get() is called 6 times when executing this rule using a Stateless session.
To test this I implement a mock Map that the get(key) simply returns the key.
So in this example tags[1] return 1.
And in the get() I simply print a test message to see how many times it's been called.
Here is the sequence...
1x = tags[1]
2x = tags[1] == 1
3x = $value == 1
4x = $value != 2
5x = $value != null
and most surprisingly none for $value in ("1","2")
but
6x == System.out.println("value="+$value)
Is this a bug?
It's a huge problem for my application since the call to get() is expensive for my map implementation.
Thanks
--ming
14 years, 1 month
GUVNOR
by Olfa h
HI ,
how to install DROOLS Guvnor ?
14 years, 1 month
Ruleflow: two flow exits (or equivalent?) from reusable sub-process?
by George Georgovassilis
Hello list,
I modeled (v5.3) a reusable sub-process which can either finish in a
desired state (i.e. validations ok) or an undesired state (some validations
failed and I need to route to a different flow). Ideally the sub-process
would allow for two outgoing connections, but as far as I see that is
currently not possible. Can anybody advise on how to achieve a similar
functionality?
Is there a chance I could build a workitem that extends the reusable
sub-process but allows for two exit connections, and if yes, how?
Can signals or fault nodes achieve a similar effect and if yes, then how?
Thanks in advance,
G.
14 years, 1 month
Low Date question in drools
by Nancy Henggeler
I have a simple rule where I want to bypass elements that have a low date but
drools seems to be interpreting the date different then I am expecting.
Drools statement and error follows:
ClientSupplement ( dateOfBirth : dateOfBirth != null && != 0001-01-01)
throws error -- Error: [Error: badly formatted number: For input string:
"001-01-01"] [Near : {... 0001-01-01 ....}] ^ [Line: 1, Column: 1]
How do I get drools to understand this low date? I have tried single,
double, and no quotes around the low date and all result in a similiar error
message. Please Help!
--
View this message in context: http://drools.46999.n3.nabble.com/Low-Date-question-in-drools-tp3729940p3...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month
Protection from malicious rules
by Shur, Bob
We're considering a system in which partners could write and deploy their own rules, but we are worried about security. Is there any support for preventing harmful rules? For example:
rule "bad"
when
then
File f = new File("important.doc");
f.delete();
end
14 years, 1 month
Rule does not fire when JBPM asks to do so in BPMN 2.0 process
by argaldo
Hi,
We're running an application that uses Drools + JBPM 5 + Drools
integration our set-up can be seen as:
Some rule fires and creates a JBPM process ( a fact gets inserted into
drools using "kcontext.getKnowledgeRuntime().startProcess()" ), after a few
nodes processed, the JBPM engine arrives to a node of type
"businessRuleTask" which in turn tells drools to evaluate a group of rules (
which at the moment consists on only one rule ).
Well, the problem is that what we see is that everything runs ok before
the businessRuleTask and at the moment when the rule group would be
evaluated we could see that in drools the rule gets created, activated, but
never fired.
We did some debug and realized that the reason the rule group never got
fired is because this check in RuleFlowGroupImpl.java ( method
setActive(boolean) ):
if ( this.list.isEmpty() ) {
if ( this.autoDeactivate ) {
// if the list of activations is empty and
// auto-deactivate is on, deactivate this group
WorkingMemoryAction action = new DeactivateCallback(
this );
this.workingMemory.queueWorkingMemoryAction( action );
}
}
The problem is that at the moment when drools calls setActive() and
performs the check, this.list is in fact empty and autoDeactivate is true by
default ). Then drools enqueues a deactivation task afterwords, which
deactivates the rule *before* even firing it.
From now on, things get a little weirder, every subsequent invocation of
the method setActive ( in response of bussinessRuleTask from our bussiness
process ) runs ok as that list now is not empty ( has one rule ).
Seems a race condition to me, but,..., Is there any way to deactivate
autodeactivation by default? Are we doing something wrong? Bug report?
Greets,
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month
Re: [rules-users] How do I write a rule to detect a missing value in a group of facts?
by GPatel@tsys.com
Beautiful!
How would a business user (non-programmer) write such a rule. The only way I can think of is create a dsl sentence for this specific condition
----- Original Message -----
From: Wolfgang Laun [wolfgang.laun(a)gmail.com]
Sent: 02/09/2012 05:02 PM CET
To: Rules Users List <rules-users(a)lists.jboss.org>
Subject: Re: [rules-users] How do I write a rule to detect a missing value in a group of facts?
Don't think procedurally, just write the *rule* for a missing post ;-)
rule "missing fence post"
when
FencePost( $d: distanceFromStart )
FencePost( distanceFromStart == $d + 2*FencePost.GAP )
not FencePost( distanceFromStart == $d + FencePost.GAP )
then
System.out.println( "Missing: " + ($d + FencePost.GAP) );
end
-W
On 9 February 2012 16:41, mikeg <mike(a)thegoldners.com> wrote:
> I need to write a rule to identify a missing element in a group of facts.
>
> For example, let us say I want to ensure that my fence has a fence post
> every 8 feet. My fact declaration is as follows:
>
> declare FencePost
> identifier : String
> distanceFromStart: Long
> end
>
> If I add the following facts into my session:
>
> FencePost("a", 0)
> FencePost("x", 8)
> FencePost("e", 24)
>
> I want a rule that will notify the user that there is a missing fence post
> between "x" and "e".
>
> I've been looking into using "collect" into a TreeSet/TreeMap to get a
> collection sorted on the "distanceFromStart", but I cannot figure out how
> to
> compare adjacent elements in the collection.
>
> Any ideas?
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-do-I-write-a-rule-to-detect-a-missi...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
14 years, 1 month