[rules-users] Using rule flow in Guvnor

2010-08-09 Thread Dinesh kumar

Hi,

I am having an issue in implementing the rule flow in guvnor.

I created a simple rule flow using eclipse plug in. 

http://drools-java-rules-engine.46999.n3.nabble.com/file/n1057004/rules.jpg 

I checked the rule flow model in eclipse using the green tick mark and it
showed Drools flow model checked successfully. My .rf and .rfm files were
created.

But when I imported .rf file in my guvnor and build the package I am getting
the following error : Unable to parse xml

When i checked the server log, only this was printed : 
(null: 1, 93): cvc-elt.1: Cannot find the declaration of element
'org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper'.




This is the source of the generated .rfm file


  

  1
  
1
Start


  
1


  ailmentreserves
  2
  AilmentReserves
  

  
  

  1
  
  
benefitreserves
3
BenefitReserves

  


  
1


  4
  End
  

  
  

  

  

  

  

  


  2
  


  3
  


  4
  

  
  
  4
  resistrationflow
  RuleFlowTest
  1.0
  RuleFlow
  HealthCareTest



Am I missing anything. Should the package name in the eclipse same as the
package I use in guvnor ?
I have only the rule flow file in Eclipse and remaining are written directly
in guvnor. 

Any hint on this will be of great help.


Regards,
Dinesh
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Using-rule-flow-in-Guvnor-tp1057004p1057004.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] Using rule flow in Guvnor

2010-08-09 Thread Dinesh kumar

Sorry, my .rfm file was not pasted properly in the previous post


I checked the rule flow model in eclipse using the green tick mark and it
showed Drools flow model checked successfully. My .rf and .rfm files were
created. But when I imported .rf file in my guvnor and build the package I
am getting the following error : Unable to parse xml When i checked the
server log, only this was printed : (null: 1, 93): cvc-elt.1: Cannot find
the declaration of element
'org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper'. 

org.drools.ruleflow.core.impl.RuleFlowProcessImpl id=1
  nodes id=2
entry
  long1/long
  org.drools.ruleflow.core.impl.StartNodeImpl id=3
id1/id
nameStart/name
incomingConnections id=4/
outgoingConnections id=5
  org.drools.ruleflow.core.impl.ConnectionImpl id=6
type1/type
from class=org.drools.ruleflow.core.impl.StartNodeImpl
reference=3/
to class=org.drools.ruleflow.core.impl.RuleSetNodeImpl
id=7
  ruleFlowGroupailmentreserves/ruleFlowGroup
  id2/id
  nameAilmentReserves/name
  incomingConnections id=8
org.drools.ruleflow.core.impl.ConnectionImpl
reference=6/
  /incomingConnections
  outgoingConnections id=9
org.drools.ruleflow.core.impl.ConnectionImpl id=10
  type1/type
  from
class=org.drools.ruleflow.core.impl.RuleSetNodeImpl reference=7/
  to class=org.drools.ruleflow.core.impl.RuleSetNodeImpl
id=11
ruleFlowGroupbenefitreserves/ruleFlowGroup
id3/id
nameBenefitReserves/name
incomingConnections id=12
  org.drools.ruleflow.core.impl.ConnectionImpl
reference=10/
/incomingConnections
outgoingConnections id=13
  org.drools.ruleflow.core.impl.ConnectionImpl id=14
type1/type
from
class=org.drools.ruleflow.core.impl.RuleSetNodeImpl reference=11/
to
class=org.drools.ruleflow.core.impl.EndNodeImpl id=15
  id4/id
  nameEnd/name
  incomingConnections id=16
org.drools.ruleflow.core.impl.ConnectionImpl
reference=14/
  /incomingConnections
  outgoingConnections id=17/
/to
  /org.drools.ruleflow.core.impl.ConnectionImpl
/outgoingConnections
  /to
/org.drools.ruleflow.core.impl.ConnectionImpl
  /outgoingConnections
/to
  /org.drools.ruleflow.core.impl.ConnectionImpl
/outgoingConnections
  /org.drools.ruleflow.core.impl.StartNodeImpl
/entry
entry
  long2/long
  org.drools.ruleflow.core.impl.RuleSetNodeImpl reference=7/
/entry
entry
  long3/long
  org.drools.ruleflow.core.impl.RuleSetNodeImpl reference=11/
/entry
entry
  long4/long
  org.drools.ruleflow.core.impl.EndNodeImpl reference=15/
/entry
  /nodes
  variables id=18/
  lastNodeId4/lastNodeId
  idresistrationflow/id
  nameRuleFlowTest/name
  version1.0/version
  typeRuleFlow/type
  packageNameHealthCareTest/packageName
/org.drools.ruleflow.core.impl.RuleFlowProcessImpl

Am I missing anything. Should the package name in the eclipse same as the
package I use in guvnor ? I have only the rule flow file in Eclipse and
remaining are written directly in guvnor. Any hint on this will be of great
help. Regards, Dinesh 


-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Using-rule-flow-in-Guvnor-tp1057004p1057128.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] Is nested loops possible ?

2010-08-06 Thread Dinesh kumar

Hi,

I am having a problem in iterating a list inside a list. 

I am having the following business scenario.

Public Class CustomerOrder {

private String customerName;

private ArrayListOrder orderList;

}


Public Class Order {

private String orderId;

private String orderTime;

private ArrayListOrderItem orderList;

}


Public Class OrderItem {

private String itemName;

private Double itemAmount;

}


I need to find the total order amount for each order and the sum of all
order. 
My rule is like individual orders should not exceed a 1 and total order
amount of all customers should not exceed 10.

For this, I need to iterate ArrayListOrder orderList and during each
iteration , I need to iterate ArrayListOrderItem orderList. Is this
possible in Drools ?


I tried something like this. But it doesn't seem to be working.
when

ClaimRegistration($orderList: orderList)

Number( $count : intValue  0) 
from accumulate(Order(orderId== order1
 
 Number( doubleValue  1 )
 from accumulate( OrderItem( $value : itemAmount),
 init( double total = 0; ),
 action( total += $value; ),
 reverse( total -= $value; ),
 result( total ) )


) from $orderList,count(1))


then

Sysout(,);



It would be of great help if any one can give suggestions to solve this.

Is nested loops possible in Drools ?


Regards,
Dinesh

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Is-nested-loops-possible-tp1029366p1029366.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] are for loops possible in drools

2010-08-02 Thread Dinesh kumar

Hi,

I faced a similar problem. This thread helped me to solve the issue. this
keyword is working fine for me. U can check whether it is supported in your
version. I am using 5.0.1

But even this keyword works for me, I am facing another problem.

The then block executed for every success in the block
i.e., say there are 10 items in the list and 5 of the matches the regex,
then the when block executed 5 times.

Is this the only way to iterate a loop..?
My business scenario involves nested for loops. Is it possible in drools..?

How do I write a nested for loop. Remember that my inner for loop requires
values from the outer loops and this inner loops will go up to 3 or 4
levels. Is it possible and even if it is possible, will the coding become so
complex so that the business user who is going to use it may not understand
??

Kindly advice.

Regards,
Dinesh
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/are-for-loops-possible-in-drools-tp1011729p1016053.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] Rules integration with Java -need help

2010-07-30 Thread Dinesh kumar

Hi,

Thanks for your reply. 
Things are working. :)

Regards,
Dinesh
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Rules-integration-with-Java-need-help-tp966070p1008950.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] How to Iterate list in drools

2010-07-30 Thread Dinesh kumar

Hi,

I am facing problems in iterating a list in guvnor.

I tried the following code and it worked.

import java.util.ArrayList;
rule createValidationReport
dialect 'java'
when
ClaimRegistration($ailmentList : ailmentListFromScreen)
then
for(String ailment : (ArrayListString) $ailmentList){
System.out.println(ailment  +ailment);
}
System.out.println(then);
end


But my requirement is to iterate the list in the when block and process
something based on the data in the list.

It should be something like 

import java.util.ArrayList;
rule createValidationReport
dialect 'java'
when

ClaimRegistration($ailmentList : ailmentListFromScreen)
for(String ailment : (ArrayListString) $ailmentList){
System.out.println(ailment  +ailment);
// My condition needs to be evaluated here
}
then

System.out.println(then);

end


Need help on this issue. Is this possible in Drools? 
kindly advice.

Regards,
Dinesh

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-Iterate-list-in-drools-tp1008987p1008987.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] Rules integration with Java -need help

2010-07-14 Thread Dinesh kumar

Hi,

Need help in integrating guvnor with my java application.

I have the set rules to executed for a particular module as individual
packages within guvnor. To fire these rules, I have separate properties file
specifying the URL of each package and mention it within the application as
below.


For module1:

Properties properties = new Properties();
properties.load(new FileInputStream(module1PropertiesFilePath));
RuleAgent agent = RuleAgent.newRuleAgent(properties);
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(module1Object);
workingMemory.fireAllRules();


For module2:

Properties properties = new Properties();
properties.load(new FileInputStream(module2PropertiesFilePath));
RuleAgent agent = RuleAgent.newRuleAgent(properties);
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(module2Object);
workingMemory.fireAllRules();


My properties file looks like this. There will be one properties file for
each module.


##
## RuleAgent configuration file example
##

#setting this means the rulebase will be created fresh whenever there are
#changes
newInstance=true

#this points to a binary compiled rule package, you can have spaces
#seperating multiple files
#file=/foo/bar/boo.pkg /foo/bar/boo2.pkg

#this specifies that packages may appear in a directory
#it will pick up whatever files are dumped in there (.pkg files like above)
#dir=/my/dir

#this specifies a list of urls for packages - these urls
#are those that are exposed by the BRMS
url=
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Module1/LATEST
#the following can be used with the urls to keep a local cache
#so if the runtime server is restarted, the BRMS does not need
#to be available
#localCacheDir=

#this specifies the frequency at which the sources will be checked for
#changes (in seconds). If you don't set this, it will mean that you have
#to manually poll
poll=30


#this specifies the name of this config, necessary in case logging is used.
name=MyConfig


Instead of specifying the url in the properties file, can i directly have
the url in my java..
How to directly specify the url in java instead of using properties file?

Any suggestions will be of great help..

Regards,
Dinesh

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Rules-integration-with-Java-need-help-tp966070p966070.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] Calling a rule within a rule

2010-06-02 Thread Dinesh kumar

Hi, 
Thanks for your reply. The explanation of rule evaluation flow is really
good.

Solution 1: I cannot use all the rules in a single rule because actual rules
are very complicated and in real scenarios i will actually have many rules
within a single rule and on success of that I need to execute another rule. 
Also, I need to return different messages based on rules. If Rule1 fails i
needs return message 1 and rule 2 fails i need to return message 2. But,
there is no point in executing Rule 2 when Rule 1 fails.

Solution 2: As you said will be easy to implement. But , I believe it might
affect the performance and may not be a feasible solution. Anyways, the idea
is quite simple and smart. Thanks for the idea.

Solution 3 : I need to explore on what is Logical insert as I have very
little idea on what it is. I will give a try with this..

Thank again for your help. I was exploring ways to call a rule within a
rule. You made it clear.. !!!


Dinesh kumar


-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Calling-a-rule-within-a-rule-tp863409p864648.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] Drools 5.0.1 in eclipse having memory issue

2010-06-02 Thread Dinesh kumar

I think this might help you.
I was working in GWT project before and I had similar issue. 
Try the following

1. Windows - Preferences
2. Java - Installed JREs
3. Select the JRE and click on Edit
4. Add the follwing in VM arguments -Xmx1024M
Please ensure that you have minimum RAM of 2 GB to use 1024MB for your JVM. 

The following link will give better idea with screen shots

http://dinu.blog.com/2010/06/02/out-of-memory/
http://dinu.blog.com/2010/06/02/out-of-memory/ 

Regards,
Dinesh kumar
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-0-1-in-eclipse-having-memory-issue-tp859684p864750.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] Calling a rule within a rule

2010-06-01 Thread Dinesh kumar

Hi All,

I am new to Drools and I need a help.

Is it possible to call a rule within a rule.
i.e., only when rule1 condition is true , my rule2 should execute

rule1 
when a!=null 
then
...

rule2
when a.toString() !=
then
...

Though i can write both the conditions in the same rule, its not a feasible
solution as my business rules are much complicated. I am expecting to write
something like this..


rule1 
when a!=null 
then

when a.toString() !=
then
...

end
end

But this is not working out. It would be great if someone can help me out..
Also I understood that variables cannot be declared in guvnor.. Is this
true..? If true then what is an alternative. Kindly help me








Regards,
Dinesh
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Calling-a-rule-within-a-rule-tp863409p863409.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2010-05-26 Thread Dinesh kumar

Hi,
I am trying to configure Drools Guvnor with MySql. I am using JBoss 4.0 . I
searched the web and changed my repository.xml that was created in my
JBoss/bin . But I am getting one exception after another and finally I am
struck up in this exception. Any help on this will be of great help..


deploy, ctxPath=/drools-guvnor,
warUrl=.../tmp/deploy/tmp48046drools-guvnor-exp.war/
14:01:01,820 INFO  [STDOUT] ERROR 26-05 14:01:01,820
(BundleDbPersistenceManager.java:loadBundle:1228)failed to read bundle:
cafebabe-cafe-babe-cafe-babecafebabe: java.lang.IllegalStateException:
URIIndex not valid? javax.jcr.NamespaceException: URI for index 11 not
registered.
14:01:01,930 INFO  [STDOUT] ERROR 26-05 14:01:01,930
(ConnectionRecoveryManager.java:logException:447)could not execute
statement, reason: The statement was aborted because it would have caused a
duplicate key value in a unique or primary key constraint or unique index
identified by 'SQL100526101110450' defined on 'DEFAULT_BUNDLE'., state/code:
23505/2
14:01:01,930 INFO  [STDOUT] ERROR 26-05 14:01:01,930
(BundleDbPersistenceManager.java:storeBundle:1270)   failed to write bundle:
cafebabe-cafe-babe-cafe-babecafebabe
ERROR 23505: The statement was aborted because it would have caused a
duplicate key value in a unique or primary key constraint or unique index
identified by 'SQL100526101110450' defined on 'DEFAULT_BUNDLE'.
at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
at
org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown
Source)
at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown 
Source)
at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source)
at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown 
Source)
at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown
Source)
at
org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown
Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown 
Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown
Source)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:365)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:292)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237)
at
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:1267)
at
org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:703)
at
org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.store(AbstractBundlePersistenceManager.java:643)
at
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.store(BundleDbPersistenceManager.java:526)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.createRootNodeState(SharedItemStateManager.java:1084)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.init(SharedItemStateManager.java:194)
at
org.apache.jackrabbit.core.RepositoryImpl.createItemStateManager(RepositoryImpl.java:1201)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(RepositoryImpl.java:1753)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:1724)
at
org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:576)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:415)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:305)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:557)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:245)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:265)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:333)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:363)
at
org.drools.guvnor.server.repository.BRMSRepositoryConfiguration.newSession(BRMSRepositoryConfiguration.java:112)
at

Re: [rules-users] Problem using Oracle as data repository for Guvnor 5.0.0.M4

2010-05-26 Thread Dinesh kumar

Hi,,
I have the same problem. Is there any solution for this..

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Problem-using-Oracle-as-data-repository-for-Guvnor-5-0-0-M4-tp58866p844751.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