Re: [rules-users] Help write rule drools

2014-06-04 Thread nill
Thank you very much!



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841p4029873.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help write rule drools

2014-06-04 Thread Wolfgang Laun
To remove all redundant Link objects and assuming that class Link is declared as
   class Link {
 Node source;
 Node target;
   }
(and not as given in the original post), the rule:

rule "kill redundant links"
when
$l1: Link( $s: source, $t: target )
$l2: Link( this != $l1,
   source == $s && target == $t
   ||
   source == $t && target == $s )
$n1: Node( out contains $l2 )
$n2: Node( in contains $l2 )
then
retract( $l2 );
modify( $n1 ){ getOut().remove( $l2 ) }
modify( $n2 ){ getIn().remove( $l2 ) }
end

removes all redundant Link facts and updates the out and in fields of
the Nodes at either end of these links.

-W


On 04/06/2014, nill  wrote:
> I try to explain. I have a graph where each node can have only one
> connection
> to the other.
> If I check the presence of n links between two nodes then delete n-1
> connections.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841p4029869.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help write rule drools

2014-06-04 Thread nill
I try to explain. I have a graph where each node can have only one connection
to the other. 
If I check the presence of n links between two nodes then delete n-1
connections.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841p4029869.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help write rule drools

2014-06-04 Thread Wolfgang Laun
On 04/06/2014, nill  wrote:
> One for each pair of connected nodes.

One what? Where? With what content?
-W


>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841p4029848.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help write rule drools

2014-06-04 Thread nill
One for each pair of connected nodes. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841p4029848.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help write rule drools

2014-06-04 Thread Wolfgang Laun
How do you want the result? Printed lines on standard output? One for
each pair of connected nodes, as you have shown it below "result"? Or
collected in another fact?

-W

On 4 June 2014 10:09, nill  wrote:
> My structure is composed of 2 classes (Node, Link)
> class Node {
> List  out;
> List  in;
> }
> class Link {
> Source node;
> Target node;
> }
>
> they are inserted as facts in working memory.
>
> I have to write a rule that will unite for each node joins the links that
> have the same destination, and if there is then the inverse must also join
> the latter.
>
> eg.
> A - link1 -> B
> A - link2 -> B
> A - link3 -> C
> C - link4 -> D
> B - link5 -> A
>
> result
> A - link1 + link2 +link5 -> B
> A - link3 -> C
> C - link4 -> D
>
> Can anyone help me?
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help write rule drools

2014-06-04 Thread nill
My structure is composed of 2 classes (Node, Link)
class Node {
List  out;
List  in;
}
class Link {
Source node;
Target node;
}

they are inserted as facts in working memory.

I have to write a rule that will unite for each node joins the links that
have the same destination, and if there is then the inverse must also join
the latter.

eg.
A - link1 -> B
A - link2 -> B
A - link3 -> C
C - link4 -> D
B - link5 -> A

result
A - link1 + link2 +link5 -> B
A - link3 -> C
C - link4 -> D

Can anyone help me?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-write-rule-drools-tp4029841.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with event not found over window query

2014-02-19 Thread daveor
On 18 Feb 2014, at 18:38, laune [via Drools] wrote:

[snip]
> 
> > 
> > I ran into trouble because my various rules (from my original email) 
> > wouldn't fire an alert as expected when I fed in simulated events. 
> > 
> > I'm curious as to why you think it's interesting that the four rules below 
> > fail to meet my expectation? I suppose it's the fact that I'm a drools 
> > newbie and the issue here is probably just my inexperience mapping business 
> > logic into drools rules. 
> 
> The word is "illuminative" rather than "interesting". Take this one: 
> 
> $e1: Event($location: properties["location"] && ...) 
> not Event(, this after $e1) 
> 
> The $e1 Event is here, Time is Now. It's most certainly true that 
> nothing is here after Now! - And the next one: 
> 
> $e1: Event($location: properties["location"] && ...) 
> not Event(, this after[0, 1m] $e1) 
> 
> Again, Event $e1 is here, Time is Now, and nothing is here after Now. 
> The operator does not instruct the Engine to wait! 
> 

Yes, I had imagined something like that was the case.

My original reasoning was the following; 

At the moment when the $e1 event arrives, time is Now and it is true that there 
is no second event. 
However, there is no way for the engine to know at Time=Now whether or not the 
second event is going to arrive within the required time period (this 
after[0,1m] $e1)
Surely, the engine needs to wait until (at least) Time=Now+1m before firing the 
rule, at least in the second case, because it is not possible to establish the 
truth or falsehood of the second criterion until 1m has past since the first 
event arrived because the second event might arrive, right?

Well, that's what I thought at least!

daveor



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129p4028190.html
Sent from the Drools: User forum mailing list archive at Nabble.com.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Help with event not found over window query

2014-02-18 Thread Wolfgang Laun
On 18/02/2014, daveor  wrote:
> Thanks for your email below. I needed to refactor my code somewhat to get
> this technique to work but it solved the problem that I had.

You're welcome. - That happens.

>
> I was previously using fireAllRules() but I refactored the code to use
> fireUntilHalt() instead, which required some additional work to make a
> couple of other supporting features behave properly. I know you don't
> strictly need to do this, but it needed to be done anyway and it made sense
> to do it now.
>

[snip]

> I would have thought it was quite a common scenario where someone wanted to
> implement business logic such as:
>
> - Something happens
> - It is expected that something else will happen within a certain time
> period of the first thing happening
> - If the second thing doesn't happen within the time period, generate an
> alert

Yes, it is, and you are in good company. - A thorough study of the
temporal operators or reading Hawking's A Short History of Time helps,
either one ;-)

>
> I ran into trouble because my various rules (from my original email)
> wouldn't fire an alert as expected when I fed in simulated events.
>
> I'm curious as to why you think it's interesting that the four rules below
> fail to meet my expectation? I suppose it's the fact that I'm a drools
> newbie and the issue here is probably just my inexperience mapping business
> logic into drools rules.

The word is "illuminative" rather than "interesting". Take this one:

$e1: Event($location: properties["location"] && ...)
not Event(, this after $e1)

The $e1 Event is here, Time is Now. It's most certainly true that
nothing is here after Now! - And the next one:

$e1: Event($location: properties["location"] && ...)
not Event(, this after[0, 1m] $e1)

Again, Event $e1 is here, Time is Now, and nothing is here after Now.
The operator does not instruct the Engine to wait!

Cheers
Wolfgang






>
> daveor
>
> On 15 Feb 2014, at 09:49, laune [via Drools] wrote:
>
>> It would be interesting to discuss why each of these four rules fails to
>> meet you expectation. Mostly it's due to the engine not evaluating
>> exactly one minute after the "certain event" arrives.
>>
>> The following rule fires 1 minute after the evaluation of the arrival
>> of an Event according to constraints and when no second Event
>> (according to constraints not shown) has arrived since then.
>>
>> rule "Something Else" dialect "mvel"
>> timer ( int: 1m )
>> when
>> $e1: Event($location: properties["location"] && ...)
>> not Event(..., this after $e1)
>> then
>>...
>> end
>>
>> -W
>>
>> On 14/02/2014, daveor <[hidden email]> wrote:
>>
>> > Hi there,
>> >
>> > I'm a drools newbie and I wonder if someone could help me. I'm using
>> > drools
>> > 6.0.1 and I'm trying to write a rule that fires when:
>> >
>> > 1) a certain event is seen and
>> > 2) a second event is not seen within a certain period of time (1 minute
>> > in
>> > the examples below) after the first event is seen
>> >
>> > I have tried the following LHS patterns:
>> >
>> > rule "Something" dialect "mvel"
>> > when
>> > $e1: Event($location: properties["location"] && ...)
>> > not Event(, this after $e1)
>> > then
>> > //do stuff
>> > end
>> >
>> > rule "Something" dialect "mvel"
>> > when
>> > $e1: Event($location: properties["location"] && ...)
>> > not Event(, this after[0, 1m] $e1)
>> > then
>> > //do stuff
>> > end
>> >
>> > rule "Something" dialect "mvel"
>> > when
>> > $e1: Event($location: properties["location"] && ...)
>> > List (size == 0) from collect (Event(..., this after $e1) over
>> > window:time(1m))
>> > then
>> > //do stuff
>> > end
>> >
>> >
>> > rule "Something" dialect "mvel"
>> > when
>> > $e1: Event($location: properties["location"] && ...)
>> > List (size == 0) from collect (Event(...) over window:time(1m))
>> > then
>> > //do stuff
>> > end
>> >
>> > The unwanted behaviours are as follows:
>> >
>> > In the first case, the rule fires immediately after the first event is
>> > inserted.
>> > In the second case, the rule fails to fire if the second event is seen
>> > (as
>> > expected) but the rule does not fire if the second event is not seen
>> > within
>> > 1 minute.
>> > In the third and fourth cases, the rule fires immediately after the
>> > first
>> > event is inserted.
>> >
>> > Event is a java class with a hash map of properties, defined with the
>> > following metadata:
>> >
>> > declare Event
>> > @role(event)
>> > end
>> >
>> > I would really appreciate if someone could help me out here.
>> >
>> > Thanks and let me know if you need any more info.
>> >
>> > Dave
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> > http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129.html
>> > Sent from the Drools: User forum mailing list archive at Nabble.com.
>> > ___
>> > rules-users mail

Re: [rules-users] Help with event not found over window query

2014-02-18 Thread daveor
Thanks for your email below. I needed to refactor my code somewhat to get this 
technique to work but it solved the problem that I had. 

I was previously using fireAllRules() but I refactored the code to use 
fireUntilHalt() instead, which required some additional work to make a couple 
of other supporting features behave properly. I know you don't strictly need to 
do this, but it needed to be done anyway and it made sense to do it now.

I would have thought it was quite a common scenario where someone wanted to 
implement business logic such as:

- Something happens
- It is expected that something else will happen within a certain time period 
of the first thing happening
- If the second thing doesn't happen within the time period, generate an alert

I ran into trouble because my various rules (from my original email) wouldn't 
fire an alert as expected when I fed in simulated events. 

I'm curious as to why you think it's interesting that the four rules below fail 
to meet my expectation? I suppose it's the fact that I'm a drools newbie and 
the issue here is probably just my inexperience mapping business logic into 
drools rules. 

daveor

On 15 Feb 2014, at 09:49, laune [via Drools] wrote:

> It would be interesting to discuss why each of these four rules fails to 
> meet you expectation. Mostly it's due to the engine not evaluating 
> exactly one minute after the "certain event" arrives. 
> 
> The following rule fires 1 minute after the evaluation of the arrival 
> of an Event according to constraints and when no second Event 
> (according to constraints not shown) has arrived since then. 
> 
> rule "Something Else" dialect "mvel" 
> timer ( int: 1m ) 
> when 
> $e1: Event($location: properties["location"] && ...) 
> not Event(..., this after $e1) 
> then 
>... 
> end 
> 
> -W 
> 
> On 14/02/2014, daveor <[hidden email]> wrote:
> 
> > Hi there, 
> > 
> > I'm a drools newbie and I wonder if someone could help me. I'm using drools 
> > 6.0.1 and I'm trying to write a rule that fires when: 
> > 
> > 1) a certain event is seen and 
> > 2) a second event is not seen within a certain period of time (1 minute in 
> > the examples below) after the first event is seen 
> > 
> > I have tried the following LHS patterns: 
> > 
> > rule "Something" dialect "mvel" 
> > when 
> > $e1: Event($location: properties["location"] && ...) 
> > not Event(, this after $e1) 
> > then 
> > //do stuff 
> > end 
> > 
> > rule "Something" dialect "mvel" 
> > when 
> > $e1: Event($location: properties["location"] && ...) 
> > not Event(, this after[0, 1m] $e1) 
> > then 
> > //do stuff 
> > end 
> > 
> > rule "Something" dialect "mvel" 
> > when 
> > $e1: Event($location: properties["location"] && ...) 
> > List (size == 0) from collect (Event(..., this after $e1) over 
> > window:time(1m)) 
> > then 
> > //do stuff 
> > end 
> > 
> > 
> > rule "Something" dialect "mvel" 
> > when 
> > $e1: Event($location: properties["location"] && ...) 
> > List (size == 0) from collect (Event(...) over window:time(1m)) 
> > then 
> > //do stuff 
> > end 
> > 
> > The unwanted behaviours are as follows: 
> > 
> > In the first case, the rule fires immediately after the first event is 
> > inserted. 
> > In the second case, the rule fails to fire if the second event is seen (as 
> > expected) but the rule does not fire if the second event is not seen within 
> > 1 minute. 
> > In the third and fourth cases, the rule fires immediately after the first 
> > event is inserted. 
> > 
> > Event is a java class with a hash map of properties, defined with the 
> > following metadata: 
> > 
> > declare Event 
> > @role(event) 
> > end 
> > 
> > I would really appreciate if someone could help me out here. 
> > 
> > Thanks and let me know if you need any more info. 
> > 
> > Dave 
> > 
> > 
> > 
> > 
> > -- 
> > View this message in context: 
> > http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com. 
> > ___ 
> > rules-users mailing list 
> > [hidden email] 
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> ___ 
> rules-users mailing list 
> [hidden email] 
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129p4028131.html
> To unsubscribe from Help with event not found over window query, click here.
> NAML





--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129p4028171.html
Sent from the Drools: User forum mailing list archive at Nabble.com.___
rules-users mailing list
rules-users@lis

Re: [rules-users] Help with event not found over window query

2014-02-15 Thread Wolfgang Laun
It would be interesting to discuss why each of these four rules fails to
meet you expectation. Mostly it's due to the engine not evaluating
exactly one minute after the "certain event" arrives.

The following rule fires 1 minute after the evaluation of the arrival
of an Event according to constraints and when no second Event
(according to constraints not shown) has arrived since then.

rule "Something Else" dialect "mvel"
timer ( int: 1m )
when
$e1: Event($location: properties["location"] && ...)
not Event(..., this after $e1)
then
   ...
end

-W

On 14/02/2014, daveor  wrote:
> Hi there,
>
> I'm a drools newbie and I wonder if someone could help me. I'm using drools
> 6.0.1 and I'm trying to write a rule that fires when:
>
> 1) a certain event is seen and
> 2) a second event is not seen within a certain period of time (1 minute in
> the examples below) after the first event is seen
>
> I have tried the following LHS patterns:
>
> rule "Something" dialect "mvel"
> when
> $e1: Event($location: properties["location"] && ...)
> not Event(, this after $e1)
> then
> //do stuff
> end
>
> rule "Something" dialect "mvel"
> when
> $e1: Event($location: properties["location"] && ...)
> not Event(, this after[0, 1m] $e1)
> then
> //do stuff
> end
>
> rule "Something" dialect "mvel"
> when
> $e1: Event($location: properties["location"] && ...)
> List (size == 0) from collect (Event(..., this after $e1) over
> window:time(1m))
> then
> //do stuff
> end
>
>
> rule "Something" dialect "mvel"
> when
> $e1: Event($location: properties["location"] && ...)
> List (size == 0) from collect (Event(...) over window:time(1m))
> then
> //do stuff
> end
>
> The unwanted behaviours are as follows:
>
> In the first case, the rule fires immediately after the first event is
> inserted.
> In the second case, the rule fails to fire if the second event is seen (as
> expected) but the rule does not fire if the second event is not seen within
> 1 minute.
> In the third and fourth cases, the rule fires immediately after the first
> event is inserted.
>
> Event is a java class with a hash map of properties, defined with the
> following metadata:
>
> declare Event
>   @role(event)
> end
>
> I would really appreciate if someone could help me out here.
>
> Thanks and let me know if you need any more info.
>
> Dave
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help with event not found over window query

2014-02-14 Thread daveor
Hi there, 

I'm a drools newbie and I wonder if someone could help me. I'm using drools
6.0.1 and I'm trying to write a rule that fires when:

1) a certain event is seen and 
2) a second event is not seen within a certain period of time (1 minute in
the examples below) after the first event is seen

I have tried the following LHS patterns:

rule "Something" dialect "mvel"
when
$e1: Event($location: properties["location"] && ...)
not Event(, this after $e1)
then
//do stuff
end

rule "Something" dialect "mvel"
when
$e1: Event($location: properties["location"] && ...)
not Event(, this after[0, 1m] $e1)
then
//do stuff
end

rule "Something" dialect "mvel"
when
$e1: Event($location: properties["location"] && ...)
List (size == 0) from collect (Event(..., this after $e1) over
window:time(1m))
then
//do stuff
end


rule "Something" dialect "mvel"
when
$e1: Event($location: properties["location"] && ...)
List (size == 0) from collect (Event(...) over window:time(1m))
then
//do stuff
end

The unwanted behaviours are as follows:

In the first case, the rule fires immediately after the first event is
inserted. 
In the second case, the rule fails to fire if the second event is seen (as
expected) but the rule does not fire if the second event is not seen within
1 minute.
In the third and fourth cases, the rule fires immediately after the first
event is inserted.

Event is a java class with a hash map of properties, defined with the
following metadata:

declare Event
@role(event)
end

I would really appreciate if someone could help me out here. 

Thanks and let me know if you need any more info.

Dave




--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help with drools 6

2013-12-30 Thread vinodkiran
take a look at 

https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-spring/src/test/java/org/kie/spring/tests/KieSpringBasicsTest2.java

-Vinod



--
View this message in context: 
http://drools.46999.n3.nabble.com/help-with-drools-6-tp4027460p4027463.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help with drools 6

2013-12-30 Thread Mark Proctor
the artefact name changed:
https://repository.jboss.org/nexus/service/local/repositories/releases/content/org/kie/kie-spring/6.0.1.Final/kie-spring-6.0.1.Final.jar

Mark
On 30 Dec 2013, at 08:55, dwipin  wrote:

> Hi, 
> 
> I am trying to create a project using Drools 6 with Spring.
> 
> I have drools-spring-6.0.0.Beta2 as the dependency as
> drools-spring-6.0.0.Final is not available.
> 
> I am unable to get the  tag to bind in the spring
> application-context file. Can some one post a sample appCtx file with the
> kmodule xsd schema location specified ?
> 
> Also, is there a working sample of using Spring with Drools 6 anywhere ?
> 
> Thanks, 
> Dwipin Chandran. 
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/help-with-drools-6-tp4027460.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help with drools 6

2013-12-30 Thread dwipin
Hi, 

I am trying to create a project using Drools 6 with Spring.

I have drools-spring-6.0.0.Beta2 as the dependency as
drools-spring-6.0.0.Final is not available.

I am unable to get the  tag to bind in the spring
application-context file. Can some one post a sample appCtx file with the
kmodule xsd schema location specified ?

Also, is there a working sample of using Spring with Drools 6 anywhere ?

Thanks, 
Dwipin Chandran. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/help-with-drools-6-tp4027460.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help on writing a rule

2013-10-22 Thread Wolfgang Laun
Well...

On 22/10/2013, Demian Calcaprina  wrote:
> Yes! I receive many price change events.. but, as I am using window length
> = 1, I would expect to have the activation cancelled for the previous one?
>
> I am not sure how to express this:
> "when there is some price change, and some signal, and there has not been
> any order over the last minute, then place an order"
>
> The price change and signal are like "existence" facts.. "If there is some
> price change change.." "if there is some signal ..."

there ist the "exists" CE,well documented in Expert's section 4.8.3.6.4.

But then you'll have trouble accessing the order id of this anonymous existence.

Again, I recommend using what I call an auxiliary "peephole fact" to
keep track of the latest pair of PriceChange and Signal, possibly with
a reference to the OrderCreated.

Also, the "magic"  if value 1234 doesn't look kosher to me, too.

-W

>
> Would this be another way to achieve what I am trying to do?
>
> Thanks,
>
> Demian
>
> PS: This is a simple rule, but then, the idea is to have more complex
> rules.. like, if there has been 10 signals in the last time, place an
> order, etc.
>
>
> On Tue, Oct 22, 2013 at 5:40 PM, Davide Sottara  wrote:
>
>> Am I wrong or do you have two PriceChange events - 392 and 394 ?
>> If so, you can expect two activations.. when you fire al rules, one of
>> the two
>> will insert the OrderCreated, which in turn will cancel the other
>>
>> On 10/22/2013 01:34 PM, calcacuervo wrote:
>> > Hi Guys. I have one quesiton on how could I implement my rule.
>> > I have this rule:
>> > when
>> >   t : PriceChange() over window:length(1)
>> >   signal : Signal( id == "1234" ) over window:length(1)
>> >   not OrderCreated( id == "1234" ) over window:time (1m)
>> >   then
>> > insert(new OrderCreated("1234));
>> >
>> > Basically, when there is some signal and some price change, create a
>> > new
>> > order if  there has no been any other order in the last minute.
>> > But this sometimes is being fired twice:
>> > 12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
>> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
>> > rule:ertetr activationId:ertetr [393, 392, 0] declarations:
>> > t=PriceChange
>> > [](392); signal=Signal@1413ddef(393)
>> > 12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
>> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
>> > rule:ertetr activationId:ertetr [393, 394, 0] declarations:
>> > t=PriceChange
>> > [](394); signal=Signal@1413ddef(393)
>> >
>> > I think that, when the 1m window have passed, it creates twice the
>> > activations, as I have not called fire all rules yet. Does is make
>> sense? Do
>> > you have some idea on how could I implement this rule? "when there has
>> been
>> > some price change and some signal, and I did not create a new order in
>> the
>> > last minute, just create a new order".
>> >
>> > Thanks in advance!
>> >
>> > Demian
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
>> > Sent from the Drools: User forum mailing list archive at Nabble.com.
>> > ___
>> > rules-users mailing list
>> > rules-users@lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help on writing a rule

2013-10-22 Thread Demian Calcaprina
Mauricio,

In fact, I used to have this and the price change without window:length..
but
when
t : PriceChange()
signal : Signal( id == "1234" )
not OrderCreated( id == "1234" ) over window:time (1m)

But this will cause more and more duplicates orders (and it have sense!). I
added the length window to 1, as I would only like to create an order if
there is some signal in the window, it can place an order..


On Tue, Oct 22, 2013 at 5:42 PM, Mauricio Salatino wrote:

> Just curious here, why do you have this -> signal : Signal( id == "1234"
> ) over window:length(1)?
>
>
> On Tue, Oct 22, 2013 at 9:40 PM, Davide Sottara  wrote:
>
>> Am I wrong or do you have two PriceChange events - 392 and 394 ?
>> If so, you can expect two activations.. when you fire al rules, one of
>> the two
>> will insert the OrderCreated, which in turn will cancel the other
>>
>> On 10/22/2013 01:34 PM, calcacuervo wrote:
>> > Hi Guys. I have one quesiton on how could I implement my rule.
>> > I have this rule:
>> > when
>> >   t : PriceChange() over window:length(1)
>> >   signal : Signal( id == "1234" ) over window:length(1)
>> >   not OrderCreated( id == "1234" ) over window:time (1m)
>> >   then
>> > insert(new OrderCreated("1234));
>> >
>> > Basically, when there is some signal and some price change, create a new
>> > order if  there has no been any other order in the last minute.
>> > But this sometimes is being fired twice:
>> > 12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
>> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
>> > rule:ertetr activationId:ertetr [393, 392, 0] declarations:
>> t=PriceChange
>> > [](392); signal=Signal@1413ddef(393)
>> > 12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
>> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
>> > rule:ertetr activationId:ertetr [393, 394, 0] declarations:
>> t=PriceChange
>> > [](394); signal=Signal@1413ddef(393)
>> >
>> > I think that, when the 1m window have passed, it creates twice the
>> > activations, as I have not called fire all rules yet. Does is make
>> sense? Do
>> > you have some idea on how could I implement this rule? "when there has
>> been
>> > some price change and some signal, and I did not create a new order in
>> the
>> > last minute, just create a new order".
>> >
>> > Thanks in advance!
>> >
>> > Demian
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
>> > Sent from the Drools: User forum mailing list archive at Nabble.com.
>> > ___
>> > rules-users mailing list
>> > rules-users@lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>  - MyJourney @ http://salaboy.com 
>  - Co-Founder @ http://www.jugargentina.org
>  - Co-Founder @ http://www.jbug.com.ar
>
>  - Salatino "Salaboy" Mauricio -
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Help on writing a rule

2013-10-22 Thread Demian Calcaprina
Yes! I receive many price change events.. but, as I am using window length
= 1, I would expect to have the activation cancelled for the previous one?

I am not sure how to express this:
"when there is some price change, and some signal, and there has not been
any order over the last minute, then place an order"

The price change and signal are like "existence" facts.. "If there is some
price change change.." "if there is some signal ..."

Would this be another way to achieve what I am trying to do?

Thanks,

Demian

PS: This is a simple rule, but then, the idea is to have more complex
rules.. like, if there has been 10 signals in the last time, place an
order, etc.


On Tue, Oct 22, 2013 at 5:40 PM, Davide Sottara  wrote:

> Am I wrong or do you have two PriceChange events - 392 and 394 ?
> If so, you can expect two activations.. when you fire al rules, one of
> the two
> will insert the OrderCreated, which in turn will cancel the other
>
> On 10/22/2013 01:34 PM, calcacuervo wrote:
> > Hi Guys. I have one quesiton on how could I implement my rule.
> > I have this rule:
> > when
> >   t : PriceChange() over window:length(1)
> >   signal : Signal( id == "1234" ) over window:length(1)
> >   not OrderCreated( id == "1234" ) over window:time (1m)
> >   then
> > insert(new OrderCreated("1234));
> >
> > Basically, when there is some signal and some price change, create a new
> > order if  there has no been any other order in the last minute.
> > But this sometimes is being fired twice:
> > 12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> > rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange
> > [](392); signal=Signal@1413ddef(393)
> > 12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> > rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange
> > [](394); signal=Signal@1413ddef(393)
> >
> > I think that, when the 1m window have passed, it creates twice the
> > activations, as I have not called fire all rules yet. Does is make
> sense? Do
> > you have some idea on how could I implement this rule? "when there has
> been
> > some price change and some signal, and I did not create a new order in
> the
> > last minute, just create a new order".
> >
> > Thanks in advance!
> >
> > Demian
> >
> >
> >
> > --
> > View this message in context:
> http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Help on writing a rule

2013-10-22 Thread Mauricio Salatino
Just curious here, why do you have this -> signal : Signal( id == "1234" )
over window:length(1)?


On Tue, Oct 22, 2013 at 9:40 PM, Davide Sottara  wrote:

> Am I wrong or do you have two PriceChange events - 392 and 394 ?
> If so, you can expect two activations.. when you fire al rules, one of
> the two
> will insert the OrderCreated, which in turn will cancel the other
>
> On 10/22/2013 01:34 PM, calcacuervo wrote:
> > Hi Guys. I have one quesiton on how could I implement my rule.
> > I have this rule:
> > when
> >   t : PriceChange() over window:length(1)
> >   signal : Signal( id == "1234" ) over window:length(1)
> >   not OrderCreated( id == "1234" ) over window:time (1m)
> >   then
> > insert(new OrderCreated("1234));
> >
> > Basically, when there is some signal and some price change, create a new
> > order if  there has no been any other order in the last minute.
> > But this sometimes is being fired twice:
> > 12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> > rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange
> > [](392); signal=Signal@1413ddef(393)
> > 12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> > (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> > rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange
> > [](394); signal=Signal@1413ddef(393)
> >
> > I think that, when the 1m window have passed, it creates twice the
> > activations, as I have not called fire all rules yet. Does is make
> sense? Do
> > you have some idea on how could I implement this rule? "when there has
> been
> > some price change and some signal, and I did not create a new order in
> the
> > last minute, just create a new order".
> >
> > Thanks in advance!
> >
> > Demian
> >
> >
> >
> > --
> > View this message in context:
> http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 - MyJourney @ http://salaboy.com 
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Help on writing a rule

2013-10-22 Thread Davide Sottara
Am I wrong or do you have two PriceChange events - 392 and 394 ?
If so, you can expect two activations.. when you fire al rules, one of
the two
will insert the OrderCreated, which in turn will cancel the other
 
On 10/22/2013 01:34 PM, calcacuervo wrote:
> Hi Guys. I have one quesiton on how could I implement my rule.
> I have this rule:
> when
>   t : PriceChange() over window:length(1)
>   signal : Signal( id == "1234" ) over window:length(1)
>   not OrderCreated( id == "1234" ) over window:time (1m)
>   then
> insert(new OrderCreated("1234));
>
> Basically, when there is some signal and some price change, create a new
> order if  there has no been any other order in the last minute.
> But this sometimes is being fired twice:
> 12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange
> [](392); signal=Signal@1413ddef(393)
> 12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange
> [](394); signal=Signal@1413ddef(393)
>
> I think that, when the 1m window have passed, it creates twice the
> activations, as I have not called fire all rules yet. Does is make sense? Do
> you have some idea on how could I implement this rule? "when there has been
> some price change and some signal, and I did not create a new order in the
> last minute, just create a new order".
>
> Thanks in advance!
>
> Demian
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help on writing a rule

2013-10-22 Thread calcacuervo
Hi Guys. I have one quesiton on how could I implement my rule.
I have this rule:
when
t : PriceChange() over window:length(1)
signal : Signal( id == "1234" ) over window:length(1)
not OrderCreated( id == "1234" ) over window:time (1m)
then
insert(new OrderCreated("1234));

Basically, when there is some signal and some price change, create a new
order if  there has no been any other order in the last minute.
But this sometimes is being fired twice:
12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
(camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange
[](392); signal=Signal@1413ddef(393)
12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
(camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange
[](394); signal=Signal@1413ddef(393)

I think that, when the 1m window have passed, it creates twice the
activations, as I have not called fire all rules yet. Does is make sense? Do
you have some idea on how could I implement this rule? "when there has been
some price change and some signal, and I did not create a new order in the
last minute, just create a new order".

Thanks in advance!

Demian



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help

2013-09-16 Thread Wolfgang Laun
You have successfully posted a message on the Drools user list, which
is read by thousands of people, so please take care what you write.

-W

PS: "Help" is not a good subject, unless it's the Beatles' Fan List ;-)


On 16/09/2013, poonam.lig...@wipro.com  wrote:
> Hi,
>
> I want to post a query.
> Could you please let me know the process.
> I am getting error As 'You are not allowed to post on this link'.
>
> Thanks,
> Poonam
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help

2013-09-16 Thread poonam.ligade
Hi,

I want to post a query.
Could you please let me know the process.
I am getting error As 'You are not allowed to post on this link'.

Thanks,
Poonam

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] help on drools guvnor

2013-07-17 Thread rjr201
What are your rules?



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-help-on-drools-guvnor-tp4024975p4024977.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help on drools guvnor

2013-07-17 Thread Stephen Masters
Have you tested that the rules fire when you load them as DRL?

It would probably be worth showing us what EmployeeMap looks like and the rule 
which you expect to fire if there is an EmployeeMap in working memory.

The Drools version would also be useful.

Steve


On 17 Jul 2013, at 14:04, pritha.gh...@wipro.com wrote:

> Hi,
>  
> I am not able to run rules from .pkg resources.
>  
> Knowledgesession is getting populated with package and rules inside the 
> packages but when I am firing ksession.fireAllRules(); no rules are getting 
> executed.
>  
> Below is my program
>  
> final KnowledgeBuilder kbuilder = 
> KnowledgeBuilderFactory.newKnowledgeBuilder();
>  
> // Use this line if calling rule defined using guvnor package
> org.drools.io.impl.UrlResource urlResource;
> try {
>   urlResource = (org.drools.io.impl.UrlResource) 
> org.drools.io.ResourceFactory
>   .newUrlResource(new 
> java.net.URL("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/OBSPOC/OBSSNAP/OBSPOC_OBSSNAP.pkg";));
>
>  
>   urlResource.setBasicAuthentication("enabled");
>   urlResource.setUsername("admin");
>   urlResource.setPassword("admin");
>   kbuilder.add(urlResource,ResourceType.PKG);
> }
>  catch (MalformedURLException e) {
> System.out.println("malformed URL");
> e.printStackTrace();
>   }
> catch (Exception e) {
>   // TODO Auto-generated catch block
>   e.printStackTrace();
> }
> // create the knowledge base
> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
>  
>
>  
>  
> // Check the builder for errors
> if (kbuilder.hasErrors()) {
> System.out.println(kbuilder.getErrors().toString() + 
> "");
> throw new RuntimeException("Unable to compile the 
> rule file.");
>}else{
> System.out.println(".Rule File is Read 
> Successfully");
> }
>  
> // get the compiled packages (which are serializable)
> final Collection pkgs = kbuilder
> .getKnowledgePackages();
>  
> // add the packages to a knowledgebase (deploy the knowledge 
> packages).
>   //  final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
>  kbase.addKnowledgePackages(pkgs);
>  
>  
> final StatefulKnowledgeSession ksession = kbase
> .newStatefulKnowledgeSession();
>  
> ksession.addEventListener(new DebugAgendaEventListener());
> ksession.addEventListener(new DebugWorkingMemoryEventListener());
>  
>  EmployeeMap employeeMap = new EmployeeMap();
> employeeMap.setEmployeeCountry("INDIA");
> employeeMap.setEmployeeID(1);
> employeeMap.setEmployeeName("USERP");
>  
> ksession.insert(employeeMap);
>  ksession.fireAllRules();
> 
> 
> ksession.dispose();
>  
>  
> Thanks,
> Pritha
> Please do not print this email unless it is absolutely necessary.
> 
> The information contained in this electronic message and any attachments to 
> this message are intended for the exclusive use of the addressee(s) and may 
> contain proprietary, confidential or privileged information. If you are not 
> the intended recipient, you should not disseminate, distribute or copy this 
> e-mail. Please notify the sender immediately and destroy all copies of this 
> message and any attachments.
> 
> WARNING: Computer viruses can be transmitted via email. The recipient should 
> check this email and any attachments for the presence of viruses. The company 
> accepts no liability for any damage caused by any virus transmitted by this 
> email.
> 
> www.wipro.com
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] help on drools guvnor

2013-07-17 Thread pritha.ghosh
Hi,

I am not able to run rules from .pkg resources.

Knowledgesession is getting populated with package and rules inside the 
packages but when I am firing ksession.fireAllRules(); no rules are getting 
executed.

Below is my program

final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

// Use this line if calling rule defined using guvnor package
org.drools.io.impl.UrlResource urlResource;
try {
  urlResource = (org.drools.io.impl.UrlResource) 
org.drools.io.ResourceFactory
  .newUrlResource(new 
java.net.URL("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/OBSPOC/OBSSNAP/OBSPOC_OBSSNAP.pkg";));


  urlResource.setBasicAuthentication("enabled");
  urlResource.setUsername("admin");
  urlResource.setPassword("admin");
  kbuilder.add(urlResource,ResourceType.PKG);
}
 catch (MalformedURLException e) {
System.out.println("malformed URL");
e.printStackTrace();
  }
catch (Exception e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
}
// create the knowledge base
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();




// Check the builder for errors
if (kbuilder.hasErrors()) {
System.out.println(kbuilder.getErrors().toString() + 
"");
throw new RuntimeException("Unable to compile the rule 
file.");
   }else{
System.out.println(".Rule File is Read 
Successfully");
}

// get the compiled packages (which are serializable)
final Collection pkgs = kbuilder
.getKnowledgePackages();

// add the packages to a knowledgebase (deploy the knowledge packages).
  //  final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
 kbase.addKnowledgePackages(pkgs);


final StatefulKnowledgeSession ksession = kbase
.newStatefulKnowledgeSession();

ksession.addEventListener(new DebugAgendaEventListener());
ksession.addEventListener(new DebugWorkingMemoryEventListener());

 EmployeeMap employeeMap = new EmployeeMap();
employeeMap.setEmployeeCountry("INDIA");
employeeMap.setEmployeeID(1);
employeeMap.setEmployeeName("USERP");

ksession.insert(employeeMap);
 ksession.fireAllRules();


ksession.dispose();


Thanks,
Pritha

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Help with DefaultAgenda.java

2013-03-10 Thread Mark Proctor
I replied to this on the DEV mailing list, this is the USER mailing list. 
Please see the web archives.

Mark
On 11 Mar 2013, at 00:36, Mallory  wrote:

> Hello,
> 
> I have tried to change the source code of DefaultAgenda.Java by adding the
> code below:
> 
> //drools orginial sequential code
>  /*
>while ( continueFiring( fireLimit ) && fireNextItem( agendaFilter )
> ) {
>fireCount++;
>fireLimit = updateFireLimit( fireLimit );
>this.workingMemory.executeQueuedActions();
>}
>*/
> 
> 
>//code with concurrency
> 
>InternalAgendaGroup myGroup = (InternalAgendaGroup) getNextFocus();
>fireCount = myGroup.size();
> 
>for(int i =0; i< fireCount; ++i)
>{
> 
>new Thread(new Runnable(){
>public void run()
>{
>fireNextItem( agendaFilter );
> 
>}
>}).start();
> 
>}
> 
> 
> I am getting an Errorjava.lang.NullPointerException because my code flow is
> going to consequenceExceptionHandler ! = null exception.
> 
> else if ( this.consequenceExceptionHandler != null ) {
> 
>this.consequenceExceptionHandler.handleException(
> activation, this.workingMemory.getKnowledgeRuntime(),
>  e );
> 
> 
> Could you kindly help me with this?
> 
> I am pasting the exception below and I am using Drools 5.4 Final version.
> 
> In DA: [Activation rule=Rule 1, act#=0, salience=0, tuple=[fact
> 0:0:1773684356:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0]
> ]
> Exception in thread "Thread-1" Exception in thread "Thread-0" Exception
> executing consequence for rule "Rule 1" in defaultpkg:
> java.lang.NullPointerException
> In DA WM: org.drools.impl.StatefulKnowledgeSessionImpl@542487b1
> In DA Errorjava.lang.NullPointerException
> In DA: [Activation rule=Rule 2, act#=1, salience=0, tuple=[fact
> 0:0:1773684356:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0]
> ]
> In DA WM: org.drools.impl.StatefulKnowledgeSessionImpl@542487b1
> In DA Errorjava.lang.NullPointerException
>at
> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1208)
>at org.drools.common.DefaultAgenda$1.run(DefaultAgenda.java:1471)
>at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.NullPointerException
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1272)
>... 3 more
> Exception executing consequence for rule "Rule 2" in defaultpkg:
> java.lang.NullPointerException
>at
> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1208)
>at org.drools.common.DefaultAgenda$1.run(DefaultAgenda.java:1471)
>at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.NullPointerException
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1272)
>... 3 more
> 
> 
> Thanks a lot for the help.
> 
> Regards,
> Malory
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Help-with-DefaultAgenda-java-tp4022758.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help with DefaultAgenda.java

2013-03-10 Thread Mallory
Hello,

I have tried to change the source code of DefaultAgenda.Java by adding the
code below:

 //drools orginial sequential code
  /*
while ( continueFiring( fireLimit ) && fireNextItem( agendaFilter )
) {
fireCount++;
fireLimit = updateFireLimit( fireLimit );
this.workingMemory.executeQueuedActions();
}
*/


//code with concurrency

InternalAgendaGroup myGroup = (InternalAgendaGroup) getNextFocus();
fireCount = myGroup.size();

for(int i =0; i< fireCount; ++i)
{

new Thread(new Runnable(){
public void run()
{
fireNextItem( agendaFilter );

}
}).start();

}


I am getting an Errorjava.lang.NullPointerException because my code flow is
going to consequenceExceptionHandler ! = null exception.

else if ( this.consequenceExceptionHandler != null ) {

this.consequenceExceptionHandler.handleException(
activation, this.workingMemory.getKnowledgeRuntime(),
  e );


Could you kindly help me with this?

I am pasting the exception below and I am using Drools 5.4 Final version.

In DA: [Activation rule=Rule 1, act#=0, salience=0, tuple=[fact
0:0:1773684356:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0]
]
Exception in thread "Thread-1" Exception in thread "Thread-0" Exception
executing consequence for rule "Rule 1" in defaultpkg:
java.lang.NullPointerException
In DA WM: org.drools.impl.StatefulKnowledgeSessionImpl@542487b1
In DA Errorjava.lang.NullPointerException
In DA: [Activation rule=Rule 2, act#=1, salience=0, tuple=[fact
0:0:1773684356:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0]
]
In DA WM: org.drools.impl.StatefulKnowledgeSessionImpl@542487b1
In DA Errorjava.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1208)
at org.drools.common.DefaultAgenda$1.run(DefaultAgenda.java:1471)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1272)
... 3 more
Exception executing consequence for rule "Rule 2" in defaultpkg:
java.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1208)
at org.drools.common.DefaultAgenda$1.run(DefaultAgenda.java:1471)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1272)
... 3 more


Thanks a lot for the help.

Regards,
Malory



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-DefaultAgenda-java-tp4022758.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help to implement my 1st planner

2013-01-24 Thread André Rezende Fróes de Moraes
Hello everyone, i'm trying to implement drools planner for my paper and it
is proving very hard taking in consideration that i never user it before.

I was able to reproduce the examples, even though i got very confused, but
i  undestood some things, but i'm really lost of how to implement my own
project/rule.


My paper is about service, I don't really know how to define it, but i'll
try to explain.

A given company receive several requests of maintence, repair, etc, all the
time, and it have a number of people to solve that, these technicians. It's
something like the nurse roaster but wy to simpler.

An issue can pop at any minute, it have a starting time and an estimated
time to be acomplished.

The technician have work for a fixed amount of time, but he have the start
time and the end time of work, that I want to use to assign the issue.

I've created the class Technician

Technician



import java.util.Date;

import com.thoughtworks.xstream.annotations.XStreamAlias;

@XStreamAlias("Technician")
public class Technician extends AbstractPersistable {

private int engId;
private int workTime;
private Date startWorkTime;
private Date endWorkTime;

private Technician technician;

public Technician(int engId, int workTime, Date startWorkTime,
Date endWorkTime) {
super();
this.engId = engId;
this.workTime = workTime;
this.startWorkTime = startWorkTime;
this.endWorkTime = endWorkTime;
}

public int getEngId() {
return engId;
}

public void setEngId(int engId) {
this.engId = engId;
}

public Date getStartWorkTime() {
return startWorkTime;
}

public int getWorkTime() {
return workTime;
}

public void setWorkTime(int workTime) {
this.workTime = workTime;
}

public void setStartWorkTime(Date startWorkTime) {
this.startWorkTime = startWorkTime;
}

public Date getEndWorkTime() {
return endWorkTime;
}

public void setEndWorkTime(Date endWorkTime) {
this.endWorkTime = endWorkTime;
}

public Technician getTechnician() {
return technician;
}

public void setTechnician(Technician technician) {
this.technician = technician;
}

}



Issue class



import java.util.Date;

import com.thoughtworks.xstream.annotations.XStreamAlias;

@XStreamAlias("CloudComputer")
public class Issue extends AbstractPersistable {

private Date startTime;
private Date estimatedTime;

public Issue(Date startTime, Date estimatedTime) {
super();
this.startTime = startTime;
this.estimatedTime = estimatedTime;
}

public Date getStartTime() {
return startTime;
}

public void setStartTime(Date startTime) {
this.startTime = startTime;
}

public Date getEstimatedTime() {
return estimatedTime;
}

public void setEstimatedTime(Date estimatedTime) {
this.estimatedTime = estimatedTime;
}

}



and here i got lost. I'm trying to schedule the technician to these issues
based on the estimated time and in the time left of technician.

I accept any kind of help or comment, I need it for next monday, i'll be
tunned everytime on this trying to make it happen.

Thanks for your time

Aijin Nakanishi
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help with designing / implementing a way for users to write their own rules

2012-12-17 Thread kurrent93

Dear drools experts

Can I get some ideas on how best to do the following. 

I would like users of my app to be able to write their own rule(s). For
example, if Joe User buys an item that is more that $200 then he uses XYZ
shipping. If he does not select shipping the he uses ABC shipping. 

More precisely, how can I offer the ability, using Guvnor, for the end user
to write a rule, that does not give him the ability to modify a rule
condition regaring user id. The example above, of coures, has a condition
that if user is 'Joe User'. 

There are very many places in the app where users should be able to write
rules, so it would be nice to use (embed) guvnor, rather than writing a
special UI for each situation.

Any suggestions welcome.

Br
Anton



--
View this message in context: 
http://drools.46999.n3.nabble.com/help-with-designing-implementing-a-way-for-users-to-write-their-own-rules-tp4021232.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help please!!!

2012-06-26 Thread paco
Hi Toni,

It's very interesting to know it. It is possible that it is a bug. I did the
test several times but the results are the same.

Best regard 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-please-tp4018136p4018245.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help please!!!

2012-06-24 Thread Toni Rikkola
Must be a bug, perhaps verifier thinks these two rules are in different 
packages.

I can take a look at this next week.

Toni


On Jun 21, 2012, at 4:59 PM, paco wrote:

> I want to detect the conflict between the rules with Drools Verifier. For
> example the first condition of the second rule is present in the first rule
> and the actions to perform are the same in both rules as they demonstrate in
> the following case. It works very well when these rules belong to the same
> drl file.
> - fichier  a.drl---
> rule "a"
>no-loop true
>ruleflow-group "group1"
>dialect "mvel"
>when
>A==0
>then
>Action1
> end
> rule "b"
>no-loop true
>ruleflow-group "group1"
>dialect "mvel"
>when
>A==0 && B==1
>then
>Action1
> end
> 
> The problem arises when I separated its rules and that I have to put each in
> its own file
>   a.drl
> rule "a"
>no-loop true
>ruleflow-group "group1"
>dialect "mvel"
>when
>A==0
>then
>Action1
> end
> 
> --b.drl
> rule "b"
>no-loop true
>ruleflow-group "group1"
>dialect "mvel"
>when
>A==0 && B==1
>then
>Action1
> end
> I can no longer detect this problem with Drools Verifier.
> Does anyone ever encountered this problem?
> How can I do to write a small program to audit if this case? 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Help-please-tp4018136.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help please!!!

2012-06-21 Thread paco
I want to detect the conflict between the rules with Drools Verifier. For
example the first condition of the second rule is present in the first rule
and the actions to perform are the same in both rules as they demonstrate in
the following case. It works very well when these rules belong to the same
drl file.
- fichier  a.drl---
rule "a"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0
then
Action1
end
rule "b"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0 && B==1
then
Action1
end

The problem arises when I separated its rules and that I have to put each in
its own file
  a.drl
rule "a"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0
then
Action1
end

--b.drl
rule "b"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0 && B==1
then
Action1
end
I can no longer detect this problem with Drools Verifier.
Does anyone ever encountered this problem?
How can I do to write a small program to audit if this case? 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-please-tp4018136.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help

2012-05-30 Thread Olfa h
SORRY

2012/5/29 Mark Proctor 

>  Please do not cross post to user and dev mailing lis, it's bad manners.
> Please keep user questions to the user list. Please before you post again
> read the 17 guideline points towards the bottom of the page:
> http://www.jboss.org/drools/lists
>
> Mark
>
> On 29/05/2012 15:25, Olfa h wrote:
>
> HI,
>
>
> My master thesis  is to develop a model interface that allows the doctor
> to pose the question for the patient. it consists of an interface and a
> database format connaissace ontology. this application must guide the
> doctor.
>
>  The purpose of the ontology is to implement the interface model that
> contains a text box to enter the question and a text box to type the answer
> and then clicking a button data are displayed which are imported for the
> ontology weight the answer and then if the readings are not in good clicks
> a button to display other data but not displayed the first time and if the
> election is made on a data. By clicking a button to display the data that
> are connected to select data and then validate the choice.
>
> Please can you guide me to make this work?
>
> can you give to me  a detailed description and the simplest methods to
> follow and i inform you about all the information concerned my
> environment to lead a good results because i'm a beginner in this domain ?
>
> If there is any point on the ontology create or something missing you
> can tell me because this is the first that I work with ontologies.
>
>  so I just need to  realized this little application to validate the model
> interface and the ontology and I like that you guide me.
>
> Attached is the interface model and the ontology.
> I await your advise and your help.
>
> Thank you very much.
>
>
> ___
> rules-users mailing 
> listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help

2012-05-29 Thread Mark Proctor
Please do not cross post to user and dev mailing lis, it's bad manners. 
Please keep user questions to the user list. Please before you post 
again read the 17 guideline points towards the bottom of the page:

http://www.jboss.org/drools/lists

Mark
On 29/05/2012 15:25, Olfa h wrote:

HI,


My master thesis is to develop a model interface that allows the 
doctor to pose the question for the patient. it consists of an 
interface and a database format connaissace ontology. this application 
must guide the doctor.


 The purpose of the ontology is to implement the interface model that 
contains a text box to enter the question and a text box to type the 
answer
and then clicking a button data are displayed which are imported for 
the ontology weight the answer and then if the readings are not in 
good clicks
a button to display other data but not displayed the first time and if 
the election is made on a data. By clicking a button to display the 
data that

are connected to select data and then validate the choice.

Please can you guide me to make this work?

can you give to me  a detailed description and the simplest methods to 
follow and i inform you about all the information concerned my

environment to lead a good results because i'm a beginner in this domain ?

If there is any point on the ontology create or something missing you
can tell me because this is the first that I work with ontologies.

so I just need to realized this little application to validate the 
model interface and the ontology and I like that you guide me.


Attached is the interface modeland the ontology.
I await your advise and your help.

Thank you very much.


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help

2012-05-29 Thread Davide Sottara
Just sent you an email
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Help-tp4017664p4017667.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help

2012-05-29 Thread Davide Sottara
Just sent you an email
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Help-tp4017664p4017668.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help

2012-05-29 Thread Olfa h
HI,


My master thesis  is to develop a model interface that allows the
doctor to pose
the question for the patient. it consists of an interface and a database
format connaissace ontology. this application must guide the doctor.

 The purpose of the ontology is to implement the interface model that
contains a text box to enter the question and a text box to type the answer
and then clicking a button data are displayed which are imported for the
ontology weight the answer and then if the readings are not in good clicks
a button to display other data but not displayed the first time and if the
election is made on a data. By clicking a button to display the data that
are connected to select data and then validate the choice.

Please can you guide me to make this work?

can you give to me  a detailed description and the simplest methods to
follow and i inform you about all the information concerned my
environment to lead a good results because i'm a beginner in this domain ?

If there is any point on the ontology create or something missing you
can tell me because this is the first that I work with ontologies.

 so I just need to  realized this little application to validate the model
interface and the ontology and I like that you guide me.

Attached is the interface model and the ontology.
I await your advise and your help.

Thank you very much.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help

2012-05-09 Thread Wolfgang Laun
Try to print p.getName().
-W

On 9 March 2012 15:20, seagull  wrote:

> Hi everyone,
>
> I am new to drools.net and I am testing some basic commands but can't seem
> to find help anywhere! I am trying to print the contents of a variable but
> for some reason, the contents are not printed! The first line (i.e. hello)
> on the other hand is being printed.. Is there a common mistake I may be
> doing?
>
> Thanks!
>
> rule "testing"
>when
>p: Person (name == "john")
>then
>Console.WriteLine ("hello");
>Console.WriteLine (p.name);
>end
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Help-tp3812782p3812782.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help

2012-05-09 Thread seagull
Hi everyone,

I am new to drools.net and I am testing some basic commands but can't seem
to find help anywhere! I am trying to print the contents of a variable but
for some reason, the contents are not printed! The first line (i.e. hello)
on the other hand is being printed.. Is there a common mistake I may be
doing?

Thanks!

rule "testing"
when
p: Person (name == "john")
then
Console.WriteLine ("hello");
Console.WriteLine (p.name);
end

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-tp3812782p3812782.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help needed - Repository not getting initialised?

2011-11-13 Thread Praveen
Hi,

Repository is not getting initialised, throws NPE.
Please advise.
TIA.

public static Repository repository;

public static Session getSession() throws Exception {
return getSession(true);
}

public static synchronized Session getSession(boolean erase) {
try {
if (repository == null) {

if (erase) {
File repoDir = new File("repository");
System.out.println("DELETE test repo dir: "
+ repoDir.getAbsolutePath());
RepositorySessionUtil.deleteDir(repoDir);
System.out.println("TEST repo dir deleted.");
}

JCRRepositoryConfigurator config = new
JackrabbitRepositoryConfigurator();
String home = System
.getProperty("guvnor.repository.dir");
  
repository = config.getJCRRepository(home);

Session testSession = repository
.login(new SimpleCredentials("alan_parsons",
"password".toCharArray()));

RulesRepositoryAdministrator admin = new
RulesRepositoryAdministrator(
testSession);
if (erase && admin.isRepositoryInitialized()) {

admin.clearRulesRepository();
}
config.setupRulesRepository(testSession);
return testSession;
} else {
return repository.login(new SimpleCredentials(
"alan_parsons", "password".toCharArray()));
}
} catch (RepositoryException e) {
throw new IllegalStateException(e);
}

}

public static void main(String [] args) throws Exception{
getSession();
}


Below is the exception..

DELETE test repo dir: D:\drools\TestRepository\repository
TEST repo dir deleted.
Exception in thread "main" java.lang.NullPointerException: dispatcher
at
org.apache.jackrabbit.core.observation.ObservationManagerImpl.(ObservationManagerImpl.java:97)
at
org.apache.jackrabbit.core.WorkspaceImpl.getObservationManager(WorkspaceImpl.java:748)
at
org.apache.jackrabbit.core.SessionImpl.removeRegisteredEventListeners(SessionImpl.java:1193)
at org.apache.jackrabbit.core.SessionImpl.logout(SessionImpl.java:1222)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2194)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2149)
at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1175)
at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1127)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:544)
at
org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:366)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:231)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:279)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:375)
at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123)
at Hello.getSession(Hello.java:50)
at Hello.getSession(Hello.java:27)
at Hello.main(Hello.java:72)


Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-Repository-not-getting-initialised-tp3506064p3506064.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Robert Crawford
They can recalculate just fine -- the underlying AccumulateData is just a
SortedSet -- but ISTR there are problems with that code outside of my
functions.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3471330.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Wolfgang Laun
On 1 November 2011 17:57, Robert Crawford  wrote:

>
> I have a couple custom accumulate functions; I think the solution here may
> just be to have them return false for supportsReverse().
>
>
Sounds like it. Make sure to return false if rhe acc function cannot
recompute the value with one of the contributors gone.
-W



>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3471226.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Robert Crawford
I knew I spoke too soon. Now, from 5.2:


12:49:52,625 ERROR [STDERR] org.drools.RuntimeDroolsException: Unexpected
exception executing action
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction@554af19c
12:49:52,625 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
12:49:52,625 ERROR [STDERR] at
org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1037)
12:49:52,625 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:777)
12:49:52,625 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
12:49:52,625 ERROR [STDERR] at
org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)
12:49:52,625 ERROR [STDERR] at
com.kroger.tempmonitor.app.service.RuleService$1.run(RuleService.java:214)
12:49:52,625 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
12:49:52,625 ERROR [STDERR] Caused by: java.lang.NullPointerException
12:49:52,625 ERROR [STDERR] at
org.drools.reteoo.AccumulateNode.removeMatch(AccumulateNode.java:838)
12:49:52,626 ERROR [STDERR] at
org.drools.reteoo.AccumulateNode.removePreviousMatchesForRightTuple(AccumulateNode.java:908)
12:49:52,626 ERROR [STDERR] at
org.drools.reteoo.AccumulateNode.retractRightTuple(AccumulateNode.java:308)
12:49:52,626 ERROR [STDERR] at
org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:235)
12:49:52,626 ERROR [STDERR] at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:464)
12:49:52,626 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
12:49:52,626 ERROR [STDERR] ... 6 more

I have a couple custom accumulate functions; I think the solution here may
just be to have them return false for supportsReverse().



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3471226.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Robert Crawford
I've rolled back to 5.2.0 and it seems to be doing better. Almost an hour of
uptime.

I already have a custom consequence exception handler -- I think it's
cribbed from that link, even. But this exception doesn't appear to happen
during the execution of a consequence -- I *think* it's during an event
expiration, but I can't swear to that.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3471173.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Wolfgang Laun
Good diagnostics is provided if you follow
http://members.inode.at/w.laun/drools/CustomConsequenceExceptionHandlingHowTo.htmlwhich
has been incorporated into 5.3.0.
-W

On 31 October 2011 23:47, Robert Crawford  wrote:

> Any advice on how to troubleshoot problems? I have a fairly simple set of
> rules (a couple dozen), but keep having problems with fatal exceptions. The
> most recent was:
>
> org.drools.RuntimeDroolsException: Unexpected exception executing action
> org.drools.reteoo.PropagationQueuingNode$PropagateAction@1e60aa7
> at
>
> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)
> at
> org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1231)
> at
>
> org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
> at
>
> org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:729)
> at
>
> org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)
> at
> com.kroger.tempmonitor.app.service.RuleService$1.run(RuleService.java:214)
> at java.lang.Thread.run(Thread.java:662)
> Caused by: java.util.NoSuchElementException
> at java.util.LinkedList.remove(LinkedList.java:788)
> at java.util.LinkedList.removeFirst(LinkedList.java:134)
> at
>
> org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:264)
> at
>
> org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:357)
> at
>
> org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:238)
> at
>
> org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:502)
> at
>
> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:975)
> ... 6 more
>
>
> No mention of a rule name, so where do I begin?
>
> My architecture is simple: one thread ran fireUntilHalt(), other (multiple)
> threads inserting objects. Should I synchronize on the session so only one
> thread is inserting at a time?
>
> There's one rule that triggers a large number of inserts, and it used to
> give me problems, but I've moved those inserts into Commands and those
> problems seem to have gone away.
>
> Any advice would be welcome, no matter how basic you think it is! Thanks!
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3469285.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-10-31 Thread Richard Calmbach

Robert Crawford wrote:
> 
> Any advice on how to troubleshoot problems? I have a fairly simple set of
> rules (a couple dozen), but keep having problems with fatal exceptions.
> The most recent was:
> 
> org.drools.RuntimeDroolsException: Unexpected exception executing action
> org.drools.reteoo.PropagationQueuingNode$PropagateAction@1e60aa7
>  at
> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)
>  at
> org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1231)
>  at
> org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
>  at
> org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:729)
>  at
> org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)
>  at
> com.kroger.tempmonitor.app.service.RuleService$1.run(RuleService.java:214)
>  at java.lang.Thread.run(Thread.java:662)
> Caused by: java.util.NoSuchElementException
>  at java.util.LinkedList.remove(LinkedList.java:788)
>  at java.util.LinkedList.removeFirst(LinkedList.java:134)
>  at
> org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:264)
>  at
> org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:357)
>  at
> org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:238)
>  at
> org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:502)
>  at
> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:975)
>  ... 6 more
> 
> 
> No mention of a rule name, so where do I begin?
> 

The exception may happen during working memory operations (e.g., an insert),
so there isn't even a rule active.

Which version of Drools are you using? In my case, switching from Drools
5.2.0.Final to Drools 5.3.0.Final broke 47 of my unit tests (1 error and 46
failures). The one that now gives an error, shows this stacktrace (similar
to yours):

org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.PropagationQueuingNode$PropagateAction@7a9b777a
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:315)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at com.acme.das.fraud.RulesTestBase.sendEot(RulesTestBase.java:139)
at com.acme.das.fraud.RulesTestBase.advanceTime(RulesTestBase.java:131)
at com.acme.das.fraud.RulesTestBase.advanceTime(RulesTestBase.java:135)
at
com.acme.das.fraud.RulesTest.testUdrAndThenStartCdrWithinTimeout(RulesTest.java:1061)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
at org.jmock.integration.junit4.JMock$1.invoke(JMock.java:37)
at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:98)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at 
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteT

[rules-users] Help with troubleshooting rules/Drools

2011-10-31 Thread Robert Crawford
Any advice on how to troubleshoot problems? I have a fairly simple set of
rules (a couple dozen), but keep having problems with fatal exceptions. The
most recent was:

org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.PropagationQueuingNode$PropagateAction@1e60aa7
 at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)
 at
org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1231)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:729)
 at
org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)
 at
com.kroger.tempmonitor.app.service.RuleService$1.run(RuleService.java:214)
 at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.NoSuchElementException
 at java.util.LinkedList.remove(LinkedList.java:788)
 at java.util.LinkedList.removeFirst(LinkedList.java:134)
 at
org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:264)
 at
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:357)
 at
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:238)
 at
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:502)
 at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:975)
 ... 6 more


No mention of a rule name, so where do I begin?

My architecture is simple: one thread ran fireUntilHalt(), other (multiple)
threads inserting objects. Should I synchronize on the session so only one
thread is inserting at a time?

There's one rule that triggers a large number of inserts, and it used to
give me problems, but I've moved those inserts into Commands and those
problems seem to have gone away.

Any advice would be welcome, no matter how basic you think it is! Thanks!


--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3469285.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed - how to get Number and intValue in Guvnor

2011-10-20 Thread Praveen
Hello,

Anyone out there who has come across the above issue?

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-how-to-get-Number-and-intValue-in-Guvnor-tp3430730p3437459.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help! Activations firing out of salience order

2011-10-19 Thread darktyco
I had to upgrade to 5.2 to get away from the same salience bug. So far 5.2
has been very good to us other than the outrageous amount of memory it takes
to load up a large rule base (which you can partially get around using the
latest mvel jar).

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Help-Activations-firing-out-of-salience-order-tp3430611p3435291.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help! Activations firing out of salience order

2011-10-19 Thread Swindells, Thomas
That's a relief.
Any news as to when final will be released?

Thanks,

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: 19 October 2011 01:23
To: Rules Users List
Subject: Re: [rules-users] Help! Activations firing out of salience order


   This was a duplicate of https://issues.jboss.org/browse/JBRULES-3111 that 
was fixed last week. It will be released in 5.3.0.final.

   Edson
2011/10/18 Swindells, Thomas mailto:tswinde...@nds.com>>
Ouch looks like we and anybody on 5.1.1 needs to desperately update then.
Though I am rather concerned by this issue 
https://issues.jboss.org/browse/JBRULES-3211  "Rules fires on incorrect 
condition" - has this been looked at/is the issue correct as a rules engine 
which fires random rules when it shouldn't would be problematic!

Thomas

From: 
rules-users-boun...@lists.jboss.org<mailto:rules-users-boun...@lists.jboss.org> 
[mailto:rules-users-boun...@lists.jboss.org<mailto:rules-users-boun...@lists.jboss.org>]
 On Behalf Of Wolfgang Laun
Sent: 18 October 2011 11:05
To: Rules Users List
Subject: Re: [rules-users] Help! Activations firing out of salience order

There used to be a subtle bug in the PriorityHeapQueue containing the 
activations.

See https://issues.jboss.org/browse/JBRULES-3044

-W
2011/10/18 Swindells, Thomas mailto:tswinde...@nds.com>>
In our project we have been experiencing a large number of intermittent unit 
test failures when we are testing our rules (on drools 5.1.1).
After a lot of debugging, examining our rules for logic errors, experimenting 
and generally scratching our head trying to work out what is wrong, we have 
noticed that sometimes (but very intermittently) activations are firing in the 
wrong order.

In our rulebase we have two rules, Rule A salience 80 and Rule B salience 70. 
Whilst debugging we made Rule A and B are identical other than rule B having 
some additional constraints on the end.
Dumping out the agenda events we have observed the following actions occurring:
BEFORE_FIRED rule X
CREATED_ACTIVATION Rule A
CREATED_ACTIVATION Rule B
AFTER_FIRED rule X

... (no references to either rule/activation)

BEFORE_FIRED Rule B
CANCELLED Rule A
AFTER_FIRED Rule B

How can Rule B be firing before Rule A when both activations exist?
Does anybody know of any bugs in 5.1.1 that may be causing this?
We have a branch of code on 5.3 and that also has had intermittent unit test 
failures, we've not had chance to examine whether this is the same pattern or 
just a different logic issue.

Please help,

Thomas





**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com<mailto:postmas...@nds.com> and delete it from your system as 
well as any copies. The content of e-mails as well as traffic data may be 
monitored by NDS for employment and security purposes. To protect the 
environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

___
rules-users mailing list
rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com<http://www.jboss.com>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help! Activations firing out of salience order

2011-10-18 Thread Edson Tirelli
   This was a duplicate of https://issues.jboss.org/browse/JBRULES-3111 that
was fixed last week. It will be released in 5.3.0.final.

   Edson

2011/10/18 Swindells, Thomas 

> Ouch looks like we and anybody on 5.1.1 needs to desperately update then.*
> ***
>
> Though I am rather concerned by this issue
> https://issues.jboss.org/browse/JBRULES-3211  “Rules fires on incorrect
> condition” – has this been looked at/is the issue correct as a rules engine
> which fires random rules when it shouldn’t would be problematic!
>
> ** **
>
> Thomas
>
> ** **
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Wolfgang Laun
> *Sent:* 18 October 2011 11:05
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Help! Activations firing out of salience
> order
>
> ** **
>
> There used to be a subtle bug in the PriorityHeapQueue containing the
> activations.
>
> See https://issues.jboss.org/browse/JBRULES-3044
>
> -W
>
> 2011/10/18 Swindells, Thomas 
>
> In our project we have been experiencing a large number of intermittent
> unit test failures when we are testing our rules (on drools 5.1.1).
>
> After a lot of debugging, examining our rules for logic errors,
> experimenting and generally scratching our head trying to work out what is
> wrong, we have noticed that sometimes (but very intermittently) activations
> are firing in the wrong order.
>
>  
>
> In our rulebase we have two rules, Rule A salience 80 and Rule B salience
> 70. Whilst debugging we made Rule A and B are identical other than rule B
> having some additional constraints on the end. 
>
> Dumping out the agenda events we have observed the following actions
> occurring:
>
> BEFORE_FIRED rule X
>
> CREATED_ACTIVATION Rule A
>
> CREATED_ACTIVATION Rule B
>
> AFTER_FIRED rule X
>
>  
>
> … (no references to either rule/activation)
>
>  
>
> BEFORE_FIRED Rule B
>
> CANCELLED Rule A
>
> AFTER_FIRED Rule B
>
>  
>
> How can Rule B be firing before Rule A when both activations exist?
>
> Does anybody know of any bugs in 5.1.1 that may be causing this? 
>
> We have a branch of code on 5.3 and that also has had intermittent unit
> test failures, we’ve not had chance to examine whether this is the same
> pattern or just a different logic issue.
>
>  
>
> Please help,
>
>  
>
> Thomas
>
>  
>
>  
>
> ** **
> --
>
>
>
> **
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmas...@nds.com and delete it from your system as well as any copies.
> The content of e-mails as well as traffic data may be monitored by NDS for
> employment and security purposes. To protect the environment please do not
> print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
> 4EX, United Kingdom. A company registered in England and Wales. Registered
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **
> 
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ** **
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help! Activations firing out of salience order

2011-10-18 Thread Swindells, Thomas
Ouch looks like we and anybody on 5.1.1 needs to desperately update then.
Though I am rather concerned by this issue 
https://issues.jboss.org/browse/JBRULES-3211  "Rules fires on incorrect 
condition" - has this been looked at/is the issue correct as a rules engine 
which fires random rules when it shouldn't would be problematic!

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: 18 October 2011 11:05
To: Rules Users List
Subject: Re: [rules-users] Help! Activations firing out of salience order

There used to be a subtle bug in the PriorityHeapQueue containing the 
activations.

See https://issues.jboss.org/browse/JBRULES-3044

-W
2011/10/18 Swindells, Thomas mailto:tswinde...@nds.com>>
In our project we have been experiencing a large number of intermittent unit 
test failures when we are testing our rules (on drools 5.1.1).
After a lot of debugging, examining our rules for logic errors, experimenting 
and generally scratching our head trying to work out what is wrong, we have 
noticed that sometimes (but very intermittently) activations are firing in the 
wrong order.

In our rulebase we have two rules, Rule A salience 80 and Rule B salience 70. 
Whilst debugging we made Rule A and B are identical other than rule B having 
some additional constraints on the end.
Dumping out the agenda events we have observed the following actions occurring:
BEFORE_FIRED rule X
CREATED_ACTIVATION Rule A
CREATED_ACTIVATION Rule B
AFTER_FIRED rule X

... (no references to either rule/activation)

BEFORE_FIRED Rule B
CANCELLED Rule A
AFTER_FIRED Rule B

How can Rule B be firing before Rule A when both activations exist?
Does anybody know of any bugs in 5.1.1 that may be causing this?
We have a branch of code on 5.3 and that also has had intermittent unit test 
failures, we've not had chance to examine whether this is the same pattern or 
just a different logic issue.

Please help,

Thomas





**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com<mailto:postmas...@nds.com> and delete it from your system as 
well as any copies. The content of e-mails as well as traffic data may be 
monitored by NDS for employment and security purposes. To protect the 
environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

___
rules-users mailing list
rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help! Activations firing out of salience order

2011-10-18 Thread Wolfgang Laun
There used to be a subtle bug in the PriorityHeapQueue containing the
activations.

See https://issues.jboss.org/browse/JBRULES-3044

-W

2011/10/18 Swindells, Thomas 

>  In our project we have been experiencing a large number of intermittent
> unit test failures when we are testing our rules (on drools 5.1.1).
>
> After a lot of debugging, examining our rules for logic errors,
> experimenting and generally scratching our head trying to work out what is
> wrong, we have noticed that sometimes (but very intermittently) activations
> are firing in the wrong order.
>
> ** **
>
> In our rulebase we have two rules, Rule A salience 80 and Rule B salience
> 70. Whilst debugging we made Rule A and B are identical other than rule B
> having some additional constraints on the end. 
>
> Dumping out the agenda events we have observed the following actions
> occurring:
>
> BEFORE_FIRED rule X
>
> CREATED_ACTIVATION Rule A
>
> CREATED_ACTIVATION Rule B
>
> AFTER_FIRED rule X
>
> ** **
>
> … (no references to either rule/activation)
>
> ** **
>
> BEFORE_FIRED Rule B
>
> CANCELLED Rule A
>
> AFTER_FIRED Rule B
>
> ** **
>
> How can Rule B be firing before Rule A when both activations exist?
>
> Does anybody know of any bugs in 5.1.1 that may be causing this? 
>
> We have a branch of code on 5.3 and that also has had intermittent unit
> test failures, we’ve not had chance to examine whether this is the same
> pattern or just a different logic issue.
>
> ** **
>
> Please help,
>
> ** **
>
> Thomas
>
> ** **
>
> ** **
>
> --
>
>
> **
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmas...@nds.com and delete it from your system as well as any copies.
> The content of e-mails as well as traffic data may be monitored by NDS for
> employment and security purposes. To protect the environment please do not
> print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
> 4EX, United Kingdom. A company registered in England and Wales. Registered
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help needed - how to get Number and intValue in Guvnor

2011-10-18 Thread Praveen
Hello,

I am new to Drools and trying to write rules using Guvnor GUI.
I have uploaded POJO's that are required for my rules.
I am facing issue trying to get Number()(the one in Bold-Italics) and
intValue in the Guvnor GUI.
Below is the rule for reference, its taken from one of the examples provided
in Drools Planner.


// Accumulate hard constraints
rule "hardConstraintsBroken"
salience -1 // Do the other rules first (optional, for performance)
when
$hardTotal : */Number(/)* from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight) // Vote for
http://jira.jboss.com/jira/browse/JBRULES-1075
)
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
end

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-how-to-get-Number-and-intValue-in-Guvnor-tp3430730p3430730.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help! Activations firing out of salience order

2011-10-18 Thread Swindells, Thomas
In our project we have been experiencing a large number of intermittent unit 
test failures when we are testing our rules (on drools 5.1.1).
After a lot of debugging, examining our rules for logic errors, experimenting 
and generally scratching our head trying to work out what is wrong, we have 
noticed that sometimes (but very intermittently) activations are firing in the 
wrong order.

In our rulebase we have two rules, Rule A salience 80 and Rule B salience 70. 
Whilst debugging we made Rule A and B are identical other than rule B having 
some additional constraints on the end.
Dumping out the agenda events we have observed the following actions occurring:
BEFORE_FIRED rule X
CREATED_ACTIVATION Rule A
CREATED_ACTIVATION Rule B
AFTER_FIRED rule X

... (no references to either rule/activation)

BEFORE_FIRED Rule B
CANCELLED Rule A
AFTER_FIRED Rule B

How can Rule B be firing before Rule A when both activations exist?
Does anybody know of any bugs in 5.1.1 that may be causing this?
We have a branch of code on 5.3 and that also has had intermittent unit test 
failures, we've not had chance to examine whether this is the same pattern or 
just a different logic issue.

Please help,

Thomas





**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with URL resource caching

2011-09-23 Thread benji2212
Ah, I found my problem.  There was an issue with the builds, and my latest
changes weren't being applied to the environment I was testing in.  I've got
it working with the code I posted above.  Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-URL-resource-caching-tp3362041p3362216.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help with URL resource caching

2011-09-23 Thread benji2212
I'm using KnowledgeAgent to poll regularly for three DRL files hosted on a
web server.  If the web server goes down for any reason or one of the DRL
files becomes unavailable, the change scanner and knowledge agent
unsubscribe from the resource(s) that were unavailable.  

After reading some topics on the forum, I found that setting the
drools.resource.urlcache system property should correct this.  However, I've
been unable to get this to work properly.  The code I'm using is below.  Any
insight into what I'm doing wrong would be appreciated.  I'm using drools
5.1.1.

System.setProperty("drools.dateformat",
"MM/dd/");
System.setProperty("drools.resource.urlcache",
"C:\\Users\\000\\Documents\\rule-cache");

//start the scanner service and resource change 
notifier service
changeNotifier = 
ResourceFactory.getResourceChangeNotifierService();
changeScanner = 
ResourceFactory.getResourceChangeScannerService();
changeNotifier.start();
changeScanner.start();

kagent = KnowledgeAgentFactory.newKnowledgeAgent("My 
Knowledge Agent");
URL url = 
RulesRuntimeImpl.class.getResource(CHANGE_SET_PATH);
Resource drl = ResourceFactory.newUrlResource(url);
kagent.applyChangeSet(drl);


My change set file looks like this: 
http://drools.org/drools-5.0/change-set";
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
xs:schemaLocation="http://drools.org/drools-5.0/change-set
drools-change-set-5.0.xsd" >

http://mysite.com/test/FirstDecisionTable.drl";
type="DRL" />
http://mysite.com/test/SecondDecisionTable.drl";
type="DRL" />
http://mysite.com/test/ThirdDecisionTable.drl";
type="DRL" />



and the output I get when a resource in the change set becomes unavailable:
[9/21/11 10:49:28:015 EDT] 004e SystemOut O [2011:09:264
10:09:15:debug] ResourceChangeScanner attempt to scan 3 resources
[9/21/11 10:49:28:046 EDT] 004e SystemOut O [2011:09:264
10:09:46:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[9/21/11 10:50:28:055 EDT] 004e SystemOut O [2011:09:264
10:09:55:debug] ResourceChangeScanner attempt to scan 3 resources
[9/21/11 10:50:28:259 EDT] 004e SystemOut O [2011:09:264
10:09:259:debug] ResourceChangeScanner removed resource=[UrlResource
path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:309 EDT] 004e SystemOut O [2011:09:264
10:09:309:debug] ResourceChangeNotification received ChangeSet notification
[9/21/11 10:50:28:345 EDT] 004e SystemOut O [2011:09:264
10:09:345:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[9/21/11 10:50:28:426 EDT] 004f SystemOut O [2011:09:264
10:09:417:debug] ResourceChangeNotification processing ChangeSet
[9/21/11 10:50:28:535 EDT] 004f SystemOut O [2011:09:264
10:09:535:debug] ResourceChangeNotification ChangeSet removed
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
for listener=org.drools.agent.impl.KnowledgeAgentImpl@6e5a6e5a
[9/21/11 10:50:28:560 EDT] 004f SystemOut O [2011:09:264
10:09:560:debug] KnowledgeAgent received ChangeSet changed notification
[9/21/11 10:50:28:611 EDT] 004f SystemOut O [2011:09:264
10:09:611:debug] ResourceChangeNotification thread is waiting for queue
update
[9/21/11 10:50:28:626 EDT] 0050 SystemOut O [2011:09:264
10:09:625:info] KnowledgeAgent applying ChangeSet
[9/21/11 10:50:28:663 EDT] 0050 SystemOut O [2011:09:264
10:09:663:debug] KnowledgeAgent removing mappings for resource=[UrlResource
path='http://mysite.com/test/FirstDecisionTable.drl'] with unsubscribe=true
[9/21/11 10:50:28:684 EDT] 0050 SystemOut O [2011:09:264
10:09:684:debug] KnowledgeAgent notifier unsubscribing to
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:689 EDT] 0050 SystemOut O [2011:09:264
10:09:689:debug] ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@6e5a6e5a to
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:689 EDT] 0050 SystemOut O [2011:09:264
10:09:689:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-URL-resource-caching-tp3362041p3362041.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed

2011-08-08 Thread Mattias Nilsson Grip

prasad.pbc wrote:
> 
> Hi Guys,
>   Iam using Eclipse tool for writing drl , i have written drl .
> Then i have written an ant script to convert this drl to PKG .
> i have used drools5.1.1.jars. i was sucessfully convert drl to pkg.
> 
> knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); 
> kbuilder.add( ResourceFactory.newFileResource(
> "c:/Sample.pkg" ), 
> ResourceType.PKG ); 
> iam getting below error:
> 
> java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be
> cast to org.drools.rule.Package
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487)
> at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
> at com.test.rules.MyRulesEngine.(MyRulesEngine.java:51)
> at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39)
> at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38)
> 
> 
> Can anybody help resolving my problem..
> 
> Thanks
> prasad
> 
Based on the stack trace I would guess that the file Sample.pkg contains a
serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you
could try to do your export like this:

KnowledgeBase kbase = ...;
KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next();
FileOutputStream fos = new FileOutputStream(new File("c:/Sample.pkg"));
DroolsStreamUtils.streamOut(fos, kpackage);

/Mattias

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help! rule"rule_key" failed to predicate

2011-04-15 Thread Wolfgang Laun
The "package" declaration must be first.

You don't have to insert the "dialect" attribute into each rule.

Please consult the manual when programming.

-W





2011/4/15 赵慧 

>  hello,everyone! I wrote a rule with Drools,
> I compile the program and get the errors as follows:
>
>
> [3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate:
> {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
> [3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule
> package
> [7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule
> package in rule sample
>
>
> I don't know how it happened, looking forward to your reply! thank you !!!
>
>
>
> PS: My rules are here:
>
>  dialect "mvel"
> package  com.sample
>
> import com.sample.Server;
>
>
> rule "system will execute 'tc' command"
>
>  when
> eval(Server.Message>8388608)
>  then
>  System.out.println("The network is so crowd that it needs
> repairing.");
> Runtime.getRuntime().exec("tc");#give the authority and execute the
> "tc" command
> end
>
>
>
> rule "caution"
> when
> eval(Server.Message==8388608)
> then
> System.out.println("caution!The network maybe will get blocked very
> soon.");
> end
>
>
>
> rule "fluent network"
>   when
>   eval(Server.Message<8388608)#conditions
>  then
>   System.out.println("the current network is very good");#actions
> end
>
>
>
>
>
>
>
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help! rule"rule_key" failed to predicate

2011-04-15 Thread FrankVhh
Hi,

I thnik you might need to reposition dialect = "mvel". The compiling error
will go away if you put it inside each of your rules. See example:

rule "system will execute 'tc' command"
   
 when
dialect "mvel"
eval(Server.Message>8388608)
 then 
 System.out.println("The network is so crowd that it needs repairing.");
Runtime.getRuntime().exec("tc");#give the authority and execute the "tc"
command
end
 
rule "caution"
dialect "mvel"
when 
eval(Server.Message==8388608)
then 
System.out.println("caution!The network maybe will get blocked very
soon.");
end 
 
rule "fluent network"
  dialect "mvel"
  when
  eval(Server.Message<8388608)#conditions
 then 
  System.out.println("the current network is very good");#actions
end

Also, mvel is needed to make the "eval" statement work. In your case, it
might not be needed to work with eval at all.

WHEN Server.message <  should work as well. Providing you have an
attribute message in Server with a getter defined.

Regards,
Frank


赵慧 wrote:
> 
> hello,everyone! I wrote a rule with Drools, I compile the program and get
> the errors as follows: 
> 
> [3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate:
> {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
> [3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule
> package
> [7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule
> package in rule sample  
> 
> I don't know how it happened, looking forward to your reply! thank you !!! 
>  
> PS: My rules are here:
>  dialect "mvel"
> package  com.sample
> import com.sample.Server;
> 
> rule "system will execute 'tc' command"
>
>  when
> eval(Server.Message>8388608)
>  then 
>  System.out.println("The network is so crowd that it needs
> repairing.");
> Runtime.getRuntime().exec("tc");#give the authority and execute the
> "tc" command
> end
>  
> rule "caution"
> when 
> eval(Server.Message==8388608)
> then 
> System.out.println("caution!The network maybe will get blocked
> very soon.");
> end 
>  
> rule "fluent network"
>   when
>   eval(Server.Message<8388608)#conditions
>  then 
>   System.out.println("the current network is very good");#actions
> end
>  
>  
>   
> 
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-help-rule-rule-key-failed-to-predicate-tp2823695p2823722.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help! rule"rule_key" failed to predicate

2011-04-15 Thread 赵慧
 hello,everyone! I wrote a rule with Drools, I compile the program and get the 
errors as follows: 

[3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate: 
{(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
[3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule package
[7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule 
package in rule sample  

I don't know how it happened, looking forward to your reply! thank you !!! 
 
PS: My rules are here:
 dialect "mvel"
package  com.sample
import com.sample.Server;

rule "system will execute 'tc' command"
   
 when
eval(Server.Message>8388608)
 then 
 System.out.println("The network is so crowd that it needs repairing.");
Runtime.getRuntime().exec("tc");#give the authority and execute the "tc" 
command
end
 
rule "caution"
when 
eval(Server.Message==8388608)
then 
System.out.println("caution!The network maybe will get blocked very 
soon.");
end 
 
rule "fluent network"
  when
  eval(Server.Message<8388608)#conditions
 then 
  System.out.println("the current network is very good");#actions
end
 
 
  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help! rule"rule_key" failed to predicate

2011-04-12 Thread Wolfgang Laun
How can we help you if you don't show us the text of your .drl file?

All I can see is that the DRL parser could not find  "rule" (failing several
other alternatives) and then found the identifier "com" and didn't know what
to do with it.

This happens in line 4, position 0 (a misspelled "import"?) and 9 ("com").

-W

2011/4/13 赵慧 

> hi,thank you very much for helping me with the problem.nevertheless,I have
> got another error. I compile the program and get the errors as follows:
> [4,0]: [ERR 103] Line 4:0 rule 'rule_key' failed predicate:
> {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
> [4,9]: [ERR 101] Line 4:9 no viable alternative at input 'com' in rule
> package
>
>
>
> I don't know how it happened, looking forward to your reply! thank you !!!
>
>
>
>
>
>
>
> > Try adding 'dialect "mvel"' (no single quotes) after the rule name to the 
> > top of each of the rules.  I have seen this error before and doing this 
> > resolved the issue.
>
> >
> > >hello,everyone!I wrote a rule with Drools,but the error told me that the 
> > >field Server.Message is not visible, I can't find how it happens. Please
>
> > >help me, I am almost exhausted with it. thank you.
> > >the rules are as follows:
> > >
> > >package com.sample
> > >import com.sample.Server;
> > >
> > >rule "system will execute 'tc' command"
> > > when
> > >eval(Server.Message>8388608)
> > > then
> > > System.out.println("The network is so crowd that it needs 
> > > repairing.");
>
> > >  Runtime.getRuntime().exec("tc");#execute the "tc" command end
> > >
> > >rule "caution"
> > >when
> > >eval(Server.Message==8388608)
> > >then
> > >System.out.println("caution!The network maybe will get blocked 
> > > very soon."); end
>
> > >
> > >rule "fluent network"
> > >  when
> > >  eval(Server.Message<8388608)#conditions
> > > then
> > >  System.out.println("the current network is very good");
> > >  #actions
> > >end
> >
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help! rule"rule_key" failed to predicate

2011-04-12 Thread 赵慧
hi,thank you very much for helping me with the problem.nevertheless,I have got 
another error. I compile the program and get the errors as follows:
[4,0]: [ERR 103] Line 4:0 rule 'rule_key' failed predicate: 
{(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
[4,9]: [ERR 101] Line 4:9 no viable alternative at input 'com' in rule package
 
I don't know how it happened, looking forward to your reply! thank you !!!







> Try adding 'dialect "mvel"' (no single quotes) after the rule name to the top 
> of each of the rules.  I have seen this error before and doing this resolved 
> the issue. 
>  
> >hello,everyone!I wrote a rule with Drools,but the error told me that the 
> >field Server.Message is not visible, I can't find how it happens. Please  
> >help me, I am almost exhausted with it. thank you. 
> >the rules are as follows: 
> >  
> >package com.sample 
> >import com.sample.Server; 
> >  
> >rule "system will execute 'tc' command" 
> > when 
> >eval(Server.Message>8388608) 
> > then  
> > System.out.println("The network is so crowd that it needs repairing."); 
> >  Runtime.getRuntime().exec("tc");#execute the "tc" command end 
> >  
> >rule "caution" 
> >when  
> >eval(Server.Message==8388608) 
> >then  
> >System.out.println("caution!The network maybe will get blocked very 
> > soon."); end  
> >  
> >rule "fluent network" 
> >  when 
> >  eval(Server.Message<8388608)#conditions 
> > then 
> >  System.out.println("the current network is very good"); 
> >  #actions  
> >end 
>   
>  
> ___ 
> rules-users mailing list 
> rules-users@lists.jboss.org 
> https://lists.jboss.org/mailman/listinfo/rules-users 
>  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help! the field *** is not visible

2011-04-12 Thread Wolfgang Laun
Still, accessing the class field com.sample.Server.Message in eval() in this
way is almost certainly not a good approach.

But note that
   dialect "mvel"
may be written preceding all the rules it should apply to.

-W

On 12 April 2011 14:38, John Peterson wrote:

> Try adding 'dialect "mvel"' (no single quotes) after the rule name to the
> top of each of the rules.  I have seen this error before and doing this
> resolved the issue.
>
> >hello,everyone!I wrote a rule with Drools,but the error told me that the
> field Server.Message is not visible, I can't find how it happens. Please
> >help me, I am almost exhausted with it. thank you.
> >the rules are as follows:
> >
> >package com.sample
> >import com.sample.Server;
> >
> >rule "system will execute 'tc' command"
> > when
> >eval(Server.Message>8388608)
> > then
> > System.out.println("The network is so crowd that it needs
> repairing.");
> >  Runtime.getRuntime().exec("tc");#execute the "tc" command end
> >
> >rule "caution"
> >when
> >eval(Server.Message==8388608)
> >then
> >System.out.println("caution!The network maybe will get blocked
> very soon."); end
> >
> >rule "fluent network"
> >  when
> >  eval(Server.Message<8388608)#conditions
> > then
> >  System.out.println("the current network is very good");
> >  #actions
> >end
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help! the field *** is not visible

2011-04-12 Thread John Peterson
Try adding 'dialect "mvel"' (no single quotes) after the rule name to the top 
of each of the rules.  I have seen this error before and doing this resolved 
the issue.

>hello,everyone!I wrote a rule with Drools,but the error told me that the field 
>Server.Message is not visible, I can't find how it happens. Please 
>help me, I am almost exhausted with it. thank you.
>the rules are as follows:
> 
>package com.sample
>import com.sample.Server;
> 
>rule "system will execute 'tc' command"
> when
>eval(Server.Message>8388608)
> then 
> System.out.println("The network is so crowd that it needs repairing.");
>  Runtime.getRuntime().exec("tc");#execute the "tc" command end
> 
>rule "caution"
>when 
>eval(Server.Message==8388608)
>then 
>System.out.println("caution!The network maybe will get blocked very 
> soon."); end 
> 
>rule "fluent network"
>  when
>  eval(Server.Message<8388608)#conditions
> then
>  System.out.println("the current network is very good");
>  #actions 
>end
 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help! the field *** is not visible

2011-04-12 Thread Michael Anstis
A better approach would be to use:-

rule "system will execute 'tc' command"
 when
Server(message>8388608)
 then
 System.out.println("The network is so crowd that it needs repairing.");
  Runtime.getRuntime().exec("tc");#execute the "tc" command
end

This assumes you insert Server facts into working memory and they have a
"getMessage" property.

Normally you'd use eval when you are unable to leverage DRL. Their use is
normally discouraged. Also, your usage is incorrect; please read the
documentation.

With kind regards,

Mike

2011/4/12 赵慧 

>  hello,everyone!I wrote a rule with Drools,but the error told me that the
> field Server.Message is not visible, I can't find how it happens. Please
> help me, I am almost exhausted with it. thank you.
> the rules are as follows:
>
> package com.sample
> import com.sample.Server;
>
> rule "system will execute 'tc' command"
>  when
> eval(Server.Message>8388608)
>  then
>  System.out.println("The network is so crowd that it needs
> repairing.");
>   Runtime.getRuntime().exec("tc");#execute the "tc" command
> end
>
> rule "caution"
> when
> eval(Server.Message==8388608)
> then
> System.out.println("caution!The network maybe will get blocked very
> soon.");
> end
>
> rule "fluent network"
>   when
>   eval(Server.Message<8388608)#conditions
>  then
>   System.out.println("the current network is very good");#actions
> end
>
>
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help! the field *** is not visible

2011-04-11 Thread 赵慧


hello,everyone!I wrote a rule with Drools,but the error told me that the field 
Server.Message is not visible, I can't find how it happens. Please help me, I 
am almost exhausted with it. thank you.
the rules are as follows:
 
package com.sample
import com.sample.Server;
 
rule "system will execute 'tc' command"
 when
eval(Server.Message>8388608)
 then 
 System.out.println("The network is so crowd that it needs repairing.");
  Runtime.getRuntime().exec("tc");#execute the "tc" command
end
 
rule "caution"
when 
eval(Server.Message==8388608)
then 
System.out.println("caution!The network maybe will get blocked very 
soon.");
end 
 
rule "fluent network"
  when
  eval(Server.Message<8388608)#conditions
 then 
  System.out.println("the current network is very good");#actions
end
 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed in configuring drools guvnor with MySql

2011-04-07 Thread Nicolas Héron
Hello,
and does your procedure work for Postgres ?
Thanks
Nicolas

-
Nicolas Héron
--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-in-configuring-drools-guvnor-with-MySql-tp844676p2791862.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with Accumulate function

2011-04-07 Thread Dwipin C
Thanks Wolfgang. 

The issue here is that the accumulation has to happen at a higher level in
the object hierarchy, "Position" in this case. However, this is no direct
link between Position and PostitionPnlAttributionAmount ( which is being
accumulated). How do I tackle such a scenario?

$attibAmtType will be just one for the condition given, but there could be 
multiple $posPnlAmt within a Position. 

Thanks,
Dwipin



From:
Wolfgang Laun 
To:
Rules Users List 
Date:
04/07/2011 02:08 PM
Subject:
Re: [rules-users] Help with Accumulate function
Sent by:
rules-users-boun...@lists.jboss.org



Well, this explains it - you'll have to find the selecting combination
of $posPnlAmt and $attibAmtType in a unique way, assuming there is
just one such combination.

-W




2011/4/7 Dwipin C 
>
> Without the accumulate function, following is the fire occurrence-
>
> $position : Position() - 2
> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position 
) - 2 ( with all above facts)
> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn, 
currencyType == CurrencyTypes.TRANSACTIONAL) - 2 ( with all above facts)
> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD", 
positionScenarioCurrencyGroup == $posScnGrp) - 3 ( with all above facts)
>
> $attibAmtType : AttributionAmountType(attributionAmountType == 
"UNEXPLAINED/RESIDUALPNL") - 2 (just this fact)
>
> All of them together without the accumulate fires it 6 times.
>
>
> Dwipin
>
>
>
> From: Wolfgang Laun 
> To: Rules Users List 
> Date: 04/07/2011 01:16 PM
> Subject: Re: [rules-users] Help with Accumulate function
> Sent by: rules-users-boun...@lists.jboss.org
> 
>
>
> Repeated firing may be due to there being more than one scope for 
accumulating
> the sum, as selected by the patterns leading up to the accumulate.
>
> If you take only the patterns preceding the accumulate - how often does 
this fire and for which elements? You need a single combination of 
$posPnlAm and $attibAmtType.
>
> -W
>
>
> On 7 April 2011 08:44, dwipin  wrote:
> Hi,
>  I am having trouble implementing this rule with the accumulate 
function.
> My rule requirement is -
> Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED" for all
> Positions for a given day.
>
> Below is the code I have for this -
>
> $position : Position(date == $currDate)
> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position 
)
> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
> currencyType == CurrencyTypes.TRANSACTIONAL)
> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD",
> positionScenarioCurrencyGroup == $posScnGrp)
> $attibAmtType : AttributionAmountType(attributionAmountType ==
> "UNEXPLAINED/RESIDUALPNL")
>
> $totalPnlAttibAmt : BigDecimal()
>from accumulate(
>PositionPnlAttributionAmount(positionPnlAmount ==
> $posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :
> financialValue)
>,sum($pnlAttibAmt)
>)
>
> eval ($totalPnlAttibAmt > 1000)
>
> When I do it this way, the rule gets executed 6 times, basically for 
every
> fact that evaluated to true. How do I restrict this? The rule should be
> executed only if the final eval results in true.
>
> Thanks for any help,
> Dwipin.
>
>
> --
> View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html

> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> =-=-=
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


Re: [rules-users] Help with Accumulate function

2011-04-07 Thread Wolfgang Laun
One way to exclude siblings for a fact X is to use a constraint such
as "there is no other X with an identifying, comparable id < than the
only one I want".

  X( $id: id, $interesting: interesting )
  not X( id < $id )

-W


On 7 April 2011 10:37, Wolfgang Laun  wrote:
> Well, this explains it - you'll have to find the selecting combination
> of $posPnlAmt and $attibAmtType in a unique way, assuming there is
> just one such combination.
>
> -W
>
>
>
>
> 2011/4/7 Dwipin C 
>>
>> Without the accumulate function, following is the fire occurrence-
>>
>> $position : Position() - 2
>> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position ) - 
>> 2 ( with all above facts)
>> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn, 
>> currencyType == CurrencyTypes.TRANSACTIONAL) - 2 ( with all above facts)
>> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD", 
>> positionScenarioCurrencyGroup == $posScnGrp) - 3 ( with all above facts)
>>
>> $attibAmtType : AttributionAmountType(attributionAmountType == 
>> "UNEXPLAINED/RESIDUALPNL") - 2 (just this fact)
>>
>> All of them together without the accumulate fires it 6 times.
>>
>>
>> Dwipin
>>
>>
>>
>> From: Wolfgang Laun 
>> To: Rules Users List 
>> Date: 04/07/2011 01:16 PM
>> Subject: Re: [rules-users] Help with Accumulate function
>> Sent by: rules-users-boun...@lists.jboss.org
>> 
>>
>>
>> Repeated firing may be due to there being more than one scope for 
>> accumulating
>> the sum, as selected by the patterns leading up to the accumulate.
>>
>> If you take only the patterns preceding the accumulate - how often does this 
>> fire and for which elements? You need a single combination of $posPnlAm and 
>> $attibAmtType.
>>
>> -W
>>
>>
>> On 7 April 2011 08:44, dwipin  wrote:
>> Hi,
>>  I am having trouble implementing this rule with the accumulate function.
>> My rule requirement is -
>> Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED" for all
>> Positions for a given day.
>>
>> Below is the code I have for this -
>>
>> $position : Position(date == $currDate)
>> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position )
>> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
>> currencyType == CurrencyTypes.TRANSACTIONAL)
>> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD",
>> positionScenarioCurrencyGroup == $posScnGrp)
>> $attibAmtType : AttributionAmountType(attributionAmountType ==
>> "UNEXPLAINED/RESIDUALPNL")
>>
>> $totalPnlAttibAmt : BigDecimal()
>>        from accumulate(
>>                PositionPnlAttributionAmount(positionPnlAmount ==
>> $posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :
>> financialValue)
>>                ,sum($pnlAttibAmt)
>>        )
>>
>> eval ($totalPnlAttibAmt > 1000)
>>
>> When I do it this way, the rule gets executed 6 times, basically for every
>> fact that evaluated to true. How do I restrict this? The rule should be
>> executed only if the final eval results in true.
>>
>> Thanks for any help,
>> Dwipin.
>>
>>
>> --
>> View this message in context: 
>> http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html
>> Sent from the Drools - User mailing list archive at Nabble.com.
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> =-=-=
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain
>> confidential or privileged information. If you are
>> not the intended recipient, any dissemination, use,
>> review, distribution, printing or copying of the
>> information contained in this e-mail message
>> and/or attachments to it are strictly prohibited. If
>> you have received this communication in error,
>> please notify us by reply e-mail or telephone and
>> immediately and permanently delete the message
>> and any attachments. Thank you
>>
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with Accumulate function

2011-04-07 Thread Wolfgang Laun
Well, this explains it - you'll have to find the selecting combination
of $posPnlAmt and $attibAmtType in a unique way, assuming there is
just one such combination.

-W




2011/4/7 Dwipin C 
>
> Without the accumulate function, following is the fire occurrence-
>
> $position : Position() - 2
> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position ) - 
> 2 ( with all above facts)
> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn, 
> currencyType == CurrencyTypes.TRANSACTIONAL) - 2 ( with all above facts)
> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD", 
> positionScenarioCurrencyGroup == $posScnGrp) - 3 ( with all above facts)
>
> $attibAmtType : AttributionAmountType(attributionAmountType == 
> "UNEXPLAINED/RESIDUALPNL") - 2 (just this fact)
>
> All of them together without the accumulate fires it 6 times.
>
>
> Dwipin
>
>
>
> From: Wolfgang Laun 
> To: Rules Users List 
> Date: 04/07/2011 01:16 PM
> Subject: Re: [rules-users] Help with Accumulate function
> Sent by: rules-users-boun...@lists.jboss.org
> 
>
>
> Repeated firing may be due to there being more than one scope for accumulating
> the sum, as selected by the patterns leading up to the accumulate.
>
> If you take only the patterns preceding the accumulate - how often does this 
> fire and for which elements? You need a single combination of $posPnlAm and 
> $attibAmtType.
>
> -W
>
>
> On 7 April 2011 08:44, dwipin  wrote:
> Hi,
>  I am having trouble implementing this rule with the accumulate function.
> My rule requirement is -
> Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED" for all
> Positions for a given day.
>
> Below is the code I have for this -
>
> $position : Position(date == $currDate)
> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position )
> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
> currencyType == CurrencyTypes.TRANSACTIONAL)
> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD",
> positionScenarioCurrencyGroup == $posScnGrp)
> $attibAmtType : AttributionAmountType(attributionAmountType ==
> "UNEXPLAINED/RESIDUALPNL")
>
> $totalPnlAttibAmt : BigDecimal()
>        from accumulate(
>                PositionPnlAttributionAmount(positionPnlAmount ==
> $posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :
> financialValue)
>                ,sum($pnlAttibAmt)
>        )
>
> eval ($totalPnlAttibAmt > 1000)
>
> When I do it this way, the rule gets executed 6 times, basically for every
> fact that evaluated to true. How do I restrict this? The rule should be
> executed only if the final eval results in true.
>
> Thanks for any help,
> Dwipin.
>
>
> --
> View this message in context: 
> http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> =-=-=
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with Accumulate function

2011-04-07 Thread dwipin
The issue here is that the accumulation has to happen at a higher level in
the object hierarchy, "Position" in this case. However, this is no direct
link between Position and PostitionPnlAttributionAmount ( which is being
accumulated). How do I tackle such a scenario?

Thanks,
Dwipin.

--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789411.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with Accumulate function

2011-04-07 Thread Dwipin C
Without the accumulate function, following is the fire occurrence- 

$position : Position() - 2
$posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position ) 
- 2 ( with all above facts)
$posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn, 
currencyType == CurrencyTypes.TRANSACTIONAL) - 2 ( with all above facts)
$posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD", 
positionScenarioCurrencyGroup == $posScnGrp) - 3 ( with all above facts)

$attibAmtType : AttributionAmountType(attributionAmountType == 
"UNEXPLAINED/RESIDUALPNL") - 2 (just this fact)

All of them together without the accumulate fires it 6 times.


Dwipin




From:
Wolfgang Laun 
To:
Rules Users List 
Date:
04/07/2011 01:16 PM
Subject:
Re: [rules-users] Help with Accumulate function
Sent by:
rules-users-boun...@lists.jboss.org



Repeated firing may be due to there being more than one scope for 
accumulating
the sum, as selected by the patterns leading up to the accumulate.

If you take only the patterns preceding the accumulate - how often does 
this fire and for which elements? You need a single combination of 
$posPnlAm and $attibAmtType.

-W


On 7 April 2011 08:44, dwipin  wrote:
Hi,
 I am having trouble implementing this rule with the accumulate function.
My rule requirement is -
Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED" for all
Positions for a given day.

Below is the code I have for this -

$position : Position(date == $currDate)
$posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position )
$posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
currencyType == CurrencyTypes.TRANSACTIONAL)
$posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD",
positionScenarioCurrencyGroup == $posScnGrp)
$attibAmtType : AttributionAmountType(attributionAmountType ==
"UNEXPLAINED/RESIDUALPNL")

$totalPnlAttibAmt : BigDecimal()
   from accumulate(
   PositionPnlAttributionAmount(positionPnlAmount ==
$posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :
financialValue)
   ,sum($pnlAttibAmt)
   )

eval ($totalPnlAttibAmt > 1000)

When I do it this way, the rule gets executed 6 times, basically for every
fact that evaluated to true. How do I restrict this? The rule should be
executed only if the final eval results in true.

Thanks for any help,
Dwipin.


--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html

Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with Accumulate function

2011-04-07 Thread Wolfgang Laun
Repeated firing may be due to there being more than one scope for
accumulating
the sum, as selected by the patterns leading up to the accumulate.

If you take only the patterns preceding the accumulate - how often does this
fire and for which elements? You need a single combination of $posPnlAm and
$attibAmtType.

-W


On 7 April 2011 08:44, dwipin  wrote:

> Hi,
>  I am having trouble implementing this rule with the accumulate function.
> My rule requirement is -
> Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED" for all
> Positions for a given day.
>
> Below is the code I have for this -
>
> $position : Position(date == $currDate)
> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position )
> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
> currencyType == CurrencyTypes.TRANSACTIONAL)
> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD",
> positionScenarioCurrencyGroup == $posScnGrp)
> $attibAmtType : AttributionAmountType(attributionAmountType ==
> "UNEXPLAINED/RESIDUALPNL")
>
> $totalPnlAttibAmt : BigDecimal()
>from accumulate(
>PositionPnlAttributionAmount(positionPnlAmount ==
> $posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :
> financialValue)
>,sum($pnlAttibAmt)
>)
>
> eval ($totalPnlAttibAmt > 1000)
>
> When I do it this way, the rule gets executed 6 times, basically for every
> fact that evaluated to true. How do I restrict this? The rule should be
> executed only if the final eval results in true.
>
> Thanks for any help,
> Dwipin.
>
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help with Accumulate function

2011-04-06 Thread dwipin
Hi, 
  I am having trouble implementing this rule with the accumulate function.
My rule requirement is - 
Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED" for all
Positions for a given day. 

Below is the code I have for this - 

$position : Position(date == $currDate) 
$posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position ) 
$posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
currencyType == CurrencyTypes.TRANSACTIONAL) 
$posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD",
positionScenarioCurrencyGroup == $posScnGrp) 
$attibAmtType : AttributionAmountType(attributionAmountType ==
"UNEXPLAINED/RESIDUALPNL") 

$totalPnlAttibAmt : BigDecimal() 
from accumulate( 
PositionPnlAttributionAmount(positionPnlAmount ==
$posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :
financialValue) 
,sum($pnlAttibAmt) 
) 

eval ($totalPnlAttibAmt > 1000) 

When I do it this way, the rule gets executed 6 times, basically for every
fact that evaluated to true. How do I restrict this? The rule should be
executed only if the final eval results in true. 

Thanks for any help, 
Dwipin. 


--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] HELP - Problem creating package-validateUniqueRuleNames(PackageBuilder.java:830)

2011-03-04 Thread Saleem Lakhani
Sorry .. no use. I made those changes but nothing different. I'll try
5.2.

 

saleem

 

From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Friday, March 04, 2011 11:28 AM
To: Rules Users List
Subject: Re: [rules-users] HELP - Problem creating
package-validateUniqueRuleNames(PackageBuilder.java:830)

 

 

2011/3/4 Sale

This is my DSLR:

package cit.coverage;

expander Coverage.dsl

rule "rrr"

auto-focus true

when

He is nice

then

He is happy

end

This is my DSL Coverage.dsl:

[condition][]He is nice=eval(true)

[consequence][]He is happy=eval(System.out.println("HA HA"))

This is not a correct Java statement, as it should be for the
consequence:
   - eval() is not valid here
   - There is no semicolon at the end

This would be correct:

   [consequence][]He is happy=System.out.println("HA HA");

The NPE should be gone in 5.2.0.
-W

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] HELP - Problem creating package -validateUniqueRuleNames(PackageBuilder.java:830)

2011-03-04 Thread Wolfgang Laun
2011/3/4 Sale
>
> This is my DSLR:
>
> package cit.coverage;
>
> expander Coverage.dsl
>
> rule "rrr"
>
> auto-focus true
>
> when
>
> He is nice
>
> then
>
> He is happy
>
> end
>
> *This is my DSL** Coverage.dsl**:*
>
> [condition][]He is nice=eval(true)
>
> [consequence][]He is happy=eval(System.out.println("HA HA"))
>
This is not a correct Java statement, as it should be for the consequence:
   - eval() is not valid here
   - There is no semicolon at the end

This would be correct:
   [consequence][]He is happy=System.out.println("HA HA");

The NPE should be gone in 5.2.0.
-W
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] HELP - Problem creating package -validateUniqueRuleNames(PackageBuilder.java:830)

2011-03-04 Thread Saleem Lakhani
All my rules worked fine with Drools 3. NowI am trying to upgrade to
Drools 5.

I am using the following jar files to create binary (jar) files for my
rules from command line:

antlr-runtime.jar, drools-api.jar, drools-compiler.jar, drools-core.jar,
drools-decisiontables.jar, drools-jsr94.jar, drools-templates.jar,
janino-2.5.15.jar, joda-time.jar, jsr94.jar, jxl.jar, mvel2.jar,
xpp3.jar, xpp3_min.jar, xstream.jar,
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar


This is my DSLR:

package cit.coverage;
expander Coverage.dsl

rule "rrr"
auto-focus true
when
He is nice
then
He is happy
end

This is my DSL Coverage.dsl:

[condition][]He is nice=eval(true)
[consequence][]He is happy=eval(System.out.println("HA HA"))


I am trying to create binary(jars) using the following code:

KnowledgeBuilderConfiguration kbc =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbc.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilder builder = null;
builder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);

Reader drlSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDrlSourc
e()));  
//ruleset.getDrlSource() = com/cit/myDrl.dslr
Reader dslSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDslSourc
e()));

builder.add(ResourceFactory.newReaderResource(dslSource),
ResourceType.DSL);
builder.add(ResourceFactory.newReaderResource(drlSource),
ResourceType.DSLR); <-- problem
 
 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
 kbase.addKnowledgePackages(builder.getKnowledgePackages());


no matter what I type in my dslr (drl) file I get the following
exception on the highlighted line; 
I have 1 rule or 0 rule it still throws the same exception. Does it have
to do with any jar files?

Caused by: java.lang.NullPointerException
 at
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilde
r.java:830)
 at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:555)
 at
org.drools.compiler.PackageBuilder.addPackageFromDslr(PackageBuilder.jav
a:355)
 at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:461)
 at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)


saleem

-Original Message-
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Friday, March 04, 2011 2:14 AM
To: Rules Users List
Subject: Re: [rules-users] Problem creating package
-validateUniqueRuleNames(PackageBuilder.java:830)

It could be an error in the DSL file. Check for errors after *each*
builder.add(...).
-W


2011/3/4 Saleem Lakhani :
> Following is my code:
>
>
>
> KnowledgeBuilderConfiguration kbc =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
>
> kbc.setProperty("drools.dialect.java.compiler", "JANINO");
>
> KnowledgeBuilder builder = null;
>
> builder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
>
>
>
> Reader drlSource = new
>
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDrlSourc
e()));
> //ruleset.getDrlSource() = com/cit/myDrl.dslr
>
> Reader dslSource = new
>
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDslSourc
e()));
>
>
>
> builder.add(ResourceFactory.newReaderResource(dslSource),
ResourceType.DSL);
>
> builder.add(ResourceFactory.newReaderResource(drlSource),
> ResourceType.DSLR);
>
>
>
>  KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
>
>  kbase.addKnowledgePackages(builder.getKnowledgePackages());
>
>
>
>
>
> no matter what I type in my dslr (drl) file I get the following
exception on
> the highlighted line; ANY IDEA
>
> I have 1 rule or No rule it still throws the same exception. Does it
have to
> do with any jar files?
>
>
>
> Caused by: java.lang.NullPointerException
>
>  at
>
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilde
r.java:830)
>
>  at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:555)
>
>  at
>
org.drools.compiler.PackageBuilder.addPackageFromDslr(PackageBuilder.jav
a:355)
>
>  at
>
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:461)
>
>  at
>
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
>
>
>
>
>
> saleem
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help with diagnosing CEP performance issue

2010-12-26 Thread radai
ah, events werent being evicted because RHS was only evaluated during
fire(), which was after a batch.
i have altered my test code according to your suggestion, to look like this:

public void testLargeBatches() {
Node node1 = new Node("node 1");
node1.setId(1L);
s.insert(node1);

clock.advanceTime(1L, TimeUnit.DAYS);

int batchSize = 4;
int daysToRun = 10;
ArrayList batch = new ArrayList(batchSize);
ArrayList nodeIds = new ArrayList();
nodeIds.add(1L);
DateTime engineTime;

long start;
long accumulated = 0;
long currentTime;
long eventTime;
long delta;

System.err.println("days: "+daysToRun+". batch: "+batchSize+".
rules: "+ruleFile);

for (int i=0; i

> You are inserting a day's worth of backup events at a time. In this loop
> the engine is forced to evaluate both rules, for an ever-increasing number
> of events. It's the second rule that requires a comparison between any two
> backup events, and this causes a quadratic increment in processing time.
>
> CEP is short for "continuous event processing", and that's what you should
> let the engine do, i.e., not only evaluate the conditions but also the
> execute the consequences. This is done by calling fireAllRules() after each
> insertion. Alternatively, consider running fireUntilHalt() in once thread
> and insert in another thread.
>
> Ideally, the test should generate events ordered by time, and the
> pseudo-clock might be advanced due to the time stamp in the generated
> events. This would give you a very close approximation to a production run.
>
> -W
>
>
> 2010/12/26 radai 
>
> well, fixed now :-)
>> the benchmark (part of a junit) looks like this:
>>
>> protected void init() {
>> KnowledgeBuilderConfiguration bConf =
>> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
>> KnowledgeBuilder builder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder(bConf);
>> builder.add(...);
>>
>> KnowledgeBaseConfiguration kbConf =
>> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>> kbConf.setOption( EventProcessingOption.STREAM );
>> //todo - turn this on when
>> https://issues.jboss.org/browse/JBRULES-2845 is fixed
>> //kbConf.setOption( MultithreadEvaluationOption.YES );
>> kb = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
>> kb.addKnowledgePackages(builder.getKnowledgePackages());
>>
>> KnowledgeSessionConfiguration sConf =
>> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
>> sConf.setOption(ClockTypeOption.get("pseudo"));
>> Environment env = EnvironmentFactory.newEnvironment();
>> s = kb.newStatefulKnowledgeSession(sConf ,env);
>>
>> clock = (SessionPseudoClock) s.getSessionClock();
>>
>> backupStream = s.getWorkingMemoryEntryPoint("Backup Stream");
>> }
>>
>> followed by a test method that looks like this:
>>
>> public void testLargeBatches() {
>>
>> Node node1 = new Node("node 1");
>> node1.setId(1L);
>> s.insert(node1);
>> s.fireAllRules();
>>
>> clock.advanceTime(1L, TimeUnit.DAYS);
>> s.fireAllRules();
>>
>> int batchSize = 4;
>> int daysToRun = 1;
>> ArrayList batch = new ArrayList(batchSize);
>> ArrayList nodeIds = new ArrayList();
>> nodeIds.add(1L);
>> DateTime engineTime;
>>
>> long start;
>> long accumulated = 0;
>>
>> System.err.println("days: "+daysToRun+". batch: "+batchSize+".
>> rules: "+ruleFile);
>>
>> for (int i=0; i> engineTime = new DateTime(clock.getCurrentTime(),
>> DateTimeZone.UTC);
>> batch.clear();
>> //generate random
>> BackupGenerationUtil.fillBackupBatch(batch, nodeIds,
>> engineTime.minusHours(23).minusMinutes(59).minusSeconds(59),
>> engineTime.minusSeconds(1), batchSize);
>>
>> start = System.currentTimeMillis();
>>
>> //feed the batch in
>> for (Backup b : batch) {
>> backupStream.insert(b);
>> }
>>
>> //advance a day and run all rules
>> s.fireAllRules();
>> clock.advanceTime(1L, TimeUnit.DAYS);
>> s.fireAllRules();
>>
>> accumulated += (System.currentTimeMillis() - start);
>> }
>>
>> long averageBatchProcessingTime =
>> (long)(accumulated/(double)daysToRun);
>> double perBackupEventTime =
>> ((double)accumulated)/(batchSize*daysToRun);
>> int eventsPerSecond = (int)(1000D/perBackupEventTime);
>>
>> System.err.println("average batch processing time is
>> "+averageBatchProcessingTime+" which is "+perBackupEventTime+"/event or
>> "+eventsPerSecond+" events/second");
>> }
>>
>> running this with or without the 2nd "trimming" rules makes a huge
>> difference. on my machine i can run the non-trimming version i

Re: [rules-users] help with diagnosing CEP performance issue

2010-12-25 Thread Wolfgang Laun
You are inserting a day's worth of backup events at a time. In this loop the
engine is forced to evaluate both rules, for an ever-increasing number of
events. It's the second rule that requires a comparison between any two
backup events, and this causes a quadratic increment in processing time.

CEP is short for "continuous event processing", and that's what you should
let the engine do, i.e., not only evaluate the conditions but also the
execute the consequences. This is done by calling fireAllRules() after each
insertion. Alternatively, consider running fireUntilHalt() in once thread
and insert in another thread.

Ideally, the test should generate events ordered by time, and the
pseudo-clock might be advanced due to the time stamp in the generated
events. This would give you a very close approximation to a production run.

-W


2010/12/26 radai 

> well, fixed now :-)
> the benchmark (part of a junit) looks like this:
>
> protected void init() {
> KnowledgeBuilderConfiguration bConf =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
> KnowledgeBuilder builder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(bConf);
> builder.add(...);
>
> KnowledgeBaseConfiguration kbConf =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> kbConf.setOption( EventProcessingOption.STREAM );
> //todo - turn this on when
> https://issues.jboss.org/browse/JBRULES-2845 is fixed
> //kbConf.setOption( MultithreadEvaluationOption.YES );
> kb = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
> kb.addKnowledgePackages(builder.getKnowledgePackages());
>
> KnowledgeSessionConfiguration sConf =
> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> sConf.setOption(ClockTypeOption.get("pseudo"));
> Environment env = EnvironmentFactory.newEnvironment();
> s = kb.newStatefulKnowledgeSession(sConf ,env);
>
> clock = (SessionPseudoClock) s.getSessionClock();
>
> backupStream = s.getWorkingMemoryEntryPoint("Backup Stream");
> }
>
> followed by a test method that looks like this:
>
> public void testLargeBatches() {
>
> Node node1 = new Node("node 1");
> node1.setId(1L);
> s.insert(node1);
> s.fireAllRules();
>
> clock.advanceTime(1L, TimeUnit.DAYS);
> s.fireAllRules();
>
> int batchSize = 4;
> int daysToRun = 1;
> ArrayList batch = new ArrayList(batchSize);
> ArrayList nodeIds = new ArrayList();
> nodeIds.add(1L);
> DateTime engineTime;
>
> long start;
> long accumulated = 0;
>
> System.err.println("days: "+daysToRun+". batch: "+batchSize+".
> rules: "+ruleFile);
>
> for (int i=0; i engineTime = new DateTime(clock.getCurrentTime(),
> DateTimeZone.UTC);
> batch.clear();
> //generate random
> BackupGenerationUtil.fillBackupBatch(batch, nodeIds,
> engineTime.minusHours(23).minusMinutes(59).minusSeconds(59),
> engineTime.minusSeconds(1), batchSize);
>
> start = System.currentTimeMillis();
>
> //feed the batch in
> for (Backup b : batch) {
> backupStream.insert(b);
> }
>
> //advance a day and run all rules
> s.fireAllRules();
> clock.advanceTime(1L, TimeUnit.DAYS);
> s.fireAllRules();
>
> accumulated += (System.currentTimeMillis() - start);
> }
>
> long averageBatchProcessingTime =
> (long)(accumulated/(double)daysToRun);
> double perBackupEventTime =
> ((double)accumulated)/(batchSize*daysToRun);
> int eventsPerSecond = (int)(1000D/perBackupEventTime);
>
> System.err.println("average batch processing time is
> "+averageBatchProcessingTime+" which is "+perBackupEventTime+"/event or
> "+eventsPerSecond+" events/second");
> }
>
> running this with or without the 2nd "trimming" rules makes a huge
> difference. on my machine i can run the non-trimming version in batches of
> 300K @~2500 events/second @1GB RAM. with the trimming rule i cant get
> anywhere near that - the above value (40K) is already enough to slow it down
> to ~1800 events/second, and i dont understand whats so "heavy" about my
> attempt to save memory.
>
> any help/thoughts/clues would be most welcome.
>
>
> 2010/12/23 Mauricio Salatino 
>
>> hehe yes.. the same happens to "me" :)
>>
>> 2010/12/23 Wolfgang Laun 
>>
>> (OT: your nick "me" is confusing other gmail users. I see your mail as if
>>> I had sent it to myself. I was almost binning it.)
>>>
>>> The delay you see may depend on the way you run the test with 40K events.
>>> Please describe the sequence of insertions and calls to fire...(), the
>>> session setup (pseudo-clock, etc.)
>>>
>>> -W
>>>
>>>
>>> 2010/12/23 me 
>>>
  Hi.

 im trying to demo drools-fusion for a system that processes backup
 events.
 i have the following 2

Re: [rules-users] help with diagnosing CEP performance issue

2010-12-25 Thread radai
just to be clear, the "fixed" was only referring to my nick on gmail ... ;-)

On Sun, Dec 26, 2010 at 6:24 AM, radai  wrote:

> well, fixed now :-)
> the benchmark (part of a junit) looks like this:
>
> protected void init() {
> KnowledgeBuilderConfiguration bConf =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
> KnowledgeBuilder builder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(bConf);
> builder.add(...);
>
> KnowledgeBaseConfiguration kbConf =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> kbConf.setOption( EventProcessingOption.STREAM );
> //todo - turn this on when
> https://issues.jboss.org/browse/JBRULES-2845 is fixed
> //kbConf.setOption( MultithreadEvaluationOption.YES );
> kb = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
> kb.addKnowledgePackages(builder.getKnowledgePackages());
>
> KnowledgeSessionConfiguration sConf =
> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> sConf.setOption(ClockTypeOption.get("pseudo"));
> Environment env = EnvironmentFactory.newEnvironment();
> s = kb.newStatefulKnowledgeSession(sConf ,env);
>
> clock = (SessionPseudoClock) s.getSessionClock();
>
> backupStream = s.getWorkingMemoryEntryPoint("Backup Stream");
> }
>
> followed by a test method that looks like this:
>
> public void testLargeBatches() {
>
> Node node1 = new Node("node 1");
> node1.setId(1L);
> s.insert(node1);
> s.fireAllRules();
>
> clock.advanceTime(1L, TimeUnit.DAYS);
> s.fireAllRules();
>
> int batchSize = 4;
> int daysToRun = 1;
> ArrayList batch = new ArrayList(batchSize);
> ArrayList nodeIds = new ArrayList();
> nodeIds.add(1L);
> DateTime engineTime;
>
> long start;
> long accumulated = 0;
>
> System.err.println("days: "+daysToRun+". batch: "+batchSize+".
> rules: "+ruleFile);
>
> for (int i=0; i engineTime = new DateTime(clock.getCurrentTime(),
> DateTimeZone.UTC);
> batch.clear();
> //generate random
> BackupGenerationUtil.fillBackupBatch(batch, nodeIds,
> engineTime.minusHours(23).minusMinutes(59).minusSeconds(59),
> engineTime.minusSeconds(1), batchSize);
>
> start = System.currentTimeMillis();
>
> //feed the batch in
> for (Backup b : batch) {
> backupStream.insert(b);
> }
>
> //advance a day and run all rules
> s.fireAllRules();
> clock.advanceTime(1L, TimeUnit.DAYS);
> s.fireAllRules();
>
> accumulated += (System.currentTimeMillis() - start);
> }
>
> long averageBatchProcessingTime =
> (long)(accumulated/(double)daysToRun);
> double perBackupEventTime =
> ((double)accumulated)/(batchSize*daysToRun);
> int eventsPerSecond = (int)(1000D/perBackupEventTime);
>
> System.err.println("average batch processing time is
> "+averageBatchProcessingTime+" which is "+perBackupEventTime+"/event or
> "+eventsPerSecond+" events/second");
> }
>
> running this with or without the 2nd "trimming" rules makes a huge
> difference. on my machine i can run the non-trimming version in batches of
> 300K @~2500 events/second @1GB RAM. with the trimming rule i cant get
> anywhere near that - the above value (40K) is already enough to slow it down
> to ~1800 events/second, and i dont understand whats so "heavy" about my
> attempt to save memory.
>
> any help/thoughts/clues would be most welcome.
>
>
> 2010/12/23 Mauricio Salatino 
>
> hehe yes.. the same happens to "me" :)
>>
>> 2010/12/23 Wolfgang Laun 
>>
>> (OT: your nick "me" is confusing other gmail users. I see your mail as if
>>> I had sent it to myself. I was almost binning it.)
>>>
>>> The delay you see may depend on the way you run the test with 40K events.
>>> Please describe the sequence of insertions and calls to fire...(), the
>>> session setup (pseudo-clock, etc.)
>>>
>>> -W
>>>
>>>
>>> 2010/12/23 me 
>>>
  Hi.

 im trying to demo drools-fusion for a system that processes backup
 events.
 i have the following 2 CEP rules:

 rule "Backup Not Succeeded For At Least 3 Days"
 @ruleId(1)
 when
 Node($id : id)
 not ( Backup(clientId == $id, $state: state ==
 BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point "Backup
 Stream" )
 then
 //nothing for now
 end

 rule "Prune Previous Successful Backups"
 @ruleId(2)
 when
 $prevBackup  : Backup($id : clientId,  state ==
 BackupStateEnum.FINISHED) from entry-point "Backup Stream"
 $newerBackup : Backup(clientId == $id, state ==
 BackupStateEnum.FINISHED, this after $prevBackup) from entry-point "Backup
 Stream"
 then
 drools.retract($prevBackup);
 end

 rule 

Re: [rules-users] help with diagnosing CEP performance issue

2010-12-25 Thread radai
well, fixed now :-)
the benchmark (part of a junit) looks like this:

protected void init() {
KnowledgeBuilderConfiguration bConf =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder(bConf);
builder.add(...);

KnowledgeBaseConfiguration kbConf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbConf.setOption( EventProcessingOption.STREAM );
//todo - turn this on when
https://issues.jboss.org/browse/JBRULES-2845 is fixed
//kbConf.setOption( MultithreadEvaluationOption.YES );
kb = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
kb.addKnowledgePackages(builder.getKnowledgePackages());

KnowledgeSessionConfiguration sConf =
KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
sConf.setOption(ClockTypeOption.get("pseudo"));
Environment env = EnvironmentFactory.newEnvironment();
s = kb.newStatefulKnowledgeSession(sConf ,env);

clock = (SessionPseudoClock) s.getSessionClock();

backupStream = s.getWorkingMemoryEntryPoint("Backup Stream");
}

followed by a test method that looks like this:

public void testLargeBatches() {

Node node1 = new Node("node 1");
node1.setId(1L);
s.insert(node1);
s.fireAllRules();

clock.advanceTime(1L, TimeUnit.DAYS);
s.fireAllRules();

int batchSize = 4;
int daysToRun = 1;
ArrayList batch = new ArrayList(batchSize);
ArrayList nodeIds = new ArrayList();
nodeIds.add(1L);
DateTime engineTime;

long start;
long accumulated = 0;

System.err.println("days: "+daysToRun+". batch: "+batchSize+".
rules: "+ruleFile);

for (int i=0; i

> hehe yes.. the same happens to "me" :)
>
> 2010/12/23 Wolfgang Laun 
>
> (OT: your nick "me" is confusing other gmail users. I see your mail as if I
>> had sent it to myself. I was almost binning it.)
>>
>> The delay you see may depend on the way you run the test with 40K events.
>> Please describe the sequence of insertions and calls to fire...(), the
>> session setup (pseudo-clock, etc.)
>>
>> -W
>>
>>
>> 2010/12/23 me 
>>
>>>  Hi.
>>>
>>> im trying to demo drools-fusion for a system that processes backup
>>> events.
>>> i have the following 2 CEP rules:
>>>
>>> rule "Backup Not Succeeded For At Least 3 Days"
>>> @ruleId(1)
>>> when
>>> Node($id : id)
>>> not ( Backup(clientId == $id, $state: state ==
>>> BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point "Backup
>>> Stream" )
>>> then
>>> //nothing for now
>>> end
>>>
>>> rule "Prune Previous Successful Backups"
>>> @ruleId(2)
>>> when
>>> $prevBackup  : Backup($id : clientId,  state ==
>>> BackupStateEnum.FINISHED) from entry-point "Backup Stream"
>>> $newerBackup : Backup(clientId == $id, state ==
>>> BackupStateEnum.FINISHED, this after $prevBackup) from entry-point "Backup
>>> Stream"
>>> then
>>> drools.retract($prevBackup);
>>> end
>>>
>>> rule #2 is my attempt to cut down on memory usage. the problem is that
>>> rule #2 slows down the processing very very considerably (2 orders of
>>> magnitude slower when simulating batches of 40K events/day).
>>>
>>> what would be my next step in trying to find the reason for it? my
>>> intuition tells me that with 2 events in the system at any given time
>>> instead of 120K (single node, 40K events/day 3 day window) i should have
>>> seen either a speedup or reduced memory consumption (if not both) and yet
>>> the results im seeing are the exact opposite.
>>> is there anything im missing ? i could try adding some sort of
>>> LastSuccessfulBackup "marker" object into main memory and updating it using
>>> events from the backup stream, but then how would i express rule #1 ?
>>>
>>> any help/clues/suggestions would be greatly appreciated,
>>>
>>>radai.
>>>
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
>  - CTO @ http://www.plugtree.com
>  - MyJourney @ http://salaboy.wordpress.com
>  - Co-Founder @ http://www.jbug.com.ar
>
>  - Salatino "Salaboy" Mauricio -
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help with diagnosing CEP performance issue

2010-12-23 Thread Mauricio Salatino
hehe yes.. the same happens to "me" :)

2010/12/23 Wolfgang Laun 

> (OT: your nick "me" is confusing other gmail users. I see your mail as if I
> had sent it to myself. I was almost binning it.)
>
> The delay you see may depend on the way you run the test with 40K events.
> Please describe the sequence of insertions and calls to fire...(), the
> session setup (pseudo-clock, etc.)
>
> -W
>
>
> 2010/12/23 me 
>
>> Hi.
>>
>> im trying to demo drools-fusion for a system that processes backup events.
>>
>> i have the following 2 CEP rules:
>>
>> rule "Backup Not Succeeded For At Least 3 Days"
>> @ruleId(1)
>> when
>> Node($id : id)
>> not ( Backup(clientId == $id, $state: state ==
>> BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point "Backup
>> Stream" )
>> then
>> //nothing for now
>> end
>>
>> rule "Prune Previous Successful Backups"
>> @ruleId(2)
>> when
>> $prevBackup  : Backup($id : clientId,  state ==
>> BackupStateEnum.FINISHED) from entry-point "Backup Stream"
>> $newerBackup : Backup(clientId == $id, state ==
>> BackupStateEnum.FINISHED, this after $prevBackup) from entry-point "Backup
>> Stream"
>> then
>> drools.retract($prevBackup);
>> end
>>
>> rule #2 is my attempt to cut down on memory usage. the problem is that
>> rule #2 slows down the processing very very considerably (2 orders of
>> magnitude slower when simulating batches of 40K events/day).
>>
>> what would be my next step in trying to find the reason for it? my
>> intuition tells me that with 2 events in the system at any given time
>> instead of 120K (single node, 40K events/day 3 day window) i should have
>> seen either a speedup or reduced memory consumption (if not both) and yet
>> the results im seeing are the exact opposite.
>> is there anything im missing ? i could try adding some sort of
>> LastSuccessfulBackup "marker" object into main memory and updating it using
>> events from the backup stream, but then how would i express rule #1 ?
>>
>> any help/clues/suggestions would be greatly appreciated,
>>
>>radai.
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help with diagnosing CEP performance issue

2010-12-23 Thread Wolfgang Laun
(OT: your nick "me" is confusing other gmail users. I see your mail as if I
had sent it to myself. I was almost binning it.)

The delay you see may depend on the way you run the test with 40K events.
Please describe the sequence of insertions and calls to fire...(), the
session setup (pseudo-clock, etc.)

-W


2010/12/23 me 

> Hi.
>
> im trying to demo drools-fusion for a system that processes backup events.
> i have the following 2 CEP rules:
>
> rule "Backup Not Succeeded For At Least 3 Days"
> @ruleId(1)
> when
> Node($id : id)
> not ( Backup(clientId == $id, $state: state ==
> BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point "Backup
> Stream" )
> then
> //nothing for now
> end
>
> rule "Prune Previous Successful Backups"
> @ruleId(2)
> when
> $prevBackup  : Backup($id : clientId,  state ==
> BackupStateEnum.FINISHED) from entry-point "Backup Stream"
> $newerBackup : Backup(clientId == $id, state ==
> BackupStateEnum.FINISHED, this after $prevBackup) from entry-point "Backup
> Stream"
> then
> drools.retract($prevBackup);
> end
>
> rule #2 is my attempt to cut down on memory usage. the problem is that rule
> #2 slows down the processing very very considerably (2 orders of magnitude
> slower when simulating batches of 40K events/day).
>
> what would be my next step in trying to find the reason for it? my
> intuition tells me that with 2 events in the system at any given time
> instead of 120K (single node, 40K events/day 3 day window) i should have
> seen either a speedup or reduced memory consumption (if not both) and yet
> the results im seeing are the exact opposite.
> is there anything im missing ? i could try adding some sort of
> LastSuccessfulBackup "marker" object into main memory and updating it using
> events from the backup stream, but then how would i express rule #1 ?
>
> any help/clues/suggestions would be greatly appreciated,
>
>radai.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help with diagnosing CEP performance issue

2010-12-23 Thread me
Hi.

im trying to demo drools-fusion for a system that processes backup events.
i have the following 2 CEP rules:

rule "Backup Not Succeeded For At Least 3 Days"
@ruleId(1)
when
Node($id : id)
not ( Backup(clientId == $id, $state: state == BackupStateEnum.FINISHED)
over window:time( 3d ) from entry-point "Backup Stream" )
then
//nothing for now
end

rule "Prune Previous Successful Backups"
@ruleId(2)
when
$prevBackup  : Backup($id : clientId,  state ==
BackupStateEnum.FINISHED) from entry-point "Backup Stream"
$newerBackup : Backup(clientId == $id, state ==
BackupStateEnum.FINISHED, this after $prevBackup) from entry-point "Backup
Stream"
then
drools.retract($prevBackup);
end

rule #2 is my attempt to cut down on memory usage. the problem is that rule
#2 slows down the processing very very considerably (2 orders of magnitude
slower when simulating batches of 40K events/day).

what would be my next step in trying to find the reason for it? my intuition
tells me that with 2 events in the system at any given time instead of 120K
(single node, 40K events/day 3 day window) i should have seen either a
speedup or reduced memory consumption (if not both) and yet the results im
seeing are the exact opposite.
is there anything im missing ? i could try adding some sort of
LastSuccessfulBackup "marker" object into main memory and updating it using
events from the backup stream, but then how would i express rule #1 ?

any help/clues/suggestions would be greatly appreciated,

   radai.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help required for Rule Creation

2010-12-14 Thread Wolfgang Laun
Usually creation times are in seconds (starting at some Epoch) and therefore
all you have to do
is ascertain that two integers don't differ by more than 30:

$first: File( pathname matches ..., $ct: creationTime )
$later: File( creationTime < ($ct + 30) )

-W


On 14 December 2010 09:37,  wrote:

> Hi,
>
> I want to create a rule for the following scenario:
>
> 1. Event 1 : A file was created under the directory "/root/ " (Comment:
> I have implemented this using 'matches' in the rule file)
> 2. Event 2: If File was created under "/root/" then get all the files
> created within a 30 seconds of Event1. (Comment: Confused! Don't know
> how to do this!)
>
> The dataset I have is of all the files created on the system + time of
> creation.
>
> Thanks in advance!
>
> Rgds,
> Kiran
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help required for Rule Creation

2010-12-14 Thread kiran.nair
Hi,

I want to create a rule for the following scenario:

1. Event 1 : A file was created under the directory "/root/ " (Comment:
I have implemented this using 'matches' in the rule file)
2. Event 2: If File was created under "/root/" then get all the files
created within a 30 seconds of Event1. (Comment: Confused! Don't know
how to do this!)

The dataset I have is of all the files created on the system + time of
creation.

Thanks in advance!

Rgds,
Kiran

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help

2010-11-15 Thread Mauricio Salatino
lol

2010/11/15 Esteban Aliverti 

> You forgot to put the message in the bottle! ;)
>
> 
>
> Esteban Aliverti
> - Developer @ http://www.plugtree.com
> - Blog @ http://ilesteban.wordpress.com
>
>
> 2010/11/15 Roess. Oliver 
>
>
>>
>>
>> _
>>
>> SEEBURGER AGVorstand/Seeburger Executive
>> Board:
>> Sitz der Gesellschaft/  Bernd Seeburger, Axel Haas,
>> Michael Kleeberg
>> Registered Office:
>> Edisonstrasse 1 Vorsitzender des
>> Aufsichtsrats/Chairperson of
>> D-75015 Bretten the Seeburger Supervisory Board:
>> Tel.: 07252 / 96-0  Dr. Franz Scherer
>> Fax:  07252 / 96-
>> Internet: http://www.seeburger.de   Registergericht/Commercial
>> Register:
>> e-mail: i...@seeburger.de   HRB 240708 Mannheim
>> _
>>
>> Dieses E-Mail ist nur fur den Empfanger bestimmt, an den es gerichtet
>> ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes
>> Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs-
>> au?erung ist die des Autors und stellt nicht notwendigerweise die
>> Sind Sie nicht der Empfanger, so haben Sie diese E-Mail irrtumlich
>> erhalten und jegliche Verwendung, Veroffentlichung, Weiterleitung,
>> Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt.
>> Weder die  noch der Absender (Oliver Roess)
>> ubernehmen die Haftung fur Viren; es obliegt Ihrer Verantwortung,
>> die E-Mail und deren Anhange (0) auf Viren zu prufen.
>>
>> The present email addresses only the addressee which it targets and
>> may contain confidential material that may be protected by the
>> professional secret. The opinions reflected herein are not necessarily
>> If you are not the addressee, you have accidentally got this email and
>> are not enabled to use, publish, forward, copy or print it in any way.
>> Neither the , nor the sender (Oliver Roess) are
>> liable for viruses, being your own responsibility to check this email
>> and its attachments (0) for this purpose.
>> _
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] help

2010-11-15 Thread Esteban Aliverti
You forgot to put the message in the bottle! ;)



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2010/11/15 Roess. Oliver 

>
>
>
> _
>
> SEEBURGER AGVorstand/Seeburger Executive Board:
> Sitz der Gesellschaft/  Bernd Seeburger, Axel Haas, Michael
> Kleeberg
> Registered Office:
> Edisonstrasse 1 Vorsitzender des
> Aufsichtsrats/Chairperson of
> D-75015 Bretten the Seeburger Supervisory Board:
> Tel.: 07252 / 96-0  Dr. Franz Scherer
> Fax:  07252 / 96-
> Internet: http://www.seeburger.de   Registergericht/Commercial
> Register:
> e-mail: i...@seeburger.de   HRB 240708 Mannheim
> _
>
> Dieses E-Mail ist nur fur den Empfanger bestimmt, an den es gerichtet
> ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes
> Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs-
> au?erung ist die des Autors und stellt nicht notwendigerweise die
> Sind Sie nicht der Empfanger, so haben Sie diese E-Mail irrtumlich
> erhalten und jegliche Verwendung, Veroffentlichung, Weiterleitung,
> Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt.
> Weder die  noch der Absender (Oliver Roess)
> ubernehmen die Haftung fur Viren; es obliegt Ihrer Verantwortung,
> die E-Mail und deren Anhange (0) auf Viren zu prufen.
>
> The present email addresses only the addressee which it targets and
> may contain confidential material that may be protected by the
> professional secret. The opinions reflected herein are not necessarily
> If you are not the addressee, you have accidentally got this email and
> are not enabled to use, publish, forward, copy or print it in any way.
> Neither the , nor the sender (Oliver Roess) are
> liable for viruses, being your own responsibility to check this email
> and its attachments (0) for this purpose.
> _
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] help

2010-11-15 Thread Roess. Oliver



_

SEEBURGER AGVorstand/Seeburger Executive Board:
Sitz der Gesellschaft/  Bernd Seeburger, Axel Haas, Michael 
Kleeberg
Registered Office:
Edisonstrasse 1 Vorsitzender des 
Aufsichtsrats/Chairperson of
D-75015 Bretten the Seeburger Supervisory Board:
Tel.: 07252 / 96-0  Dr. Franz Scherer
Fax:  07252 / 96-
Internet: http://www.seeburger.de   Registergericht/Commercial Register:
e-mail: i...@seeburger.de   HRB 240708 Mannheim
_

Dieses E-Mail ist nur fur den Empfanger bestimmt, an den es gerichtet 
ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes
Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs-
au?erung ist die des Autors und stellt nicht notwendigerweise die
Sind Sie nicht der Empfanger, so haben Sie diese E-Mail irrtumlich
erhalten und jegliche Verwendung, Veroffentlichung, Weiterleitung,
Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt.
Weder die  noch der Absender (Oliver Roess)
ubernehmen die Haftung fur Viren; es obliegt Ihrer Verantwortung,
die E-Mail und deren Anhange (0) auf Viren zu prufen.

The present email addresses only the addressee which it targets and
may contain confidential material that may be protected by the
professional secret. The opinions reflected herein are not necessarily
If you are not the addressee, you have accidentally got this email and
are not enabled to use, publish, forward, copy or print it in any way.
Neither the , nor the sender (Oliver Roess) are
liable for viruses, being your own responsibility to check this email
and its attachments (0) for this purpose.
_

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help me understand this drools exception

2010-11-11 Thread murphy

You should enable the option for dump creation with:
-Ddrools.dump.dir="yourDirectory"
so you can take a look at the generated code
(Process_com_test_sample_0.java) and maybe debug it.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-me-understand-this-drools-exception-tp1869650p1881997.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed in activationCreated and activationCanceled event

2010-11-04 Thread Michael Anstis
Please don't email me direct. I won't reply in the future. All questions and
answers are of value to the community as a whole.

To quote what I replied to an almost identical request a couple of days ago
and posted to the drools-user mailing list.

"AFAIK, Activation Cancelled events would trigger in reaction to the
revocation of a logically inserted fact that caused an activation to trigger
in the first place. It would not help identifying which pattern in a rule
was not matched causing your rule not to activate".

On 4 November 2010 14:41,  wrote:

> Hi, thanks for helping me out with that code. i have one more question, in
> activation cancelled event, it never gets executed.
>
> @Override
>public void activationCancelled(ActivationCancelledEvent
> event) {
>final Rule rule = event.getActivation().getRule();
>final String ruleName = rule.getName();
>System.out.println("Activation cancelled --> " +
> ruleName);
>rules.add(rule);
>ruleNames.add(ruleName);
>}
>
>
> @Override
>public void activationCreated(ActivationCreatedEvent event)
> {
>final Rule rule = event.getActivation().getRule();
>final String ruleName = rule.getName();
>System.out.println("Activation created --> " +
> ruleName);
>rules.remove(rule);
>ruleNames.remove(ruleName);
>}
>
>
> but my output never show this. i only have Activation created printed in
> console. which rule is not executed, that is not printing at the time when
> it is not activated. Please have a look on this.  My output is
>
> Rules not executed
> - GoodBye-rule
> - Hello World-rule
> - Never fires
> Activation created --> Hello World-rule
> Hello World
> Activation created --> GoodBye-rule
> Goodbye cruel world
> Rules not executed
> - Never fires
>
>
> this is the same code which you sent me. Never fires is the rule which
> never gets executed. we print this from the list of rules we have when we
> load the rule file. even if i skip that activation canceled it prints the
> same result.
>
>
> thanks
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help require for "web actor" related task

2010-09-28 Thread Ashish.zokarkar

Hello Guys,

I am able to treat "Human Task" as web actor. What I did is, I created a new
WorkItemHandler and when I submit the jsp, in jsp I wrote code to complete
the work item.

But conceptually still i have doubts:
1. I can able to register WorkItemHandler with name "Human task" which by
default take "WorkItemImpl" and "DefaultWorkitemmaneger" as workItem amd
manager respectively. I want to register my own Work Item. How can I
register it? 
Any code snippet will be really helpful.

Thank you very much in advance.

Ashish zokarkat
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-require-for-web-actor-related-task-tp1572753p1594689.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help require for "web actor" related task

2010-09-24 Thread Ashish.zokarkar

Hello,
I am newbie for Drools flow. I am trying to build work flow in which
according to condition I have to ask either person properties or user
properties. 
I am trying to embed it in web project. So I created 3 jsps.
1. Ask information about User or Product.
2. According to selection shows different options.
3. Display all the properties.

What I am trying is, remove all the forwards from jsp and put them in
workflow so that its easily supportable for new object as well.

I think I should use "Human Task" where I am taking user input.

Now i have below questions:
1. I am trying to use "Human Task". But I can see it supports only Web
Service Human task. Is it true???
2. How can I use "Human Task" in this situation? In examples, I can see, I
require EntityManagerFactory, mina Task which should run on some port. Is
these steps really necessary???
3. I am trying really simple POC where I require kind of web actor which
should wait till user click on "Submit" button and then proceed to next
step. Is any similar kind of support Drools have?? If yes how can i use it??
Small code snippets or doc link will be very helpful...

Thank you very much in advance..

Ashish Zokarkar
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-require-for-web-actor-related-task-tp1572753p1572753.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help : How do I retrieve the repository or uuid of assets from java code?

2010-09-01 Thread Han Ming Low
Hi,

I'm trying to construct a url in the format
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/Guvnor.html#asset=4dae7ddf-4d97-4e6b-ab07-b0f5e9d41d9c
by replacing the #asset=[uuid]

Thus, I would need to know the uuid of each asset in the repository.

I have tried to use the following code

Repository repository;
JCRRepositoryConfigurator configurator = new
JackrabbitRepositoryConfigurator();
repository = configurator.getJCRRepository(
"C:\\Programs\\Drools\\5.1\\jboss-4.2.3.GA\\repository\\" );
Session jcrsession = repository.login(new SimpleCredentials("admin",
"admin1".toCharArray()));
RulesRepository rrepository = new RulesRepository(jcrsession);
or

RulesRepository rrepository = RepositorySessionUtil.getRepository();

My drools persistence is set to MySQL.
So, RepositorySessionUtil.getRepository() kind of work but because it is
retrieving from a new repository, so it does not serve the purpose.

When I put the code above into a jsp in exploded drools-guvnor.war in jboss,
I have the following error.

org.drools.repository.RulesRepositoryException:
javax.jcr.RepositoryException: The repository home C:\Programs\Drools\5.1\
jboss-4.2.3.GA\bin\repository appears to be in use since the file named
.lock is already locked by the current process.
 
org.drools.repository.RepositorySessionUtil.getRepository(RepositorySessionUtil.java:90)
 org.apache.jsp.test_jsp._jspService(test_jsp.java:105)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
 
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
 org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

But, I'm not even sure if what I'm trying to do is correct.
What I want to do is to be able to retrieve the uuid of the assets in
repository from a web application.
Can someone please help in providing a snippet of code or point me in some
direction on what should I retrieve in order to query the repository.

Thanks.


Han Ming
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help needed in Rule flow in Guvnor

2010-08-09 Thread Vignesh

Hi,

I am using Rule flow in Guvnor for setting some value out of the flow which
would be used for my further processing. Below is what I'm trying to
achieve,

I have two rule groups in the rule flow, out of which the first one would
set a  pair in a Map which is a field in one of the bean class
declared Global for the package when ever each rule is executed in the set
of rules in the group and the next rule group would be required to have a
set of rules that needs to be executed against this Map which was set in the
first rules group and send the final result as output out of the flow.

I have defined the rules in the first rule group and set the Map with
necessary keys and values, but I was not able to read the Map in this second
rule group. I had tried this second rule group as a custom java code in my
Java part after the rules execution from guvnor and able to read the map
that was set from the first rule group and able set the final decision.

I want to know whether reading the Map from the second rule group which was
set in the first rule group is possible or not. Or kindly let me know
whether I'm missing anything here and needed to add any other logic to
achieve the same.

Thanks,
Vignesh
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-needed-in-Rule-flow-in-Guvnor-tp1059410p1059410.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help regarding populating values from presentation layer into Fact Typpes in drools

2010-08-04 Thread Swapnil Sawant

Hi,

In drools, I have seen that following functionalities have been implemented :


-  Creating a fact type which can be used in a rule

-  Creating rule by declaring functions or by using DSL

-  Testing the rule using test scenario


Here, I had a question regarding decoupling of fact types between my 
application and drools.

I wanted to whether writing a java code for adding values from 
form/database(i.e. my application) into fact types of drools package which I 
have created is must or is there any automated way for doing this ?

For example,

If new rule gets added which will result in changing fact (either modify 
existing or add new fact).
In this case one has to  write a code for populating presentation layer values 
into this newly modified/created fact type. Can this be automated..?

>From client support perspective -How to manage addition of New Rule to 
>existing Rule base..?


Thanks & Regards,
Swapnil Sawant | iLabs | L & T Infotech

Plot no. EL - 200,TTC Electronic Zone,Shil-Mahape road,Navi Mumbai - 400 701
Extn: +91 22 6795  4325
Mail: swapnil.saw...@lntinfotech.com

www.lntinfotech.com



This Email may contain confidential or privileged information for the intended 
recipient (s) If you are not the intended recipient, please do not use or 
disseminate the information, notify the sender and delete it from your system.

_
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help : Enabling Role Base Authorization in Guvnor

2010-08-03 Thread Han Ming Low
Hi Jervis,

Thanks for the reply.

Yes, this solve the problem.

Thanks again.


Han Ming

On Mon, Aug 2, 2010 at 2:24 PM, Jervis Liu  wrote:

> Hi, the rolesProperties file (eg,  guvnor-roles.properties) configured
> in JBoss AS is not used by Guvnor authorization. Before you enable
> enable-role-based-authorization, you need to login and configure user
> permissions in Guvnor "Administration". For example, you need to give
> your "admin" user a full admin permission.
>
> Hope this helps,
> Jervis
>
> Han Ming Low wrote:
> > Hi all,
> >
> > I try to enable the Role Base Authorization in Guvnor after it was
> > running fine with the default login mechanism.
> > But, encountered some problem with the attempt.
> >
> > What I did was that in the components.xml,
> > - commented out the default  > authenticate-method="#{defaultAuthenticator.authenticate}"/>
> > - uncomment the  > authenticate-method="#{authenticator.authenticate}"
> > jaas-config-name="other"/>
> > - change the role base authorization to true,
> >  > enable-role-based-authorization="true"/>
> >
> > And at the login-config.xml
> > I have changed the "other" application policy to
> > 
> >
> >> "org.jboss.security.auth.spi.UsersRolesLoginModule"
> >  flag = "required" >
> > > name="usersProperties">props/guvnor-users.properties
> > > name="rolesProperties">props/guvnor-roles.properties
> >   
> >
> > 
> >
> > guvnor-users.properties
> > admin=admin12
> > krisv=krisv
> > john=john
> > mary=mary
> >
> > guvnor-roles.properties
> > admin=admin
> > krisv=admin,manager,user
> > john=admin,manager,user
> > mary=admin,manager,user
> >
> > After restarting JBoss, I can login based on the user and password
> > defined in the guvnor-users.properties.
> > And, by changing the password in the properties, I verified that it is
> > taking in the value from the file itself.
> >
> > However, when I login as user admin and tried to access the
> > Administration | User Permission or Event Log,
> > I'm prompt "Sorry, insufficient permissions to perform this action."
> >
> > The error from the console is
> > 11:15:36,046 INFO  [STDOUT] ERROR 29-07 11:15:36,046
> > (LoggingHelper.java:error:76)
> > Service method 'public abstract java.util.Map
> > org.drools.guvnor.client.rpc.RepositoryService.listUserPermissions()
> >throws
> > org.drools.guvnor.client.rpc.DetailedSerializationException'
> >threw an unexpected exception:
> > org.jboss.seam.security.AuthorizationException:
> >  Authorization check failed for
> > permission[org.drools.guvnor.server.security.admint...@bf7a4d,admin]
> > org.jboss.seam.security.AuthorizationException: Authorization check
> > failed for
> > permission[org.drools.guvnor.server.security.admint...@bf7a4d,admin]
> > at
> > org.jboss.seam.security.Identity.checkPermission(Identity.java:581)
> > at
> >
> org.drools.guvnor.server.ServiceImplementation.listUserPermissions(ServiceImplementation.java:2604)
> > .
> >
> > Checking on the org.drools.guvnor.server.security.RoleTypes code, the
> > available role should be
> > admin
> > analyst
> > analyst.readonly
> > package.admin
> > package.developer
> > package.readonly
> >
> > Can anyone help to let me know what's wrong with my configuration?
> >
> > Thanks.
> >
> >
> > Han Ming
> > 
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help : Enabling Role Base Authorization in Guvnor

2010-08-01 Thread Jervis Liu
Hi, the rolesProperties file (eg,  guvnor-roles.properties) configured 
in JBoss AS is not used by Guvnor authorization. Before you enable 
enable-role-based-authorization, you need to login and configure user 
permissions in Guvnor "Administration". For example, you need to give 
your "admin" user a full admin permission.

Hope this helps,
Jervis

Han Ming Low wrote:
> Hi all,
>  
> I try to enable the Role Base Authorization in Guvnor after it was 
> running fine with the default login mechanism.
> But, encountered some problem with the attempt. 
>  
> What I did was that in the components.xml,
> - commented out the default  authenticate-method="#{defaultAuthenticator.authenticate}"/>
> - uncomment the  authenticate-method="#{authenticator.authenticate}" 
> jaas-config-name="other"/>
> - change the role base authorization to true, 
>  enable-role-based-authorization="true"/>
>  
> And at the login-config.xml
> I have changed the "other" application policy to
> 
>
>"org.jboss.security.auth.spi.UsersRolesLoginModule"
>  flag = "required" >
> name="usersProperties">props/guvnor-users.properties
> name="rolesProperties">props/guvnor-roles.properties
>   
>
> 
>  
> guvnor-users.properties
> admin=admin12
> krisv=krisv
> john=john
> mary=mary
>  
> guvnor-roles.properties
> admin=admin
> krisv=admin,manager,user
> john=admin,manager,user
> mary=admin,manager,user
>  
> After restarting JBoss, I can login based on the user and password 
> defined in the guvnor-users.properties.
> And, by changing the password in the properties, I verified that it is 
> taking in the value from the file itself.
>  
> However, when I login as user admin and tried to access the 
> Administration | User Permission or Event Log,
> I'm prompt "Sorry, insufficient permissions to perform this action."
>  
> The error from the console is
> 11:15:36,046 INFO  [STDOUT] ERROR 29-07 11:15:36,046 
> (LoggingHelper.java:error:76)
> Service method 'public abstract java.util.Map 
> org.drools.guvnor.client.rpc.RepositoryService.listUserPermissions()
>throws 
> org.drools.guvnor.client.rpc.DetailedSerializationException'
>threw an unexpected exception: 
> org.jboss.seam.security.AuthorizationException:
>  Authorization check failed for 
> permission[org.drools.guvnor.server.security.admint...@bf7a4d,admin]
> org.jboss.seam.security.AuthorizationException: Authorization check 
> failed for 
> permission[org.drools.guvnor.server.security.admint...@bf7a4d,admin]
> at 
> org.jboss.seam.security.Identity.checkPermission(Identity.java:581)
> at 
> org.drools.guvnor.server.ServiceImplementation.listUserPermissions(ServiceImplementation.java:2604)
> .
>  
> Checking on the org.drools.guvnor.server.security.RoleTypes code, the 
> available role should be
> admin
> analyst
> analyst.readonly
> package.admin
> package.developer
> package.readonly
>  
> Can anyone help to let me know what's wrong with my configuration?
>  
> Thanks.
>  
>  
> Han Ming 
> 
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>   

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  1   2   3   >