Re: [rules-users] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Michael Anstis
A time based eviction queue is simply a queue that evicts its content based
upon time-based heuristic. So the WorkingMemoryEventListener would store
facts inserted into the WorkingMemory in an internal queue and evict them
from that queue based upon some time-based heuristic. You could use an
Executor (ScheduledExecutorService) etc to remove facts from the queue and
working memory at set intervals.

With kind regards,

Mike

On 11 November 2010 22:31, Ayush ayush.vatsya...@alcatel-lucent.com wrote:


 Can you please elaborate on Have it store each inserted object in a
 time based eviction queue and it'll remove things for you. i.e. how can I
 do it?
 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1885760.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


Re: [rules-users] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Wolfgang Laun
There isn't much support Drools provides for this. The listener tells you
about
a new Fact being inserted, and then - what? Unless you are satisfied with
a constant expiry offset, or define expiry times by a MapClass?,Long
or implement getExpiryOffset in all of your classes, you don't know *when*
to retract.

You can define @expires(...) on a declare even when the @role is not
event,
but getting at this value isn't simple; you have to use the unstable API

org.drools.definitions.impl.KnowledgePackageImp rpkg =

(org.drools.definitions.impl.KnowledgePackageImp)kBase.getKnowledgePackage(
some.package );
org.drools.rule.TypeDeclaration td =
(org.drools.rule.TypeDeclaration)rpkg.pkg.getTypeDeclaration( FactTYpe );
System.out.println( Expires:  + td.getExpirationOffset() );

It's difficult to accept why features which are part of the established user
interface are not accessible via the stable API.

As an aside, notice that the Expert manual teaches me to add metadata to a
Java-defined class:
   declare org.drools.examples.Person
  @author( Bob )
  ...
   end
Great, and Bob's your uncle! How do I retrieve this author metadata?

Regards
Wolfgang





2010/11/12 Michael Anstis michael.ans...@gmail.com:
 A time based eviction queue is simply a queue that evicts its content
based
 upon time-based heuristic. So the WorkingMemoryEventListener would store
 facts inserted into the WorkingMemory in an internal queue and evict them
 from that queue based upon some time-based heuristic. You could use an
 Executor (ScheduledExecutorService) etc to remove facts from the queue and
 working memory at set intervals.

 With kind regards,

 Mike

 On 11 November 2010 22:31, Ayush ayush.vatsya...@alcatel-lucent.com
wrote:

 Can you please elaborate on Have it store each inserted object in a
 time based eviction queue and it'll remove things for you. i.e. how can
I
 do it?
 --
 View this message in context:

http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1885760.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Michael Anstis
Very true Wolfgang, and I agree your comments re: accessing meta data too.

In this case if Events are raised in response to Facts and the events
themselves expire after 5 mins; I'd assume a constant time expiration policy
on the queue to be acceptable however this is based on assumption rather
than fact.

Edson\Mark are the experts in this realm so I'll defer further comment to
them.

With kind regards,

Mike

2010/11/12 Wolfgang Laun wolfgang.l...@gmail.com

 There isn't much support Drools provides for this. The listener tells you
 about
 a new Fact being inserted, and then - what? Unless you are satisfied with
 a constant expiry offset, or define expiry times by a MapClass?,Long
 or implement getExpiryOffset in all of your classes, you don't know *when*
 to retract.

 You can define @expires(...) on a declare even when the @role is not
 event,
 but getting at this value isn't simple; you have to use the unstable API

 org.drools.definitions.impl.KnowledgePackageImp rpkg =

 (org.drools.definitions.impl.KnowledgePackageImp)kBase.getKnowledgePackage(
 some.package );
 org.drools.rule.TypeDeclaration td =
 (org.drools.rule.TypeDeclaration)rpkg.pkg.getTypeDeclaration( FactTYpe );
 System.out.println( Expires:  + td.getExpirationOffset() );

 It's difficult to accept why features which are part of the established
 user interface are not accessible via the stable API.

 As an aside, notice that the Expert manual teaches me to add metadata to a
 Java-defined class:
declare org.drools.examples.Person
   @author( Bob )
   ...
end
 Great, and Bob's your uncle! How do I retrieve this author metadata?

 Regards
 Wolfgang





 2010/11/12 Michael Anstis michael.ans...@gmail.com:

  A time based eviction queue is simply a queue that evicts its content
 based
  upon time-based heuristic. So the WorkingMemoryEventListener would store
  facts inserted into the WorkingMemory in an internal queue and evict them
  from that queue based upon some time-based heuristic. You could use an
  Executor (ScheduledExecutorService) etc to remove facts from the queue
 and
  working memory at set intervals.
 
  With kind regards,
 
  Mike
 
  On 11 November 2010 22:31, Ayush ayush.vatsya...@alcatel-lucent.com
 wrote:
 
  Can you please elaborate on Have it store each inserted object in a
  time based eviction queue and it'll remove things for you. i.e. how can
 I
  do it?
  --
  View this message in context:
 
 http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1885760.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 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] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Ayush

Thanks for replies. Actually what I did now is I declared my fact into drl
file and then I'd added an @expires to it. It works fine but now the problem
is that for every fact inserted I'd also inserted an event for it. 

Now as the drl file can be updated by user so say he'd defined expiry time
for events as 1m and for facts as 10s in this case since I'm using sliding
window for events and based on this event I'm fetching the fact. So now I'll
be getting the event but facts will not be available as the 2nd fact came
after 20s hence the rule will not be fired. below is the sample rule.

declare MyEvent
@role(event)
@expires( 1m )
end

declare MyFact
@expires( 10s )
end
rule MyCorrelation
no-loop true
dialect mvel
lock-on-active
when
$E1 : MyEvent( prop1 == 2, $entityA : entity ) over 
window:time(60s) from
entry-point NotificationStream
$E2 : MyEvent( this != $E1, prop1 == 1, $entityB : entity ) over
window:time(60s) from entry-point NotificationStream
$F2 : MyFact(this.entity == $entityB)
$F1 : MyFact(this.entity == $entityA)
then
System.out.println(I'm executed successfully);
end

Now what I want is that I can define the @expires time at a single location
or I can verify the logic of these rules?

Also if say I'd defined the @expires for event as 10s while in sliding
window I'm using over:time(1m) then also it is not same.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1887976.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] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Ayush

Thanks. Actually I did it in different way what I did is I declared my fact
into drl file as declare MyFact and then I'd added an @expires to it. It
works fine but now the problem is that for every fact inserted I'd also
inserted an event for it. 

Now as the drl file can be updated by user so say he'd defined expiry time
for events as 1m and for facts as 10s in this case since I'm using sliding
window for events and based on this event I'm fetching the fact. So now I'll
be getting the event but facts will not be available as the 2nd fact came
after 20s hence the rule will not be fired. below is the sample rule.

declare MyEvent
@role(event)
@expires( 1m )
end

declare MyFact
@expires( 10s )
end
rule MyCorrelation
no-loop true
dialect mvel
lock-on-active
when
$E1 : MyEvent( prop1 == 2, $entityA : entity ) over 
window:time(60s) from
entry-point NotificationStream
$E2 : MyEvent( this != $E1, prop1 == 1, $entityB : entity ) over
window:time(60s) from entry-point NotificationStream
$F2 : MyFact(this.entity == $entityB)
$F1 : MyFact(this.entity == $entityA)
then
System.out.println(I'm executed successfully);
end

Now what I want is that I can define the @expires time at a single location
or I can verify the logic of these rules?

Also if say I'd defined the @expires for event as 10s while in sliding
window I'm using over:time(1m) then also it is not same.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1887987.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] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Wolfgang Laun
Now that I see this code I wonder why you don't simply promote MyFact
to an event?

But, given the current situation, which removes MyEvent facts after 1m,
and assuming that you insert the MyEvent *before* its corresponding
MyFact, you can

rule fact-without-event
when
$f: MyFact($entity : entity)
not MyEvent( entity == $entity )
then
   retract( $f );
end

and the obsolete MyFact will be gone, too.

-W


On 12 November 2010 11:02, Ayush ayush.vatsya...@alcatel-lucent.com wrote:


 Thanks. Actually I did it in different way what I did is I declared my fact
 into drl file as declare MyFact and then I'd added an @expires to it. It
 works fine but now the problem is that for every fact inserted I'd also
 inserted an event for it.

 Now as the drl file can be updated by user so say he'd defined expiry time
 for events as 1m and for facts as 10s in this case since I'm using sliding
 window for events and based on this event I'm fetching the fact. So now
 I'll
 be getting the event but facts will not be available as the 2nd fact came
 after 20s hence the rule will not be fired. below is the sample rule.

 declare MyEvent
@role(event)
@expires( 1m )
 end

 declare MyFact
@expires( 10s )
 end
 rule MyCorrelation
no-loop true
dialect mvel
lock-on-active
when
$E1 : MyEvent( prop1 == 2, $entityA : entity ) over
 window:time(60s) from
 entry-point NotificationStream
$E2 : MyEvent( this != $E1, prop1 == 1, $entityB : entity )
 over
 window:time(60s) from entry-point NotificationStream
$F2 : MyFact(this.entity == $entityB)
$F1 : MyFact(this.entity == $entityA)
then
System.out.println(I'm executed successfully);
 end

 Now what I want is that I can define the @expires time at a single location
 or I can verify the logic of these rules?

 Also if say I'd defined the @expires for event as 10s while in sliding
 window I'm using over:time(1m) then also it is not same.
 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1887987.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] Drools flow question on proper exception handling / use of faults

2010-11-12 Thread Liße , Jan
Hi,

I have a process workflow where an exception might occur within one Action. I 
need to react on this exception in the workflow. That means I don't want to 
skip the entire processing
I just want to react properly by setting an error variable and skip this 
specific item (my process iterates over a list of items).
Now I tried to model my Action together with a Fault Node within a 
CompositeNode as seen in the User manual section on exception handling. The 
outgoing connection
of my Action is connected with the Fault. The outgoing connection of the 
CompositeNode is connected with the next Action. When I run the process it 
comes to the Action node and hangs there if no exception occurs (the next 
Action is never reached). Looking at the model this is reasonable since the 
outgoing connection leads to the Fault node. So my question is how can I 
properly model this kind of exception handling, where I need two ways of 
execution (one if everything goes fine, and one for fault handling)? Wrapping 
everything inside a CompositeNode alone does not seem to be sufficient...

Thanks in advance for any help!
-Jan

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


Re: [rules-users] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Ayush

oh yes Thanks this rule will solve my problem.

I'm wondering is there any way I can actually verify the business logic of
my rules. I'd read about drools-verifier but I've not found enough
information for it to be used with drl. I want that  in some way I can check
the business logic from java classes?
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1888151.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] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Wolfgang Laun
You can use JUnit, create a session, insert facts, call fireXY(),...
Asserting the correct result may
be done by inspecting the WM or listening to events or whatever your app
suggests.
-W


On 12 November 2010 11:45, Ayush ayush.vatsya...@alcatel-lucent.com wrote:


 oh yes Thanks this rule will solve my problem.

 I'm wondering is there any way I can actually verify the business logic of
 my rules. I'd read about drools-verifier but I've not found enough
 information for it to be used with drl. I want that  in some way I can
 check
 the business logic from java classes?
 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1888151.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


Re: [rules-users] Removing facts from statefulknowledgeSession's memory

2010-11-12 Thread Wolfgang Laun
Just in case anybody wonders about the effort for building a mechanism for
retracting facts based on fact attributes or other data, I outline the
solution I have implemented.

My class FactWiper implements WorkingMemoryEventListener and Runnable.

   - The implementation of objectInserted( ObjectInsertedEvent event )
   determines whether the object needs handling and, if so, the retraction
   Date, based upon whatever strategy you care to implement, e.g., reflection
   method call, MapClass,Long, etc. If it is to be handled, it signals
   Condition change to the thread.
   - A SortedMapDate,Object expiry2fact keeps track of pending
   retractions.
   - The thread loops into an awaitUntil( x ) on the change condition,
   where x is (generally) the first retraction Date. If reached, it retracts
   according to the foremost Map entry; if signalled it reasesses the situation
   and reenters the awaitUntil.

-W


2010/11/12 Michael Anstis michael.ans...@gmail.com

 A time based eviction queue is simply a queue that evicts its content based
 upon time-based heuristic. So the WorkingMemoryEventListener would store
 facts inserted into the WorkingMemory in an internal queue and evict them
 from that queue based upon some time-based heuristic. You could use an
 Executor (ScheduledExecutorService) etc to remove facts from the queue and
 working memory at set intervals.

 With kind regards,

 Mike

 On 11 November 2010 22:31, Ayush ayush.vatsya...@alcatel-lucent.comwrote:


 Can you please elaborate on Have it store each inserted object in a
 time based eviction queue and it'll remove things for you. i.e. how can I
 do it?
 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1885760.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] accumulate vs collect

2010-11-12 Thread rouvas
Edson Tirelli wrote:
Can you show us the stack trace? What version of Drools are you using?

I am using Drools.5.0.1.

For this accumulate:

v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6 =
20100512  c_7 == 5 ) , count(p) )

stack trace follows:

EXCEPTION ERROR
java.lang.ClassCastException: gr.fbi.rulez.t_1
org.drools.rule.Accumulate.accumulate(Accumulate.java:172)
org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:424)
org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:284)
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
utils.LoadDynEntities.load(LoadDynEntities.java:102)
gr.fbi.rulez.RulesRunner.ignite(RulesRunner.java:74)
...more irrelevant stuff..

-Stathis



In Drools 5.1+, collect is just syntax sugar... internally, collect
 is implemented using accumulate.

Edson

 2010/11/11  rou...@di.uoa.gr:
 Hi List,

 I'm trying to count the number of objects I have in the Working Memory
 using accumulate, but I'm having a ClassCastException thrown at me.

 Using a variant with collect, everything work OK.

 Can someone shed some light on this issue?
 Is it related to https://jira.jboss.org/browse/JBRULES-2202 ?

 I'm using Drools.5.0.1 and the fact is a declared one, as follows:

 declare t_1
  regRowId : String
  versionId : String
  c_7 : String
  c_1 : String
  c_2 : String
  c_3 : String
  c_4 : String
  c_5 : String
  c_6 : Double
 end

 trying with :

 v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6 =
 20100511  c_7 == 5 ) , count(p) )

 I'm getting a ClassCastException:t_1, while using :

 v945 : ArrayList ( size  =  1 ) from collect ( t_1 (  c_6 = 20100511
 
 c_7 == 5 )  )

 works OK.

 The reason I'm preferring accumulate over collect, is that I'm not
 really
 interested in constructing an ArrayList of the matched facts (worries
 about memory consumption), all I want is how many of them are there.

 The actual rule I'm using (although I don't think it matters) for the
 accumulate variant, is:

 rule r95944.6
        dialect mvel
        when
                gnId : GoodNumbers()
                 LogicalValue : Trader( gnId.goodNo==goodNo  )
                 v945 : Number ( doubleValue  =  1 ) from accumulate ( p
 : t_1 (  c_6
= 20100511  c_7 == 5 ) , count(p) )
        then
                RaResultCode rrc = new RaResultCode();
                  rrc.setResultRuleId(95944);
                  rrc.setResultRuleVersionId(6);
                  rrc.setResultColor(R);
                  rrc.setResultRuleCode(01);
                  rrc.setResultAction(1);
                  rrc.setResultGoodNo(gnId.goodNo);
                insertLogical(rrc);
 end

 Thank you for your time.

 -Stathis


 ___
 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] accumulate vs collect

2010-11-12 Thread rouvas
Wolfgang Laun wrote:
 The suggested workaround (before this was fixed) is to use
count(1)
 which achieves the same effect.
 -W

Thanks a lot Wolfangm, it now works as a charm!

-Stathis


 On 11 November 2010 19:30,  rou...@di.uoa.gr wrote:
 Hi List,

 I'm trying to count the number of objects I have in the Working Memory
 using accumulate, but I'm having a ClassCastException thrown at me.

 Using a variant with collect, everything work OK.

 Can someone shed some light on this issue?
 Is it related to https://jira.jboss.org/browse/JBRULES-2202 ?

 I'm using Drools.5.0.1 and the fact is a declared one, as follows:

 declare t_1
  regRowId : String
  versionId : String
  c_7 : String
  c_1 : String
  c_2 : String
  c_3 : String
  c_4 : String
  c_5 : String
  c_6 : Double
 end

 trying with :

 v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6 =
 20100511  c_7 == 5 ) , count(p) )

 I'm getting a ClassCastException:t_1, while using :

 v945 : ArrayList ( size  =  1 ) from collect ( t_1 (  c_6 = 20100511
 
 c_7 == 5 )  )

 works OK.

 The reason I'm preferring accumulate over collect, is that I'm not
 really
 interested in constructing an ArrayList of the matched facts (worries
 about memory consumption), all I want is how many of them are there.

 The actual rule I'm using (although I don't think it matters) for the
 accumulate variant, is:

 rule r95944.6
        dialect mvel
        when
                gnId : GoodNumbers()
                 LogicalValue : Trader( gnId.goodNo==goodNo  )
                 v945 : Number ( doubleValue  =  1 ) from accumulate ( p
 : t_1 (  c_6
= 20100511  c_7 == 5 ) , count(p) )
        then
                RaResultCode rrc = new RaResultCode();
                  rrc.setResultRuleId(95944);
                  rrc.setResultRuleVersionId(6);
                  rrc.setResultColor(R);
                  rrc.setResultRuleCode(01);
                  rrc.setResultAction(1);
                  rrc.setResultGoodNo(gnId.goodNo);
                insertLogical(rrc);
 end

 Thank you for your time.

 -Stathis


 ___
 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] accumulate vs collect

2010-11-12 Thread Edson Tirelli
I believe this is fixed in Drools 5.1.1, as in 5.0.1 declared
beans where not implementing the Serializable interface. Please try
5.1.1 and let us know if you still see the problem.

   Otherwise, Wolfgang's suggestion for the workaround should work as well.

Edson

2010/11/12  rou...@di.uoa.gr:
 Edson Tirelli wrote:
    Can you show us the stack trace? What version of Drools are you using?

 I am using Drools.5.0.1.

 For this accumulate:

 v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6 =
 20100512  c_7 == 5 ) , count(p) )

 stack trace follows:

 EXCEPTION ERROR
 java.lang.ClassCastException: gr.fbi.rulez.t_1
 org.drools.rule.Accumulate.accumulate(Accumulate.java:172)
 org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:424)
 org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:284)
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
 org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
 org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
 org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
 org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
 org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
 utils.LoadDynEntities.load(LoadDynEntities.java:102)
 gr.fbi.rulez.RulesRunner.ignite(RulesRunner.java:74)
 ...more irrelevant stuff..

 -Stathis



    In Drools 5.1+, collect is just syntax sugar... internally, collect
 is implemented using accumulate.

    Edson

 2010/11/11  rou...@di.uoa.gr:
 Hi List,

 I'm trying to count the number of objects I have in the Working Memory
 using accumulate, but I'm having a ClassCastException thrown at me.

 Using a variant with collect, everything work OK.

 Can someone shed some light on this issue?
 Is it related to https://jira.jboss.org/browse/JBRULES-2202 ?

 I'm using Drools.5.0.1 and the fact is a declared one, as follows:

 declare t_1
  regRowId : String
  versionId : String
  c_7 : String
  c_1 : String
  c_2 : String
  c_3 : String
  c_4 : String
  c_5 : String
  c_6 : Double
 end

 trying with :

 v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6 =
 20100511  c_7 == 5 ) , count(p) )

 I'm getting a ClassCastException:t_1, while using :

 v945 : ArrayList ( size  =  1 ) from collect ( t_1 (  c_6 = 20100511
 
 c_7 == 5 )  )

 works OK.

 The reason I'm preferring accumulate over collect, is that I'm not
 really
 interested in constructing an ArrayList of the matched facts (worries
 about memory consumption), all I want is how many of them are there.

 The actual rule I'm using (although I don't think it matters) for the
 accumulate variant, is:

 rule r95944.6
        dialect mvel
        when
                gnId : GoodNumbers()
                 LogicalValue : Trader( gnId.goodNo==goodNo  )
                 v945 : Number ( doubleValue  =  1 ) from accumulate ( p
 : t_1 (  c_6
= 20100511  c_7 == 5 ) , count(p) )
        then
                RaResultCode rrc = new RaResultCode();
                  rrc.setResultRuleId(95944);
                  rrc.setResultRuleVersionId(6);
                  rrc.setResultColor(R);
                  rrc.setResultRuleCode(01);
                  rrc.setResultAction(1);
                  rrc.setResultGoodNo(gnId.goodNo);
                insertLogical(rrc);
 end

 Thank you for your time.

 -Stathis


 ___
 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






-- 
  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] accumulate vs collect

2010-11-12 Thread rouvas
Edson Tirelli wrote:
 I believe this is fixed in Drools 5.1.1, as in 5.0.1 declared
 beans where not implementing the Serializable interface. Please try
 5.1.1 and let us know if you still see the problem.

Unfortunately I am the final stages of my project and cannot afford to
switch Drools versions.
I expect to be able to to such changes in a couple of months in the next
upgrade cycle. I'll try to remember this case and will report any new
findings.


Otherwise, Wolfgang's suggestion for the workaround should work as
 well.

I did that and it works fine. I consider the issue closed (for the time
being).

Thank you all for your time,
-Stathis


 Edson

 2010/11/12  rou...@di.uoa.gr:
 Edson Tirelli wrote:
    Can you show us the stack trace? What version of Drools are you
 using?

 I am using Drools.5.0.1.

 For this accumulate:

 v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6 =
 20100512  c_7 == 5 ) , count(p) )

 stack trace follows:

 EXCEPTION ERROR
 java.lang.ClassCastException: gr.fbi.rulez.t_1
 org.drools.rule.Accumulate.accumulate(Accumulate.java:172)
 org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:424)
 org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:284)
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
 org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
 org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
 org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
 org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
 org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
 utils.LoadDynEntities.load(LoadDynEntities.java:102)
 gr.fbi.rulez.RulesRunner.ignite(RulesRunner.java:74)
 ...more irrelevant stuff..

 -Stathis



    In Drools 5.1+, collect is just syntax sugar... internally, collect
 is implemented using accumulate.

    Edson

 2010/11/11  rou...@di.uoa.gr:
 Hi List,

 I'm trying to count the number of objects I have in the Working Memory
 using accumulate, but I'm having a ClassCastException thrown at me.

 Using a variant with collect, everything work OK.

 Can someone shed some light on this issue?
 Is it related to https://jira.jboss.org/browse/JBRULES-2202 ?

 I'm using Drools.5.0.1 and the fact is a declared one, as follows:

 declare t_1
  regRowId : String
  versionId : String
  c_7 : String
  c_1 : String
  c_2 : String
  c_3 : String
  c_4 : String
  c_5 : String
  c_6 : Double
 end

 trying with :

 v945 : Number ( doubleValue  =  1 ) from accumulate ( p : t_1 (  c_6
 =
 20100511  c_7 == 5 ) , count(p) )

 I'm getting a ClassCastException:t_1, while using :

 v945 : ArrayList ( size  =  1 ) from collect ( t_1 (  c_6 = 20100511
 
 c_7 == 5 )  )

 works OK.

 The reason I'm preferring accumulate over collect, is that I'm not
 really
 interested in constructing an ArrayList of the matched facts (worries
 about memory consumption), all I want is how many of them are there.

 The actual rule I'm using (although I don't think it matters) for the
 accumulate variant, is:

 rule r95944.6
        dialect mvel
        when
                gnId : GoodNumbers()
                 LogicalValue : Trader( gnId.goodNo==goodNo  )
                 v945 : Number ( doubleValue  =  1 ) from accumulate (
 p
 : t_1 (  c_6
= 20100511  c_7 == 5 ) , count(p) )
        then
                RaResultCode rrc = new RaResultCode();
                  rrc.setResultRuleId(95944);
                  rrc.setResultRuleVersionId(6);
                  rrc.setResultColor(R);
                  rrc.setResultRuleCode(01);
                  rrc.setResultAction(1);
                  rrc.setResultGoodNo(gnId.goodNo);
                insertLogical(rrc);
 end

 Thank you for your time.

 -Stathis


 ___
 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






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


[rules-users] User Experience with multiple users in Guvnor

2010-11-12 Thread John Peterson
I have a question for users out there working with Guvnor.  Do you have
more than one user working on rules within the same package at the same
time?  How are you handling versioning and testing, especially if the
changes are not going out at the same time?

We've been experimenting with Guvnor (5.0.1) and multiple users and
we're finding that if user A gets something that parses with an error,
it carries over to all the other users when they attempt to validate
their rules.  This has been confusing because the error is not with
their code but with something else completely (like a Function with an
error, and they're working on a rule).  It seems to us that multiple
users working on the same package in Guvnor would require a lot of
coordination.

Anyone have some wisdom or lessons learned you'd be willing to share?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] 8Puzzle problem with Drools Planner

2010-11-12 Thread Anderson Rocha
Hi all,

I am wondering if Drools Planner can handle the 8Puzzle problem. I once
resolved it with the A* search. But I do not know these simulated annealing
and tabu search that Drools Planner implements. So I am having a Getting
stuck in local optima problem, and depending on the start sollution it gets
into loop. But if you enter a really simple start solution it resolves,
because it choose the best scores until finish with few steps. If some one
can help, let me know what I can send (source code, configuration files) to
get some help.

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


[rules-users] Rules Flow Eclipse editor

2010-11-12 Thread Prafull Kumar
Hi All,


I would like to know how we can modify the Rules flow eclipse editor look and 
feel and functionality. e.g. If we have a Embedded Sub-Process in the flow and 
reduce the size of it, the arrows are still displayed in the main canvas. 
Please 
see the attached snapshot for reference.

How we can fix it? also if we want to open the Embedded Sub-Process in a new 
window for easy maintainability/readability of the very complex processes, how 
we can achieve it?
  
Going forward we are also looking to create the custom editor for the nodes. 
Please guide us if its possible and there is any document for this.

Note: It seems that I can not attach files in the mailing list. Let me know if 
its possible to share the image.

Regards, Prafull


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


[rules-users] Rules Flow production level support

2010-11-12 Thread Prafull Kumar
Hi All,

I would like to know the possible options of production level support for 
Drools 
Flow 5.1. Please share the links if support is available from JBoss or any 3rd 
party.

Regards, Prafull


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