Re: [rules-users] Run Drool Application From Command Prompt

2009-07-28 Thread Greg Barton
heh.  I just remembered that Thread.currentThread().getContextClassLoader() can 
return null as well. :)  A good thing to do is have a utility function like the 
attached class loading utility class.  Rearrange the class loading order to 
suit your taste.

--- On Tue, 7/28/09, Greg Barton greg_bar...@yahoo.com wrote:

 From: Greg Barton greg_bar...@yahoo.com
 Subject: Re: [rules-users] Run Drool Application From Command Prompt
 To: Rules Users List rules-users@lists.jboss.org
 Date: Tuesday, July 28, 2009, 12:59 AM
 
 It's unclear from your post when you get the NPE: from the
 command line, from eclipse, or when integrated with OFBiz.
 (I assume you're referring to http://ofbiz.apache.org/)
 
 It's undoubtedly a classpath issue.  Just peek at the
 source a bit.  I'm not sure what version you're using,
 but if you look at the source in the svn repo you'll see
 that line 92 of JavaDialectConfiguration is this:
 
 getClass().getClassLoader().loadClass(
 org.eclipse.jdt.internal.compiler.Compiler );
 
 See the javadoc for Class.getClassLoader() that says
 Returns the class loader for the class. Some
 implementations may use null to represent the bootstrap
 class loader. This method will return null in such
 implementations if this class was loaded by the bootstrap
 class loader.
 
 So, it looks probable that in the environment that's having
 problems, the JavaDialectConfiguration class is loaded by
 the bootstrap classloader.  What is the VM
 implementation you're using?
 
 It might be best if
 Thread.currentThread().getContextClassLoader() was used
 instead of getClass().getClassLoader() in
 JavaDialectConfiguration and elsewhere.  Devs, have an
 opinion on that?
 
 --- On Mon, 7/27/09, pankaj.j...@lntinfotech.com
 pankaj.j...@lntinfotech.com
 wrote:
 
  From: pankaj.j...@lntinfotech.com
 pankaj.j...@lntinfotech.com
  Subject: Re: [rules-users] Run Drool Application From
 Command Prompt
  To: rules-users@lists.jboss.org
  Date: Monday, July 27, 2009, 11:50 PM
  
  
  Hi
  
  
  
  I still have not got any
  solution
  of my problem that I posted previously. I have
 included all
  required jar
  files and set proper class path .. Please do help ?
  
  
  
  problem: 
  
  
  
  
  I am trying to
  integrate Drool with
  ofbiz and run application from command prompt. In one
 way I
  have integrated
  it properly and I am able to run it
  successfully.
  
  
  
  
  Code : Which I was using initially 
  
  
  
  KnowledgeBuilder kbuilder =
  KnowledgeBuilderFactory.newKnowledgeBuilder();
  
  
  
  
  or 
  
  
  
  PackageBuilderConfiguration cfg = new
  PackageBuilderConfiguration();
  
  
  KnowledgeBuilder kbuilder =
  KnowledgeBuilderFactory.newKnowledgeBuilder();
  
  
  
  
  Exception I got : 
  
  
  
  org.drools.RuntimeDroolsException: Unable to load
 dialect
 
 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java
  
  
 
 :org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
  
  
  at
 
 org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
  at
 
 org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259)
  
  
  
  
  at
 
 org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
  at
 
 org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:153)
  at
 
 org.drools.compiler.PackageBuilder.init(PackageBuilder.java:242)
  
  
  . 
  
  . 
  
  . 
  
  Caused by: java.lang.NullPointerException 
  
  at
 
 org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:92)
  at
 
 org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
  at
 
 org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:270
  
  
  
  
  Problem I found : 
  
  In the class JavaDialectConfiguration in jar file
  drools-compiler.jar there
  is a method named setCompliler,  in this
  method Null Pointer
  Exception was coming. 
  
  
  
  Solution I provided :
  
  
  In my application I created my custom class
  CustomJavaDialectConfiguration
  by extending to class JavaDialectConfiguration, In
 this
  class I overrided
  the method setCompiler. My method was exactly same as
 that
  of method setCompiler
  in JavaDialectConfiguration . To call my dialect class
 I
  also overrided
  the method addDialect of
  PackageBuilderConfiguration class
  . For that I created class
  CustomPackageBuilderConfiguration by extending
  to PackageBuilderConfiguration. 
  
  after that I wrote the code: 
  
  
  
  PackageBuilderConfiguration cfg = new
  CustomPackageBuilderConfiguration();
  
  
  KnowledgeBuilder kbuilder =
  KnowledgeBuilderFactory.newKnowledgeBuilder(cfg);
  
  
  
  
  
  
  Now application is running perfectly fine from both
 eclipse
  and command
  prompt without any exception. 
  
  
  
  I want to know as my 

Re: [rules-users] Run Drool Application From Command Prompt

2009-07-28 Thread Pankaj . Jain
Hi 

you r right, When I run the application (integrated with OFBiz) from 
command prompt  I get the NPE: in line

getClass().getClassLoader().loadClass( 
org.eclipse.jdt.internal.compiler.Compiler );

When I run the application (ofcourse integrated with OFBiz)  from eclipse 
I don't get NPE exception.


In ofbiz we have a batch file named startofbiz.bat to run the application, 
inside this I configured the classpath by this


set VMARGS=-Xbootclasspath/p:applications\order\lib\antlr-runtime.jar
set VMARGS=-Xbootclasspath/p:applications\order\lib\drools-api.jar 
%VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\drools-compiler.jar 
%VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\drools-core.jar 
%VMARGS%
set 
VMARGS=-Xbootclasspath/p:applications\order\lib\drools-decisiontables.jar 
%VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\drools-jsr94.jar 
%VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\drools-templates.jar 
%VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\joda-time.jar %VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\jsr94.jar %VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\jxl.jar %VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\mvel2.jar %VMARGS%
set 
VMARGS=-Xbootclasspath/p:applications\order\lib\org.eclipse.jdt.core_3.4.4.v_894_R34x.jar
 
%VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\xpp3.jar %VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\xpp3_min.jar %VMARGS%
set VMARGS=-Xbootclasspath/p:applications\order\lib\xstream.jar %VMARGS%



If i don't do this I get the class not found exception

Thanks  Regards:

Pankaj Jain | LT infotech |Navi Mumbai
Mobile: +91 9920218945
Email : pankaj.j...@lntinfotech.com
www.Lntinfotech.com

Whatever the mind of man can conceive  believe, it can achieve.

Larsen  Toubro Infotech Ltd.
www.Lntinfotech.com

This Document is classified as: 

LT Infotech Proprietary   LT Infotech Confidential   LT Infotech 
Internal Use Only   LT Infotech General Business 

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. 



Greg Barton greg_bar...@yahoo.com 
Sent by: rules-users-boun...@lists.jboss.org
07/28/2009 11:29 AM
Please respond to
Rules Users List rules-users@lists.jboss.org


To
Rules Users List rules-users@lists.jboss.org
cc

Subject
Re: [rules-users] Run Drool Application From Command Prompt







It's unclear from your post when you get the NPE: from the command line, 
from eclipse, or when integrated with OFBiz. (I assume you're referring to 
http://ofbiz.apache.org/)

It's undoubtedly a classpath issue.  Just peek at the source a bit.  I'm 
not sure what version you're using, but if you look at the source in the 
svn repo you'll see that line 92 of JavaDialectConfiguration is this:

getClass().getClassLoader().loadClass( 
org.eclipse.jdt.internal.compiler.Compiler );

See the javadoc for Class.getClassLoader() that says Returns the class 
loader for the class. Some implementations may use null to represent the 
bootstrap class loader. This method will return null in such 
implementations if this class was loaded by the bootstrap class loader.

So, it looks probable that in the environment that's having problems, the 
JavaDialectConfiguration class is loaded by the bootstrap classloader. 
What is the VM implementation you're using?

It might be best if Thread.currentThread().getContextClassLoader() was 
used instead of getClass().getClassLoader() in JavaDialectConfiguration 
and elsewhere.  Devs, have an opinion on that?

--- On Mon, 7/27/09, pankaj.j...@lntinfotech.com 
pankaj.j...@lntinfotech.com wrote:

 From: pankaj.j...@lntinfotech.com pankaj.j...@lntinfotech.com
 Subject: Re: [rules-users] Run Drool Application From Command Prompt
 To: rules-users@lists.jboss.org
 Date: Monday, July 27, 2009, 11:50 PM
 
 
 Hi
 
 
 
 I still have not got any
 solution
 of my problem that I posted previously. I have included all
 required jar
 files and set proper class path .. Please do help ?
 
 
 
 problem: 
 
 
 
 
 I am trying to
 integrate Drool with
 ofbiz and run application from command prompt. In one way I
 have integrated
 it properly and I am able to run it
 successfully.
 
 
 
 
 Code : Which I was using initially 
 
 
 
 KnowledgeBuilder kbuilder =
 KnowledgeBuilderFactory.newKnowledgeBuilder();
 
 
 
 
 or 
 
 
 
 PackageBuilderConfiguration cfg = new
 PackageBuilderConfiguration();
 
 
 KnowledgeBuilder kbuilder =
 KnowledgeBuilderFactory.newKnowledgeBuilder();
 
 
 
 
 Exception I got : 
 
 
 
 org.drools.RuntimeDroolsException: Unable to load dialect
 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java
 
 
 :org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
 
 
 at
 

Re: [rules-users] Run Drool Application From Command Prompt

2009-07-28 Thread Greg Barton

Well, there you go. :)  Just put drools into the regular classpath and not the 
bootstrap classpath.  Is that possible?

--- On Tue, 7/28/09, pankaj.j...@lntinfotech.com pankaj.j...@lntinfotech.com 
wrote:

 From: pankaj.j...@lntinfotech.com pankaj.j...@lntinfotech.com
 Subject: Re: [rules-users] Run Drool Application From Command Prompt
 To: Rules Users List rules-users@lists.jboss.org
 Date: Tuesday, July 28, 2009, 1:23 AM
 
 
 Hi 
 
 
 
 you r right, When I run
 the application
 (integrated with OFBiz) from command prompt  I get the
 NPE: in line
 
 
 
 getClass().getClassLoader().loadClass(
 org.eclipse.jdt.internal.compiler.Compiler
 );
 
 
 
 When I run the
 application (ofcourse
 integrated with OFBiz)  from eclipse I don't get
 NPE exception.
 
 
 
 
 
 In ofbiz we have a batch
 file named
 startofbiz.bat to run the application, inside this I
 configured the classpath
 by this
 
 
 
 
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\antlr-runtime.jar
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-api.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-compiler.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-core.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-decisiontables.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-jsr94.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-templates.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\joda-time.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\jsr94.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\jxl.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\mvel2.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\org.eclipse.jdt.core_3.4.4.v_894_R34x.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\xpp3.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\xpp3_min.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\xstream.jar
 %VMARGS%
 
 
 
 
 
 
 
 If i don't do this I
 get the class
 not found exception
 
 
 
 Thanks  Regards:
 
 
 
 Pankaj Jain | LT infotech |Navi Mumbai
 
 Mobile: +91 9920218945
 
 Email : pankaj.j...@lntinfotech.com
 
 www.Lntinfotech.com
 
 
 
 Whatever the mind of man can conceive  believe,
 it can achieve.
 
 
 
 Larsen  Toubro Infotech Ltd.
 
 www.Lntinfotech.com
 
 
 
 This Document is classified as: 
 
 
 
 LT
 Infotech Proprietary   LT
 Infotech Confidential   LT
 Infotech Internal Use Only   LT
 Infotech General Business   
 
 
 
 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. 
 
 
 
 
 
 
 
 
 Greg
 Barton greg_bar...@yahoo.com
 
 
 Sent by:
 rules-users-boun...@lists.jboss.org
 07/28/2009 11:29
 AM
 
 
 
 Please respond to
 
 Rules Users List
 rules-users@lists.jboss.org
 
 
 
 
 
 
 To
 Rules Users List
 rules-users@lists.jboss.org
 
 
 cc
 
 
 
 Subject
 Re: [rules-users]
 Run Drool Application
 From Command Prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 It's unclear from your post when you get the NPE: from
 the command line,
 from eclipse, or when integrated with OFBiz. (I assume
 you're referring
 to http://ofbiz.apache.org/)
 
 
 
 It's undoubtedly a classpath issue.  Just peek at
 the source a bit.
  I'm not sure what version you're using, but
 if you look at the source
 in the svn repo you'll see that line 92 of
 JavaDialectConfiguration is
 this:
 
 
 
 getClass().getClassLoader().loadClass(
 org.eclipse.jdt.internal.compiler.Compiler
 );
 
 
 
 See the javadoc for Class.getClassLoader() that says
 Returns the
 class loader for the class. Some implementations may use
 null to represent
 the bootstrap class loader. This method will return null in
 such implementations
 if this class was loaded by the bootstrap class
 loader.
 
 
 
 So, it looks probable that in the environment that's
 having problems, the
 JavaDialectConfiguration class is loaded by the bootstrap
 classloader.
  What is the VM implementation you're using?
 
 
 
 It might be best if
 Thread.currentThread().getContextClassLoader() was
 used instead of getClass().getClassLoader() in
 JavaDialectConfiguration
 and elsewhere.  Devs, have an opinion on that?
 
 
 
 --- On Mon, 7/27/09, pankaj.j...@lntinfotech.com
 pankaj.j...@lntinfotech.com
 wrote:
 
 
 
  From: pankaj.j...@lntinfotech.com
 pankaj.j...@lntinfotech.com
 
  Subject: Re: [rules-users] Run Drool Application From
 Command Prompt
 
  To: rules-users@lists.jboss.org
 
  Date: Monday, July 27, 2009, 11:50 PM
 
  
 
  
 
  Hi
 
  
 
  
 
  
 
  I still have not got any
 
  solution
 
  of my problem that I posted previously. I have
 included all
 
  required jar
 
  files and set proper class path .. 

Re: [rules-users] Problem when using multiple rule files (Drools 5)

2009-07-28 Thread Olaf Raether

The rules and the facts are the same. 

So i add the source to the project and (try to) debug into the code. 
The NPE occurs in the getIndex method (see source fragment below)
and the reader member is NULL. And the only point where reader is set is
in
the setReadAccessor method, but the method is not called in this context.
From my point of view it could be bug and  i will try to create 
a testcase - hope it is reproducible then.


part of ClassFieldReader.java
...
public void setReadAccessor(InternalReadAccessor reader) {
this.reader = reader;
 }

public int getIndex() {
   return this.reader.getIndex();
}
...
-- 
View this message in context: 
http://www.nabble.com/Problem-when-using-multiple-rule-files-%28Drools-5%29-tp24623347p24693274.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] guvnor analysis question/error and scenarios

2009-07-28 Thread phil went
Am running drools 5.0.1 ga using the drools/jboss standalone package.

When I run the analysis from within guvnor, no error comes up in guvnor and
it happily lists the models and attribs, but the following comes up in the
server output:


15:06:15,122 ERROR [STDERR] org.drools.RuntimeDroolsException:
org.drools.verifier.opposites.rule_opposite_literalrestrictions_0eval1invo...@90c73ecd:
java.util.zip.DataFormatException: Value types did not match. Value
type
boolean was compared to boolean
15:06:15,123 ERROR [STDERR] at
org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:122)
15:06:15,123 ERROR [STDERR]


The rules all fire as expected, the scenarios all execute, and the rules
file (in guvnor) all validates OK.

Am a complete java noob, so do not know if it is just something obvious I
have missed about boolean defintions?

Also, when the run all scenarios is run from within guvnor, scenarios are
not updated in the same way as when the scenario is run individually. eg I
ran the tests individually when setting up, and subsequently only ran all
scenarios in batch. Only found out when I ran an xlst on the scenarios to
show off how cool this stuff is to the managers, showing last run and last
results.

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


Re: [rules-users] Run Drool Application From Command Prompt

2009-07-28 Thread Nicolas Héron
Hello,
did you set the java compiler name : JANINO or JAVA ?

2009/7/28 pankaj.j...@lntinfotech.com


 Hi

 I still have not got any solution of my problem that I posted previously. I
 have included all required jar files and set proper class path .. Please do
 help ?

 problem:
  I am trying to integrate Drool with ofbiz and run application from
 command prompt. In one way I have integrated it properly and I am able to
 run it *successfully.*
 *
 Code :* Which I was using initially

 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

 or

 PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
 *
 Exception I got :*

 org.drools.RuntimeDroolsException: Unable to load dialect
 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java
 :org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
 at
 org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
 at
 org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259)


 at
 org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
 at
 org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:153)
 at org.drools.compiler.PackageBuilder.init(PackageBuilder.java:242)
 .
 .
 .
 Caused by: java.lang.NullPointerException
 at
 org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:92)
 at
 org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
 at
 org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:270
 *
 Problem I found : *
 In the class JavaDialectConfiguration in jar file drools-compiler.jar there
 is a method named setCompliler,  in this method Null Pointer Exception was
 coming.
 *
 Solution I provided :*
 In my application I created my custom class CustomJavaDialectConfiguration
 by extending to class JavaDialectConfiguration, In this class I overrided
 the method setCompiler. My method was exactly same as that of method
 setCompiler in JavaDialectConfiguration . To call my dialect class I also
 overrided the method addDialect of PackageBuilderConfiguration class . For
 that I created class CustomPackageBuilderConfiguration by extending to
 PackageBuilderConfiguration.
 after that I wrote the code:

 PackageBuilderConfiguration cfg = new CustomPackageBuilderConfiguration();
 KnowledgeBuilder kbuilder =
 KnowledgeBuilderFactory.newKnowledgeBuilder(cfg);


 Now application is running perfectly fine from both eclipse and command
 prompt without any exception.
 *
 I want to know as my overrided method setCompiler was exactly same then
 why I had to override method, and In original code (ie in
 drools-compiler.jar file) why it was giving exception  ???  Was that due to
 class lader or something else ??  Please do help in this regard *



 Thanks  Regards:

 Pankaj Jain | LT infotech |Navi Mumbai
 Mobile: +91 9920218945
 Email : pankaj.j...@lntinfotech.com
 www.Lntinfotech.com

 Whatever the mind of man can conceive  believe, it can achieve.
 *
 Larsen  Toubro Infotech Ltd.**
 **www.Lntinfotech.com* http://www.lntinfotech.com/

 This Document is classified as:

 LT Infotech Proprietary   LT Infotech Confidential   LT Infotech
 Internal Use Only   LT Infotech General Business

 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


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


[rules-users] Efficiency of using inline evals in Drools 5

2009-07-28 Thread Nancy Dougherty
Hello!

I have a question about how an inline eval function is or isn’t
efficient in the algorithm-  I have many User objects that I am
inserting into Working Memory (in a stateful session), and each User
object has as ArrayList of Messages

The message class has 2 String fields: text and logid

I have custom boolean function user.containsText(String keyword)
function that takes in a string, and searches to see if that keyword
contained in the text field of one of the message entries in the User
message arraylist.  If I use an inline eval statement to implement
this:

$user: User( eval (containsText ( “sample text”) ) )

Will it re-evaluate each time?  Or will Drools cache the result and
remember it/ create a node based on it so the node will have every
user this is true for, and it doesn’t re-evaluate when the users or
rules are modified?  Will it create a node in the algorithm for all
the users that this function is true for?

On a similar note, if I use the “matches” comparator in a rule
creation, does it create a node and cache the result? Will it
automatically re-evaluate each time the field its matched against is
modified?

Thanks so much!

Nancy

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


[rules-users] NPE exception in MarshallerReaderContext

2009-07-28 Thread NKeating


Hi,

I'm getting a NPE exception when using drools-persistence-jpa with Drools Flow
(I'm working with the trunk version 28274).  It occurs in
MarshallerReaderContext (line 78, see link below) and seems to be a result of
JBRULES-2149.  When loading a WorkItemInfo from the database a
MarshallerReaderContext is created without the ruleBase set.  For the moment I
have added another catch block for the NPE and call super.resolveClass(desc).
This seems to be working correctly and would have been the behaviour before
JBRULES-2149.

Should I go ahead and create a JIRA issue for this, or what is the prefered way
to get the fixed in the trunk?

http://fisheye.jboss.org/browse/JBossRules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/MarshallerReaderContext.java?r=27314
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-persistence-jpa/src/main/java/org/drools/persistence/processinstance/WorkItemInfo.java?r=25448
https://jira.jboss.org/jira/browse/JBRULES-2149

Regards,

Noel Keating
Senior Developer
DeCare Systems Ireland

+353 21 492-5188
nkeat...@decaresystems.ie
blog.decaresystems.ie
This e-mail and any files transmitted with it are intended solely for the 
individual or entity to whom they are addressed. 
This communication may contain material that is privileged, confidential and 
protected from disclosure under the law. 
If you are not the intended recipient, any disclosure, distribution, copying, 
or use of this information is strictly prohibited and may be unlawful.


If you have received this e-mail in error, please reply immediately to the 
sender and delete it.


Registered Address:
DeCare Systems Ireland Ltd, 
Building 1, 
University Technology Centre, 
Curraheen Road, 
Cork, 
Ireland. 
Company Registration Number:  278462

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


Re: [rules-users] Run Drool Application From Command Prompt (Close this thread)

2009-07-28 Thread Pankaj . Jain
Hi Greg !!

Now I am able to run the application from command prompt. You were right, 
the problem was of bootstrap class path.
Thank you so much...I really appreciate your help.
Now we can close this thread...

Thanks  Regards:

Pankaj Jain | LT infotech |Navi Mumbai
Mobile: +91 9920218945
Email : pankaj.j...@lntinfotech.com
www.Lntinfotech.com

Whatever the mind of man can conceive  believe, it can achieve.

Larsen  Toubro Infotech Ltd.
www.Lntinfotech.com

This Document is classified as: 

LT Infotech Proprietary   LT Infotech Confidential   LT Infotech 
Internal Use Only   LT Infotech General Business 

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. 



Greg Barton greg_bar...@yahoo.com 
Sent by: rules-users-boun...@lists.jboss.org
07/28/2009 12:02 PM
Please respond to
Rules Users List rules-users@lists.jboss.org


To
Rules Users List rules-users@lists.jboss.org
cc

Subject
Re: [rules-users] Run Drool Application From Command Prompt







Well, there you go. :)  Just put drools into the regular classpath and not 
the bootstrap classpath.  Is that possible?

--- On Tue, 7/28/09, pankaj.j...@lntinfotech.com 
pankaj.j...@lntinfotech.com wrote:

 From: pankaj.j...@lntinfotech.com pankaj.j...@lntinfotech.com
 Subject: Re: [rules-users] Run Drool Application From Command Prompt
 To: Rules Users List rules-users@lists.jboss.org
 Date: Tuesday, July 28, 2009, 1:23 AM
 
 
 Hi 
 
 
 
 you r right, When I run
 the application
 (integrated with OFBiz) from command prompt  I get the
 NPE: in line
 
 
 
 getClass().getClassLoader().loadClass(
 org.eclipse.jdt.internal.compiler.Compiler
 );
 
 
 
 When I run the
 application (ofcourse
 integrated with OFBiz)  from eclipse I don't get
 NPE exception.
 
 
 
 
 
 In ofbiz we have a batch
 file named
 startofbiz.bat to run the application, inside this I
 configured the classpath
 by this
 
 
 
 
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\antlr-runtime.jar
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-api.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-compiler.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-core.jar
 %VMARGS%
 
 set
 
VMARGS=-Xbootclasspath/p:applications\order\lib\drools-decisiontables.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-jsr94.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\drools-templates.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\joda-time.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\jsr94.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\jxl.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\mvel2.jar
 %VMARGS%
 
 set
 
VMARGS=-Xbootclasspath/p:applications\order\lib\org.eclipse.jdt.core_3.4.4.v_894_R34x.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\xpp3.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\xpp3_min.jar
 %VMARGS%
 
 set
 VMARGS=-Xbootclasspath/p:applications\order\lib\xstream.jar
 %VMARGS%
 
 
 
 
 
 
 
 If i don't do this I
 get the class
 not found exception
 
 
 
 Thanks  Regards:
 
 
 
 Pankaj Jain | LT infotech |Navi Mumbai
 
 Mobile: +91 9920218945
 
 Email : pankaj.j...@lntinfotech.com
 
 www.Lntinfotech.com
 
 
 
 Whatever the mind of man can conceive  believe,
 it can achieve.
 
 
 
 Larsen  Toubro Infotech Ltd.
 
 www.Lntinfotech.com
 
 
 
 This Document is classified as: 
 
 
 
 LT
 Infotech Proprietary   LT
 Infotech Confidential   LT
 Infotech Internal Use Only   LT
 Infotech General Business   
 
 
 
 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. 
 
 
 
 
 
 
 
 
 Greg
 Barton greg_bar...@yahoo.com
 
 
 Sent by:
 rules-users-boun...@lists.jboss.org
 07/28/2009 11:29
 AM
 
 
 
 Please respond to
 
 Rules Users List
 rules-users@lists.jboss.org
 
 
 
 
 
 
 To
 Rules Users List
 rules-users@lists.jboss.org
 
 
 cc
 
 
 
 Subject
 Re: [rules-users]
 Run Drool Application
 From Command Prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 It's unclear from your post when you get the NPE: from
 the command line,
 from eclipse, or when integrated with OFBiz. (I assume
 you're referring
 to http://ofbiz.apache.org/)
 
 
 
 It's undoubtedly a classpath issue.  Just peek at
 the source a bit.
  I'm not sure what version you're using, but
 if you look at the source
 in the svn repo you'll see that line 92 of
 JavaDialectConfiguration is
 this:
 
 
 
 getClass().getClassLoader().loadClass(
 org.eclipse.jdt.internal.compiler.Compiler
 );
 
 
 
 See the javadoc for 

Re: [rules-users] Integrating Drools5.0 into J2EE APP

2009-07-28 Thread Sumant Kumar
Thanks for your response. Can we configure Guvnor to use existing production 
SVN repository for version managment like we do for other java projects ?

thanks
Sumant




From: Mauricio Salatino sala...@gmail.com
To: Rules Users List rules-users@lists.jboss.org
Sent: Monday, July 27, 2009 6:34:35 PM
Subject: Re: [rules-users] Integrating Drools5.0 into J2EE APP

2009/7/27 Sumant Kumar amul...@yahoo.com:
 Hi,
 Can somebody describe in a high level how the Drools components (
 Guvnor,Expert, etc) are integrated into J2EE app.
 I am looking for these items as part of Drools deployment configuration

 1) How are rules saved ( File system or DB )
In guvnor (JCR)

 2) How is rule versioning enabled ( with Subversion )
In guvnor (JCR)

 3) Rules and RuleSet granularity . How many rules should go in one DRL.
It depends on your business model

 4) Facts: Are facts defined as POJOs and uploaded to Drools or Declarative
 FACTs are defined in Drools Guvnor
In guvnor (JCR)

 Any links over the web will be great too.
 thanks
 Sam

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





-- 
- http://salaboy.wordpress.com
- 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] Run Drool Application From Command Prompt

2009-07-28 Thread Sumant Kumar
try  including ANTLR.jar in your classpath.




From: pankaj.j...@lntinfotech.com pankaj.j...@lntinfotech.com
To: rules-users@lists.jboss.org
Sent: Tuesday, July 28, 2009 12:50:29 AM
Subject: Re: [rules-users] Run Drool Application From Command Prompt


Hi 

I still have not got any solution
of my problem that I posted previously. I have included all required jar
files and set proper class path .. Please do help ? 

problem:  

I am trying to integrate Drool with
ofbiz and run application from command prompt. In one way I have integrated
it properly and I am able to run it successfully.

Code : Which I was using initially

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); 

or

PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); 

Exception I got :

org.drools.RuntimeDroolsException: Unable to load dialect 
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java 
:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
at 
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
at 
org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259)
 

at 
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
at 
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:153)
at org.drools.compiler.PackageBuilder.init(PackageBuilder.java:242) 
.
.
.
Caused by: java.lang.NullPointerException
at 
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:92)
at 
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
at 
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:270

Problem I found : 
In the class JavaDialectConfiguration in jar file drools-compiler.jar there
is a method named setCompliler,  in this method Null Pointer
Exception was coming.

Solution I provided :
In my application I created my custom class CustomJavaDialectConfiguration
by extending to class JavaDialectConfiguration, In this class I overrided
the method setCompiler. My method was exactly same as that of method setCompiler
in JavaDialectConfiguration . To call my dialect class I also overrided
the method addDialect of PackageBuilderConfiguration class
. For that I created class CustomPackageBuilderConfiguration by extending
to PackageBuilderConfiguration. 
after that I wrote the code:

PackageBuilderConfiguration cfg = new CustomPackageBuilderConfiguration();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(cfg);


Now application is running perfectly fine from both eclipse and command
prompt without any exception.

I want to know as my overrided method setCompiler was exactly
same then why I had to override method, and In original code (ie in 
drools-compiler.jar
file) why it was giving exception  ???  Was that due to class
lader or something else ??  Please do help in this regard 
 
  

Thanks  Regards:

Pankaj Jain | LT infotech |Navi Mumbai
Mobile: +91 9920218945
Email : pankaj.j...@lntinfotech.com
www.Lntinfotech.com

Whatever the mind of man can conceive  believe, it can achieve.

Larsen  Toubro Infotech Ltd.
www.Lntinfotech.com

This Document is classified as: 

LT
Infotech Proprietary   LT
Infotech Confidential   LT
Infotech Internal Use Only   LT
Infotech General Business   

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] Integrating Drools5.0 into J2EE APP

2009-07-28 Thread Mauricio Salatino
I don't think so, because it's based on JCR (and Dublin core standard)
to manage the versions of the assets

2009/7/28 Sumant Kumar amul...@yahoo.com:
 Thanks for your response. Can we configure Guvnor to use existing production
 SVN repository for version managment like we do for other java projects ?
 thanks
 Sumant
 
 From: Mauricio Salatino sala...@gmail.com
 To: Rules Users List rules-users@lists.jboss.org
 Sent: Monday, July 27, 2009 6:34:35 PM
 Subject: Re: [rules-users] Integrating Drools5.0 into J2EE APP

 2009/7/27 Sumant Kumar amul...@yahoo.com:
 Hi,
 Can somebody describe in a high level how the Drools components (
 Guvnor,Expert, etc) are integrated into J2EE app.
 I am looking for these items as part of Drools deployment configuration

 1) How are rules saved ( File system or DB )
 In guvnor (JCR)

 2) How is rule versioning enabled ( with Subversion )
 In guvnor (JCR)

 3) Rules and RuleSet granularity . How many rules should go in one DRL.
 It depends on your business model

 4) Facts: Are facts defined as POJOs and uploaded to Drools or Declarative
 FACTs are defined in Drools Guvnor
 In guvnor (JCR)

 Any links over the web will be great too.
 thanks
 Sam

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





 --
 - http://salaboy.wordpress.com
 - 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





-- 
 - http://salaboy.wordpress.com
 - 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] Using eval in LHS

2009-07-28 Thread PriyaKathan
Thanks to Greg for sending out a simplified example.
I've one more query. Is there any operators to do calculation on fixed time
window?
Here is the scenario.
My data will stream into the engine starting from second 0.

0,0,0,0,1,1,1,1,...60,61...120,121180,181.

If  I want to find average between 0 to 60 sec, that is the previous minute
of 61 to 120, how can I achieve this? I feel sliding window will not help
me.

Suggestions are welcomed.

2009/7/28 Greg Barton greg_bar...@yahoo.com

 See the attached project.  You can run it using maven with this command:

 mvn package exec:java -Dexec.mainClass=com.sample.DroolsTest

 There are three basic rules:

 MakeCollision: Detect that a collision has happened

 MatchCollision: Match vehicles to collisions

 IdentifyLargeCollision: Find collisions that are large

 rule MakeCollision
salience 10
when
s : Sighting( collision == null )
not Collision( direction == s.direction, position ==
 s.position, lane == s.lane )
then
Collision c = new Collision( s.direction, s.position, s.lane
 );
c.getSightings().add( s );
s.setCollision( c );
System.out.println(Creating  + c);
update( s );
insert( c );
 end

 rule MatchCollision
salience 10
when
s : Sighting( collision == null )
c : Collision( direction == s.direction, position ==
 s.position, lane == s.lane )
then
c.getSightings().add( s );
s.setCollision( c );
System.out.println(Matching  + s);
update( s );
update( c );
 end

 rule IdentifyLargeCollision
salience 5
when
num : Number ( intValue  1 )
from accumulate (
Collision( sightings.size  2 ),
init( int count = 0; ),
action( count++; ),
reverse( count--; ),
result( count )
);
then
System.out.println(Found  + num);
 end

 --- On Fri, 7/24/09, nash.8...@gmail.com nash.8...@gmail.com wrote:

  From: nash.8...@gmail.com nash.8...@gmail.com
  Subject: Re: [rules-users] Using eval in LHS
  To: Rules Users List rules-users@lists.jboss.org
  Date: Friday, July 24, 2009, 2:16 PM
  Thanks Greg.
 
  The reason I chose HashMap is that an accident is said to
  occur if and only if more than 1 vehicle contains  four
  consecutive position report as same. So in my hashmap key is
  vehicle id and value is the no. Of times same position
  report received... Can you suggest me a way to
  1. Collect all vehicles stopped at some point and the
  occurance of that event  is reported more than thrice
  2. Report accident if there are more than one vehicle found
  in step 1
 
  ---Priya
  -original message-
  Subject: Re: [rules-users] Using eval in LHS
  From: Greg Barton greg_bar...@yahoo.com
  Date: 24/07/2009 10:36 pm
 
 
  Try this:
 
  rule Create Collision Location
  salience 90
  no-loop true
  when
  vehLoc : VehicleLocation()
  not CollisionLocation(xway == vehLoc.xway,
  pos ==
  vehLoc.pos, dir == vehLoc.dir, lane == vehLoc.lane)
  then
  CollisionLocation collisionLoc = new
  CollisionLocation(vehLoc.getXway(),
  vehLoc.getPos(), vehLoc.getDir(), vehLoc.getLane());
  insert(collisionLoc);
  end
 
  rule Collect Collided Vehicles
  salience 90
  no-loop true
  when
  vehLoc : VehicleLocation()
  $collisionLoc : CollisionLocation(xway ==
  vehLoc.xway, pos ==
  vehLoc.pos, dir == vehLoc.dir, lane == vehLoc.lane)
  then
 
  collisionLoc.getVehicleLocations().add(vehLoc);
  update(collisionLoc);
  end
 
  And now, the rule that detects more than three coinciding
  vehicle locations is simple:
 
  rule Detect Too Many
  when
  CollisionLocation(vehicleLocations.size 
  2)
  then
  ...foo...
  end
 
  And, if you want to make the execution a bit more
  efficient, put a reference in VehicleLocation to it's
  associated CollisionLocation.  That way you can have
  vehLoc : VehicleLocation(collisionLocation == null) to
  reduce partial matches.
 
  --- On Fri, 7/24/09, PriyaSha nash.8...@gmail.com
  wrote:
 
   From: PriyaSha nash.8...@gmail.com
   Subject: [rules-users]  Using eval in LHS
   To: rules-users@lists.jboss.org
   Date: Friday, July 24, 2009, 10:45 AM
  
   Input:
   0,0,107,32,0,0,0,10,53320,-1,-1,-1,-1,-1,-1
   0,0,107,32,0,0,0,10,53320,-1,-1,-1,-1,-1,-1
   0,0,107,32,0,0,0,10,53320,-1,-1,-1,-1,-1,-1
   0,0,107,32,0,0,0,10,53320,-1,-1,-1,-1,-1,-1
   0,0,109,20,0,0,0,19,100644,-1,-1,-1,-1,-1,-1
   0,0,109,20,0,0,0,19,100644,-1,-1,-1,-1,-1,-1
   0,0,106,28,0,0,0,26,137745,-1,-1,-1,-1,-1,-1
   0,0,108,32,0,0,0,67,354281,-1,-1,-1,-1,-1,-1
   

Re: [rules-users] Problem with JPA session persistence in Drools Flow (5.0.1)

2009-07-28 Thread Mauricio Salatino
Ok, I will try to take a look at it.. this week..
I will let you know if I can fix it

2009/7/28 DroolsUser rafiuddin...@gmail.com:
 Mark / salaboy, I am also facing same problem while recreate the session
 from database. Can you advice any alternative, so that I can go forward till
 the next release. Moreover when is the new release is ... Do new release
 will targeting this kind problem? Please suggest any alternative to recreate
 the session from db. Thanks in advance..

 gairey wrote:
 Mark, Done: https://jira.jboss.org/jira/browse/JBRULES-2199 - thanks for the
 quick response. Regards, Alan Mark Proctor Sent by:
 rules-users-boun...@lists.jboss.org 08/07/2009 13:49 Please respond to Rules
 Users List To Rules Users List cc Subject Re: [rules-users] Problem with JPA
 session persistence in Drools Flow (5.0.1) Can you open a JIRA for this, and
 we'll make sure it's done in the next few weeks:
 https://jira.jboss.org/jira/browse/JBRULES thanks Mark
 alan.gai...@tessella.com wrote: I'm currently using Drools Flow with JPA
 session persistence enabled as described in section 5.1 of the User Guide.
 As a process executes, session information is saved to the H2 database
 correctly. The problem comes if a process only executes part way through,
 and I then try to finish the process by recreating a session using the code:
 // recreate the session from database using the sessionId ksession =
 JPAKnowledgeService.loadStatefulKnowledgeSession( sessionId, kbase, null,
 env ); This gives me a NullPointerException. Having looked into the Drools
 Flow source code, I think the problem is in the class
 drools-persistence-jpa\src\main\java\org\drools\persistence\session\SingleSessionCommandService.java.
 The 4th constructor of this class is called as part of the loading of a
 knowledge session from the H2 database; this in turn leads to the
 afterCompletion method of the inner class SynchronizationImpl being called.
 The final two lines of this method are: ((JPAProcessInstanceManager)
 ((ReteooWorkingMemory)
 session).getProcessInstanceManager()).clearProcessInstances();
 ((JPAWorkItemManager) ((ReteooWorkingMemory)
 session).getWorkItemManager()).clearWorkItems(); However, when called via
 the route described above, the session member variable of
 SingleSessionCommandService has not been set, thus causing the
 NullPointerException. (Interestingly, running the unit tests for
 drools-persistence-jpa does result in the NullPointerException being thrown
 multiple times, although the tests are still listed as having passed.) I
 believe enclosing the above two lines as follows will fix the problem: if
 (session != null) { ((JPAProcessInstanceManager) ((ReteooWorkingMemory)
 session).getProcessInstanceManager()).clearProcessInstances();
 ((JPAWorkItemManager) ((ReteooWorkingMemory)
 session).getWorkItemManager()).clearWorkItems(); } Also, in the 4th
 constructor of SingleSessionCommandService, after the session has been set,
 the following line needs to be added to ensure the session id is the same as
 the session info id: ((ReteooStatefulSession) this.session).setId(
 this.sessionInfo.getId() ); (This line is present at the end of the 3rd
 constructor.) It would be great if this fix could make it into the Drools
 5.1 release. Thanks. ___
 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

 
 View this message in context: Re: Problem with JPA session persistence in
 Drools Flow (5.0.1)
 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





-- 
 - http://salaboy.wordpress.com
 - 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] Efficiency of using inline evals in Drools 5

2009-07-28 Thread Edson Tirelli
   Nancy,

   An inline eval will create a constraint in the corresponding node in the
network. I.e., if it is an alpha constraint, the eval() will be added to an
alpha node, or if it is a beta constraint, it will be added to the beta
node.

   If it is an alpha constraint, it will be reevaluated every time the fact
type changes (in your example, every time the engine is notified of a change
in a User fact). If it is a beta constraint, it will be reevaluated every
time the fact changes or a fact matching a previous pattern in the same rule
changes.

   Evals are not indexed, so the reevaluation is a bit more costly. It is
better to avoid them when possible, but sometimes it is not.

   []s
   Edson

2009/7/28 Nancy Dougherty nanc...@stanford.edu

 Hello!

 I have a question about how an inline eval function is or isn’t
 efficient in the algorithm-  I have many User objects that I am
 inserting into Working Memory (in a stateful session), and each User
 object has as ArrayList of Messages

 The message class has 2 String fields: text and logid

 I have custom boolean function user.containsText(String keyword)
 function that takes in a string, and searches to see if that keyword
 contained in the text field of one of the message entries in the User
 message arraylist.  If I use an inline eval statement to implement
 this:

 $user: User( eval (containsText ( “sample text”) ) )

 Will it re-evaluate each time?  Or will Drools cache the result and
 remember it/ create a node based on it so the node will have every
 user this is true for, and it doesn’t re-evaluate when the users or
 rules are modified?  Will it create a node in the algorithm for all
 the users that this function is true for?

 On a similar note, if I use the “matches” comparator in a rule
 creation, does it create a node and cache the result? Will it
 automatically re-evaluate each time the field its matched against is
 modified?

 Thanks so much!

 Nancy

 ___
 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] Problem when using multiple rule files (Drools 5)

2009-07-28 Thread Olaf Raether

now i found out, that my problems are in relation to my serialized
KnowledgePackages.

When i use the following code and load the drl files everything is fine !

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource(rules[i] + .drl)),
ResourceType.DRL); 

But this takes too long, when i used it the first time - so i want to use
serialized 
KnowledgePackages again. 

So my question is: What is the right way to serialize/deserialize 
KnowledgePackages ?

As you have seen in my posts i used standard readObject/writeObject methods.
Is this the right approach ?

Thanks.


-- 
View this message in context: 
http://www.nabble.com/Problem-when-using-multiple-rule-files-%28Drools-5%29-tp24623347p24698087.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] Problem when using multiple rule files (Drools 5)

2009-07-28 Thread Olaf Raether

now i found out, that my problems are in relation to my serialized
KnowledgePackages.

When i use the following code and load the drl files everything is fine !

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource(rules[i] + .drl)),
ResourceType.DRL); 

But this takes too long, when i used it the first time - so i want to use
serialized 
KnowledgePackages again. 

So my question is: What is the right way to serialize/deserialize 
KnowledgePackages ?

As you have seen in my posts i used standard readObject/writeObject methods.
Is this the right approach ?

Thanks.


-- 
View this message in context: 
http://www.nabble.com/Problem-when-using-multiple-rule-files-%28Drools-5%29-tp24623347p24698095.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] Problem when using multiple rule files (Drools 5)

2009-07-28 Thread Erik Clairiot

this approach works fine, I use it this way (import / export)


public CollectionKnowledgePackage importPackages(InputStream input) {
CollectionKnowledgePackage pkgs = Collections.emptyList();

try {
if (input == null || input.available() = 0)
return pkgs;

ObjectInputStream ois = new ObjectInputStream(input);
pkgs = (CollectionKnowledgePackage) ois.readObject();
return pkgs;
} catch (IOException e) {
LOG.warn(IOException during package import :  + 
e.getMessage());
} catch (ClassNotFoundException e) {
LOG.warn(Class saved in the stream does not exists :  
+
e.getMessage());
}
return pkgs;
}


boolean exportPackages(CollectionKnowledgePackage pkgs, OutputStream
output) {
if (pkgs != null  pkgs.size()  0  output != null){
try {
ObjectOutputStream oos = new 
ObjectOutputStream(output);
oos.writeObject(pkgs);
oos.close();
output.close();
return true;
} catch (IOException e) {
LOG.warn(Error exporting rules package :  + 
e.getMessage());
}
}
return false;
}


tune it as you want, hope it helps.

Erik Clairiot


On Tue, 28 Jul 2009 06:50:21 -0700 (PDT), Olaf Raether o.raet...@epro.de
wrote:
 now i found out, that my problems are in relation to my serialized
 KnowledgePackages.
 
 When i use the following code and load the drl files everything is fine !
 
 KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
 kbuilder.add(ResourceFactory.newClassPathResource(rules[i] + .drl)),
 ResourceType.DRL); 
 
 But this takes too long, when i used it the first time - so i want to use
 serialized 
 KnowledgePackages again. 
 
 So my question is: What is the right way to serialize/deserialize 
 KnowledgePackages ?
 
 As you have seen in my posts i used standard readObject/writeObject
 methods.
 Is this the right approach ?
 
 Thanks.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] error in writing test scenarios

2009-07-28 Thread VÅM§Ï ®
Hi ,
While writing the test scenarios,after pressing run scenario button i m
getting the below error in the server and showing an alert technical error
 in the front end .

at java.lang.Thread.run(Thread.java:595)
 Caused by: java.lang.reflect.InvocationTargetException

please tel me reason behind that .
regards,
Vamsi Krishna.Kavuri.
http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] matching multiple facts in a rule using a DSL template

2009-07-28 Thread Erik Clairiot

Hello,

I recently started to use DSL template within my rules.
In the LHS, I oftenly match conditions against multiple facts, facts that I
want to modify in the RHS.

example :

when
  $v1 : Variable(id == A)
  $v2 : Variable(id == B)
then
  $v1.setFoo();
end

If I write a dsl template like that :

[when] there is {id}=v:Variable(id == {id})
[then] foo me=v.setFoo();

and a dsl rule like that

when
  there is A
  there is B
then
  foo me
end

the execution will produce the error Duplicate declaration for variable
...

I understand why it occurs.

how to specify a constraint upon the fact matched ? Dunno if it is
possible, my opinion will be to create another dsl rule, that is supposed
to match with the foo me, but it does not seem to be very convenient.

Is there a way to use an array for variable assignement in the RHS ? like

[when] there is {id}=v[]:Variable(id == {id})
[then] foo me=v[].setFoo();

and use it in the RHS of the rule like

when
  there is A
  there is B
then
 foo me [0] // will cause foo me on the first matched fact
end

There are a lot of chances this does not exist, and works like that, maybe
I am not using DSL well and it is bad idea to match multiple fact with the
same dsl template.

Can someone help me on that ? It is just a question, I am not stuck on
this, but interested on how to deal with that.

Thanks.

Erik

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


[rules-users] How to Enrich Facts with Data from a Database

2009-07-28 Thread Ken Archer

I would like to append values to facts in working memory with
values from a database before rules processing.  The Fusion documentation
says, “one of the most common use cases for rules is event data enrichment”,
but no documentation seems to explain how this is done whether we’re talking
about events or just plain old facts.  And the RHS syntax seems to be
limited to working with data already in working memory.  How can I enrich
facts with data from another system?  Thanks in advance.

 

Ken Archer

Telogical Systems



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


Re: [rules-users] Relation between Guvnor and Expert in Drools5.0

2009-07-28 Thread Vijay Pandey
Guvnor -- This can be used to manage your rules specifically termed as BRMS
(Business Rules Management System). This can really play its part from the
governance perspective in your company/enterprise/project. Take a look at
this URL
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html_
single/index.html#d0e78 mainly section 1.1.1 

 

Expert -- This is the actual runtime/development module for the rule
engine. 

 

Take a look at this part (Chapter 3 - Installation and Setup) of the
documentation
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-introduction
/html_single/index.html#d0e1322 this should help your understanding of
various jars and the modules

 

Regards,

Vijay

  _  

From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Sumant Kumar
Sent: Tuesday, July 28, 2009 4:35 PM
To: Rules Users List
Subject: [rules-users] Relation between Guvnor and Expert in Drools5.0

 

Hi All,

 

Can you throw some light on Relation between Guvnor and

 Expert components in Drools5.0.





Guvnor sounds like BRMS so does it have Rule engine ( or runtime) to execute
rules ?. Is Expert module part of Guvnor ? 





If Guvnor doesn't have rule engine how does it excute rule when we do QA.





I cannot find Expert module for down load. Is Rule engine runtime bunch of
jars ( Drools-core.jar etc )





thanks

Sumant

 

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


[rules-users] Import Existing DRL in Guvnor never finishes

2009-07-28 Thread Steve Ronderos
Hello All,

I'm experiencing an issue importing an existing DRL into Guvnor, we  made 
a sample DRL file containing 1000 very simple rules that look something 
like this:

rule testa4
dialect mvel
when
IOption( selected == false  id == 9934 )
messageSection : INode( id == Drivers )
then
messageSection.setValidationMessage( null );
messageSection.setValidationMessageDuration( null );
end

Each rule has a unique name.  The problem is that the import hasn't 
finished (after over 2 hours) and when we look at the resources that have 
been imported they have 24 revisions each.  It looks like Guvnor is 
importing the file over and over again.

Has anyone experienced anything like this?

Thanks,

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


Re: [rules-users] Issue with operator || in Drools 5.0.1

2009-07-28 Thread Edson Tirelli
   Chris,

   I was not able to reproduce this problem in trunk. Nevertheless, I added
one more integration test for it. If you are able to reproduce it, please
create a test case and open a JIRA and I will check it out.

$ svn commit -m Adding integration test
drools-compiler/src/test/java/org/drools/Person.java
drools-compiler/src/test/java/org/drools/integrationte
sts/MiscTest.java
drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintConnectorOr.drl
Sendingdrools-compiler/src/test/java/org/drools/Person.java
Sending
drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java
Adding
drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintConnectorOr.drl
Transmitting file data ...
Committed revision 28549.

   []s
   Edson

2009/7/28 Chris Gibble cgib...@excite.com

 My apologies if this has already been answered elsewhere -- I searched and
 could not find it.

 I have a java class that takes this form (simplified for purposes of this
 discussion):

 public class MyClass()
 {
public boolean isHappy();
public boolean isHealthy();
 }

 I have a rule that looks like this:

 rule Some rule
 salience 100
 when
  $obj : MyClass(happy == true || healthy == true)
 then
   // Do something with $obj
 end rule



 In Drools 4.x, this rule would perform the conclusion when either
 MyClass.isHappy() returned true or MyClass.isHealthy() returned true, but
 not if both were false.

 In Drools 5.0.1, this rule would perform the conclusion *always* --
 regardless of the values of isHappy() or isHealthy().

 Any ideas what's going on?  Is this a known problem, or is there something
 wrong with my syntax and/or class?



 Thanks for any help you can give -- and I can give a more concrete example
 if need be.
 --
   Bamboo 
 Flooringhttp://tagline.excite.com/fc/FgElN1gz4wwE6UWjuk9HgExVihsl6SoJRYkCYdqtuEKvZKZG6s3cKDjBdiI/
   The
 strong, silent type. Click here for great looking bamboo 
 flooring!http://tagline.excite.com/fc/FgElN1gz4wwE6UWjuk9HgExVihsl6SoJRYkCYdqtuEKvZKZG6s3cKDjBdiI/
   Click
 Here For More 
 Informationhttp://tagline.excite.com/fc/FgElN1gz4wwE6UWjuk9HgExVihsl6SoJRYkCYdqtuEKvZKZG6s3cKDjBdiI/

 ___
 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