[rules-users] StatefulKnowledgeSession Vs StatefulSession

2009-11-25 Thread DeepakA

I used a KnowledgeBuilder ro read the resources (DSL  DSLR files)
Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
the KnowledgeBase.
The StatefulKnowledgeSession was used to start the process and fire all
rules.
Then I realized I was not able to access the RuleBase from
StatefulKnowledgeSession.


So, now I create a RuleBase, then a PackageBuilder, add the resources to the
packageBuilder, then add the
package to the RuleBase and create a StatefulSession out of the RuleBase.
This statefulsession is used to start the process and fire all rules.

Can someone explain to me whats the difference in the above 2 methods of
firing the rules.
Whats the difference between StatefulKnowledgeSession  StatefulSession.
-- 
View this message in context: 
http://old.nabble.com/StatefulKnowledgeSession-Vs-StatefulSession-tp26511606p26511606.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] StatefulKnowledgeSession Vs StatefulSession

2009-11-25 Thread DeepakA

So how can I access RuleBase from StatefulKnowledgeSession?
I cant find a API that links RuleBase and StatefulKnowledgeSession
interface.

I need to get hold of each individual rule from StatefulKnowledgeSession







DeepakA wrote:
 
 I used a KnowledgeBuilder ro read the resources (DSL  DSLR files)
 Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
 the KnowledgeBase.
 The StatefulKnowledgeSession was used to start the process and fire all
 rules.
 Then I realized I was not able to access the RuleBase from
 StatefulKnowledgeSession.
 
 
 So, now I create a RuleBase, then a PackageBuilder, add the resources to
 the packageBuilder, then add the
 package to the RuleBase and create a StatefulSession out of the RuleBase.
 This statefulsession is used to start the process and fire all rules.
 
 Can someone explain to me whats the difference in the above 2 methods of
 firing the rules.
 Whats the difference between StatefulKnowledgeSession  StatefulSession.
 

-- 
View this message in context: 
http://old.nabble.com/StatefulKnowledgeSession-Vs-StatefulSession-tp26511606p26515717.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] Query on performance when adding/removing rules

2009-11-24 Thread DeepakA

any suggestions regarding the impact on performance???



DeepakA wrote:
 
 We have a set of rules (lets call them old rules) running in our strategy
 server.
 A new requirement is that - the client can make calls to the server, at
 that point new rules need to be loaded in the workin memory (at run time),
 if the rules get executed then the rules need to be removed from the
 WorkinMemory (after the consequence section is executed)
 
 I would like to know if repeated adding and removing of rules in the
 working memory will lead to performance issues?
 
 i.e. when the new rules are added/removed the old-set-of rules will still
 be evaluated in the background, will this hamper performance?
 

-- 
View this message in context: 
http://old.nabble.com/Query-on-performance-when-adding-removing-rules-tp26475542p26493210.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] Query on performance when adding/removing rules

2009-11-23 Thread DeepakA

We have a set of rules (lets call them old rules) running in our strategy
server.
A new requirement is that - the client can make calls to the server, at that
point new rules need to be loaded in the workin memory (at run time), if the
rules get executed then the rules need to be removed from the WorkinMemory
(after the consequence section is executed)

I would like to know if repeated adding and removing of rules in the working
memory will lead to performance issues?

i.e. when the new rules are added/removed the old-set-of rules will still be
evaluated in the background, will this hamper performance?
-- 
View this message in context: 
http://old.nabble.com/Query-on-performance-when-adding-removing-rules-tp26475542p26475542.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] exception while adding a packageDescr to a PackageBuilder

2009-11-21 Thread DeepakA

I am trying to add a rule to a package.
First I create a PackageDescr, then I create a RuleDescr 
and set some properties in it

com.deepak.development.Trade class is loaded into the working memory before
I try to create this rule

Upon doing a DrlDump, I get the following (which is correctly formed; if I
copy paste this in a drl file, the rule gets executed as expected)


rule Added new Rule 
 when
trade : com.deepak.development.Trade(  )

 then
System.out.println(Whatever);end


//
// CODE
//


//Create a PackageDescr
//packages[0] is the package that is already available, 
//since I create a new PackageDescr with same name, 
//I expect the new rule to be appended to the existing package

final PackageDescr packageDescr = new PackageDescr(new
Package(packages[0].getName()).getName());

//Create a RuleDescr

RuleDescr ruleDescr = new RuleDescr(Added new Rule); 
String consequence = System.out.println(\Whatever\);;
AndDescr lhs = new AndDescr(); 
ruleDescr.setLhs( lhs );

final PatternDescr pattern = new PatternDescr(
com.deepak.development.Trade.class.getName(),trade);
lhs.addDescr( pattern );
ruleDescr.setConsequence( consequence );

PackageBuilder builder = new PackageBuilder(packages[0]); 
packageDescr.addRule( ruleDescr );

DrlDumper drlDumper = new DrlDumper();
System.out.println(Dumping Package Descriptor for all rules: +
drlDumper.dump(packageDescr)); 

//Nullpointer Exception caught
builder.addPackage(packageDescr);
ruleBase.addPackage(builder.getPackage());


Doing a debug in eclipse I can see that a NullPointerException is caught in
the line ###builder.addPackage(packageDescr)###

Is there any other property I need to set in packageDescr before it can be
added to a builder?
I can see the following in the debug section of eclipse 

PackageStore.read(String) line: 58

The following is shown in the Variables side (in eclispe debug mode)
[corresponds to PackageStore]


thisPackageStore  (id=13923)
errors  ArrayListE  (id=15898)
elementData Object[10]  (id=19840)  
modCount0   
size0   
javaDialectRuntimeData  null
resourceNamejava/lang/Object.class (id=13925) 
count   22  
hash0   
offset  0   
value(id=15896) 
clazz   null





-- 
View this message in context: 
http://old.nabble.com/exception-while-adding-a-packageDescr-to-a-PackageBuilder-tp26455685p26455685.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] exception while adding a packageDescr to a PackageBuilder

2009-11-21 Thread DeepakA

I can confirm that adding a PackageDescr to PackageBuilder works with
drools-4.0.7
but throws a NullPointerException with Drools 5.0  Drools 5.1.0.M1 





DeepakA wrote:
 
 I am trying to add a rule to a package.
 First I create a PackageDescr, then I create a RuleDescr 
 and set some properties in it
 
 com.deepak.development.Trade class is loaded into the working memory
 before I try to create this rule
 
 Upon doing a DrlDump, I get the following (which is correctly formed; if I
 copy paste this in a drl file, the rule gets executed as expected)
 
 
 rule Added new Rule 
when
   trade : com.deepak.development.Trade(  )
 
then
 System.out.println(Whatever);end
 
 
 //
 // CODE
 //
 
 
 //Create a PackageDescr
 //packages[0] is the package that is already available, 
 //since I create a new PackageDescr with same name, 
 //I expect the new rule to be appended to the existing package
 
 final PackageDescr packageDescr = new PackageDescr(new
 Package(packages[0].getName()).getName());
 
 //Create a RuleDescr  
   
 RuleDescr ruleDescr = new RuleDescr(Added new Rule); 
 String consequence = System.out.println(\Whatever\);;
 AndDescr lhs = new AndDescr(); 
 ruleDescr.setLhs( lhs );
   
 final PatternDescr pattern = new PatternDescr(
 com.deepak.development.Trade.class.getName(),trade);
 lhs.addDescr( pattern );
 ruleDescr.setConsequence( consequence );
 
 PackageBuilder builder = new PackageBuilder(packages[0]); 
 packageDescr.addRule( ruleDescr );
 
 DrlDumper drlDumper = new DrlDumper();
 System.out.println(Dumping Package Descriptor for all rules: +
 drlDumper.dump(packageDescr)); 
 
 //Nullpointer Exception caught
 builder.addPackage(packageDescr);
 ruleBase.addPackage(builder.getPackage());
 
 
 Doing a debug in eclipse I can see that a NullPointerException is caught
 in the line ###builder.addPackage(packageDescr)###
 
 Is there any other property I need to set in packageDescr before it can be
 added to a builder?
 I can see the following in the debug section of eclipse 
 
 PackageStore.read(String) line: 58
 
 The following is shown in the Variables side (in eclispe debug mode)
 [corresponds to PackageStore]
 
 
 this  PackageStore  (id=13923)
   errors  ArrayListE  (id=15898)
   elementData Object[10]  (id=19840)  
   modCount0   
   size0   
   javaDialectRuntimeData  null
 resourceName  java/lang/Object.class (id=13925) 
   count   22  
   hash0   
   offset  0   
   value(id=15896) 
 clazz null
 
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/exception-while-adding-a-packageDescr-to-a-PackageBuilder-tp26455685p26456520.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] exception while adding a packageDescr to a PackageBuilder

2009-11-21 Thread DeepakA

It works in Drools 5.0 after setting a value for Namespace in PackageDescr






DeepakA wrote:
 
 I can confirm that adding a PackageDescr to PackageBuilder works with
 drools-4.0.7
 but throws a NullPointerException with Drools 5.0  Drools 5.1.0.M1 
 
 
 
 
 
 DeepakA wrote:
 
 I am trying to add a rule to a package.
 First I create a PackageDescr, then I create a RuleDescr 
 and set some properties in it
 
 com.deepak.development.Trade class is loaded into the working memory
 before I try to create this rule
 
 Upon doing a DrlDump, I get the following (which is correctly formed; if
 I copy paste this in a drl file, the rule gets executed as expected)
 
 
 rule Added new Rule 
   when
  trade : com.deepak.development.Trade(  )
 
   then
 System.out.println(Whatever);end
 
 
 //
 // CODE
 //
 
 
 //Create a PackageDescr
 //packages[0] is the package that is already available, 
 //since I create a new PackageDescr with same name, 
 //I expect the new rule to be appended to the existing package
 
 final PackageDescr packageDescr = new PackageDescr(new
 Package(packages[0].getName()).getName());
 
 //Create a RuleDescr 
  
 RuleDescr ruleDescr = new RuleDescr(Added new Rule); 
 String consequence = System.out.println(\Whatever\);;
 AndDescr lhs = new AndDescr(); 
 ruleDescr.setLhs( lhs );
  
 final PatternDescr pattern = new PatternDescr(
 com.deepak.development.Trade.class.getName(),trade);
 lhs.addDescr( pattern );
 ruleDescr.setConsequence( consequence );
 
 PackageBuilder builder = new PackageBuilder(packages[0]); 
 packageDescr.addRule( ruleDescr );
 
 DrlDumper drlDumper = new DrlDumper();
 System.out.println(Dumping Package Descriptor for all rules: +
 drlDumper.dump(packageDescr)); 
 
 //Nullpointer Exception caught
 builder.addPackage(packageDescr);
 ruleBase.addPackage(builder.getPackage());
 
 
 Doing a debug in eclipse I can see that a NullPointerException is caught
 in the line ###builder.addPackage(packageDescr)###
 
 Is there any other property I need to set in packageDescr before it can
 be added to a builder?
 I can see the following in the debug section of eclipse 
 
 PackageStore.read(String) line: 58
 
 The following is shown in the Variables side (in eclispe debug mode)
 [corresponds to PackageStore]
 
 
 this PackageStore  (id=13923)
  errors  ArrayListE  (id=15898)
  elementData Object[10]  (id=19840)  
  modCount0   
  size0   
  javaDialectRuntimeData  null
 resourceName java/lang/Object.class (id=13925) 
  count   22  
  hash0   
  offset  0   
  value(id=15896) 
 clazznull
 
 
 
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/exception-while-adding-a-packageDescr-to-a-PackageBuilder-tp26455685p26458012.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] update a shadow object in working memory

2009-11-13 Thread DeepakA

All,

I was investigating why the
my rule was running into a loop, even though I had a no-loop true.

I was doing an session.update to update the fact in the
working memory, the fact was updated (removed and added) in the working
memory.

I tried commenting the session.update and I can see that the shadow object
in the working memory still got updated and reflected the latest value set
within the java code.

The looping has also stopped.

Can some one clarify if its possible to update the object in working memory
without calling the update method. 
-- 
View this message in context: 
http://old.nabble.com/update-a-shadow-object-in-working-memory-tp26338645p26338645.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