Ruleflow exits before reaching END node?!
by jayadev
RULES:
--------
rule "11"
no-loop true
ruleflow-group "second-rulesgroup"
when
myObj: Test()
eval(true)
then
System.out.println(myObj.getIntField());
end
rule "12"
no-loop true
ruleflow-group "second-rulesgroup"
when
myObj: Test(intField==12345)
then
System.out.println(myObj.getIntField());
myObj.setStringField("rule_12");
end
rule "13"
no-loop true
ruleflow-group "first-rulesgroup"
when
myObj: Test(intField==0)
then
myObj.setIntField(12345);
update(myObj);
System.out.println("Done with rule 13 "+myObj.getIntField());
end
RULE_FLOW:
---------
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="TestFlow" id="TestFlow"
package-name="abc.def.xyz" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="100" y="100" width="48" height="48" />
<ruleSet id="3" name="Second" x="402" y="102" width="118" height="40"
ruleFlowGroup="second-rulesgroup" />
<end id="4" name="End" x="584" y="98" width="80" height="40" />
<ruleSet id="5" name="First" x="227" y="174" width="121" height="40"
ruleFlowGroup="first-rulesgroup" />
<actionNode id="6" name="Action" x="431" y="217" width="80" height="40"
>
<action type="expression" dialect="mvel"
>System.out.println("here");</action>
</actionNode>
</nodes>
<connections>
<connection from="6" to="3" />
<connection from="3" to="4" />
<connection from="1" to="5" />
<connection from="5" to="6" />
</connections>
</process>
Test:
-----
public class Test {
private Integer intField;
private String stringField;
public Integer getIntField() {
return intField;
}
public void setIntField(Integer intField) {
this.intField = intField;
}
public String getStringField() {
return stringField;
}
public void setStringField(String stringField) {
this.stringField = stringField;
}
}
My input Fact:
--------------
Test myObj = new Test();
myObj.setIntField(0);
When I use the following things work fine. I can see all output messages in
order.
final StatefulKnowledgeSession ksession = kb.newStatefulKnowledgeSession();
//Where kb is the knowledgebase built using the above assets
Output Messages:
-----------------
Done with rule 13 12345
here
12345
12345
When I use the following it exits without any errors, but, output messages
are not as expected!
final StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kb, null, env);
Output Messages:
-------------------
Done with rule 13 12345
I am exhausted trying to figure out what is going wrong... Don't know where
to debug! Let me know if more information is needed. I am using Hibernate,
Spring, BTM transaction Manager.
I stumbled across "JBRULES-2718" and thought maybe this is something
similar? I am using 5.1.0
Thank you!
--
View this message in context: http://drools.46999.n3.nabble.com/Ruleflow-exits-before-reaching-END-node...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 3 months
Guvnor service to compile part of a package ?
by Vincent Legendre
Hi all,
I am looking for a clever way to compile only parts of a Guvnor package
according to some criteria on items (categories, metadata ...), but
outside Guvnor if possible.
The main idea starts by the fact that it is a little bit complex for a
business user to manage packages and compilations, and even more if he
has to manage conditional compilations (using selectors) of a single
package to produce multiple KB compiled according to business criterions.
I want to compile automatically some KB according to categories (more
generally asset's fields) with something external to Guvnor. Thus I need
a way to query Guvnor repository with criterion to get either :
- the corresponding ressources (DRL)
- the filtered compiled KB (PKG ressource)
Filtering with DRL (like custom selectors in Guvnor) will be perfect,
using a custom class too.
Is there such service ?
Does the KnowledgeAgent allow filtering (did not see anything in docs) ?
Or do I need to add a new service in Guvnor war directly ?
Thanks!
15 years, 3 months
Drools 5.1 - exception when trying to use incremental KB updates.
by Stephen Mcgruer
Just moved to Drools 5.1, using a Guvnor package as the base for a
Knowledge Base with incremental updating enabled. Our resource is a
Guvnor PKG. We encounter the following error when a snapshot is made:
[2010:08:224 16:08:903:debug] KnowledgeAgent: Diffing: [UrlResource
path='http://localhost:1337/drools-guvnor/org.drools.guvnor.Guvnor/package/TEST...']
[2010:08:224 16:08:935:debug] BinaryResourceDiffProducerImpl:
Comparing [Rule name=Resource Null-Checker, agendaGroup=MAIN,
salience=0, no-loop=false] against [Rule name=Resource Null-Checker,
agendaGroup=MAIN, salience=0, no-loop=false]
Exception in thread "Thread-30" org.drools.RuntimeDroolsException:
java.lang.reflect.InvocationTargetException : [Rule name=Resource
Null-Checker, agendaGroup=MAIN, salience=0, no-loop=false]
at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
at
org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
at
org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
at
org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
... 6 more
Caused by: java.lang.RuntimeException: this MVELReturnValueExpression
must be compiled for equality
at
org.drools.base.mvel.MVELReturnValueExpression.equals(MVELReturnValueExpression.java:123)
at
org.drools.rule.ReturnValueRestriction.equals(ReturnValueRestriction.java:306)
at
org.drools.rule.ReturnValueConstraint.equals(ReturnValueConstraint.java:121)
at java.util.Arrays.equals(Unknown Source)
at org.drools.rule.OrConstraint.equals(OrConstraint.java:132)
at java.util.AbstractList.equals(Unknown Source)
at org.drools.rule.Pattern.equals(Pattern.java:317)
at org.drools.rule.GroupElement.equals(GroupElement.java:273)
at
org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
at
org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
... 11 more
The rule in question is quite straight-forward, works on the initial
load up and worked in 5.0.1 fine. It is not the rule that was just
changed. If I remove that rule, another is just substituted in its
place in the error message.
What might be causing this? If you need more information, please ask.
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 3 months
Getting a NamespaceException when building the rule package
by aldrinbondoc
Hi All,
We are trying to build the rule package in Guvnor via HTTP request, since
compilation is not readily available via RestAPI, we developed a custom web
service that will handle our request and trigger invoke a drools api that
would compile the rule package.
The problem is when we tried to invoke the compilation via HTTP request we
are encountering this exception:
org.drools.repository.RulesRepositoryException:
javax.jcr.NamespaceException: drools: is not a registered namespace prefix.
Here is what we saw from the log file.
2011-05-10 10:30:06,753 ERROR [STDERR] Caused by:
javax.jcr.NamespaceException: drools: is not a registered namespace prefix.
2011-05-10 10:30:06,753 ERROR [STDERR] at
org.apache.jackrabbit.core.NamespaceRegistryImpl.getURI(NamespaceRegistryImpl.java:516)
2011-05-10 10:30:06,753 ERROR [STDERR] at
org.apache.jackrabbit.core.LocalNamespaceMappings.getURI(LocalNamespaceMappings.java:166)
2011-05-10 10:30:06,753 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.NameParser.parse(NameParser.java:116)
2011-05-10 10:30:06,764 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.ParsingNameResolver.getQName(ParsingNameResolver.java:62)
2011-05-10 10:30:06,764 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:144)
2011-05-10 10:30:06,764 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:57)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver.getQPath(ParsingPathResolver.java:60)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:77)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver.getQPath(DefaultNamePathResolver.java:69)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:649)
2011-05-10 10:30:06,788 ERROR [STDERR] at
org.apache.jackrabbit.core.NodeImpl.resolveRelativeNodePath(NodeImpl.java:209)
2011-05-10 10:30:06,788 ERROR [STDERR] at
org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2468)
2011-05-10 10:30:06,788 ERROR [STDERR] at
org.drools.repository.migration.MigrateDroolsPackage.needsMigration(MigrateDroolsPackage.java:19)
2011-05-10 10:30:06,796 ERROR [STDERR] at
org.drools.repository.RulesRepository.checkForDataMigration(RulesRepository.java:103)
Has anyone encountered the same exception before? Your response would be
very much appreciated. Thanks!
BTW. We have BRMS 5.0 hosted on Jboss EAP 4.3.0 application server.
--
View this message in context: http://drools.46999.n3.nabble.com/Getting-a-NamespaceException-when-build...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 3 months
guvnor repository export zip corrupted... debugging ideas?
by Permar, Justin
Good afternoon,
We have an interesting issue that's recently popped up in our Drools Guvnor 5.1.0 war deployment. When we use the Guvnor webapp to download the repository as a zip export (or, alternatively, GET /org.drools.guvnor.Guvnor/backup), the download completes, but the zip file is corrupted (i.e., cannot be opened with 7-Zip). Taking a look at the code (https://github.com/droolsjbpm/guvnor/blob/master/guvnor-webapp/src/main/j... ), I can't see any obvious problem. The only thought that came to mind is that the the servlet never performs an res.getOutputStream().close(), but then again, this servlet has worked fine for us in other deployments. Moreover, no errors are either displayed to the user (I noticed that the "doGet" method returns any exceptions over the OutputStream) or logged to file.
Does anyone have a suggestion on how to continue debugging this problem?
Thanks in advance.
Justin
This e-mail message, including any attachments, is for the
sole use of the intended recipient(s) and may contain
private, confidential and/or privileged information. Any
unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient,
employee or agent responsible for delivering this message,
please contact the sender by reply e-mail and destroy all
copies of the original e-mail message.
15 years, 3 months
Drools Flow - Wait State - How to use ruleflow variables in the constraint?
by Anderson Neves
Hi everybody.
I am using Drools 5.1.1 with persistence support. In the Wait State node I
only have the option to write a constraint in the rule way, and I have not
discovered how to use a variable of the ruleflow in it. Please, see the
hypothetical scenario below:
variable - a variable of the ruleflow that has the same attribute as the
class of the example
attribute - an atribute of the class of the example
Type - the class of the example
Constraint with mvel dialect:
Type(attribute == variable.attribute)
The error is something like there is no getVariable() in the class Type.
Thank you very much for the help
Regards,
Anderson
15 years, 3 months
FW: Basic rules question
by Abhay B. Chaware
Wendy,
Thanks for helping me out so far.
I have another question. What if I have all my "RAM" objects inserted into working memory. How should I write my rule's "when" portion to get a collection of all the RAM objects matching type "DDR" ? In other words, can I get collection of facts assigned to a variable and use it in the "then" part ?
Thanks
Abhay
==================================
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wendy Mungovan
Sent: Friday, May 06, 2011 5:47 PM
To: Rules Users List
Subject: Re: [rules-users] Basic rules question
Q2:
So the rule would be something like:
rule "RAM type"
when
$product: Product(type == "laptop");
then
//you are looking for the best way to set valid RAM types in the then part of the rule?
$product.setRamType("DDR");
//or
$product.setValidRamOptions( getValidRamOptions("DDR"));
end
where getValidRamOptions would be a custom function included through 'import function' so you can then load the choices from some where else. Or if RamOptions were an object in memory you could have a rule like:
rule "RAM type"
when
$product: Product(type == "laptop");
$ramOptions: RAMOptions(type == "DDR");
then
$product.setValidRamOptions( $ramOptions.getList());
end
Wendy
==================================
Regards,
Abhay Chaware
Sr. Designer | KPIT Cummins Infosystems Ltd | Board: +91 020 6652 5000 | Extn: 2989 | abhay.chaware(a)kpitcummins.com |www.kpitcummins.com
P Please consider the environment before printing this e-mail
________________________________
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wendy Mungovan
Sent: Friday, May 06, 2011 5:47 PM
To: Rules Users List
Subject: Re: [rules-users] Basic rules question
Abhay,
Q1: I think that this will depend on how many different products you have. If there is a small number it is more straight forward to have a rule for each one (so the 2nd option). This allows all you logic to be in one place. If there are a large number of products and writing a rule for each one is intractable you probably would want to look into some generalizations of the rules. Is that helpful?
Q2: I'm not quite sure what you are getting at in Q2. Are you trying to write validation rules or rules that are modifying the facts?
Wendy
________________________________
From: Abhay B. Chaware <Abhay.Chaware(a)kpitcummins.com>
To: "rules-users(a)lists.jboss.org" <rules-users(a)lists.jboss.org>
Sent: Fri, May 6, 2011 4:59:46 AM
Subject: [rules-users] Basic rules question
Hi
I am a newbie to rule based applications and trying to get the concept of rules. I have couple of questions about rules to start with, not specifically about Drools though.
Q1 - Should rules be data/model specific or can/should they be generic or both
==========================================================
e.g.
If selected product "TYPE" is "laptop", then category "RAM" should have all "DDR" type items compatible ( selecting items matching certain property )
OR
If selected product is "IBM T42", then category "RAM" should have "512MB DDR" , "1024MB DDR", "2048MB DDR" compatible. ( assigning individual items in rules )
OR
Combination of both
Q2 - How should be the data modeled in above case
==========================================================
e.g.
in product master, each item ( e.g. T40, T42 ) should have a "TYPE" ( e.g. desktop or laptop ) , all items in category "RAM" should have a "TYPE" ( e.g. DDR ) and then control the assignment of RAM options to the PRODUCT through Rule using "DDR" type ?
OR
in product master, each item ( e.g. T40, T42 ) should have a "TYPE" ( e.g. desktop or laptop ) , all items in category "RAM" should have a "compatibleProduct" column ( e.g. desktop or laptop ) and control the assignment of RAM to PRODUCT through "dynamic" rules by selecting all the RAMs by passing the "TYPE" of the product to the database handler.
Am I making my point clear ?
Thanks
Abhay
This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.
15 years, 3 months
SPREADSHEET DECISION TABLE: Can I use functions into CONDITIONS?
by zeta
HI!, I need to check if a given date is between two dates. So, I would like
to call a function that calculates if the given date is between other
two(specifically, between current date and current date plus some months,
and the variable "months" changes dynamically). I tried to write a
function(inside spreadsheet) that receives the date and the variable months
but does not compile. I have found not samples about functions used into
condition part so I am wondering if that is the problem. If it is the case,
what can i do?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/SPREADSHEET-DECISION-TABLE-Can-I-use-fu...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 3 months
Guvnor 5.2.0.M2 and User Permissions
by Dean Whisnant
I've downloaded 5.2.0.M2 to test out known issues we were having in 5.1.1 and many of them appear to have been resolved. One thing I noticed in 5.2.0.M2 is that when I import my exported 5.1.1 repository, the User Permissions tab appears to have lost any permissions I had setup under 5.1.1, including the administrator permissions for the admin user.
When I modify the components.xml to say true for role based permissions, I can no longer login to guvnor, I just keep getting user does not have permissions, never seeing the login prompt.
I have then gone back out and changed the components.xml to false, stopped and restarted Tomcat and Guvnor, logged in, added admin as an administrator, changed the roles based flag, stopped and restarted things, and get the same message that the user has no permissions. This comes up without any login window asking for a user name.
Is there something about importing a 5.1.1 repository that is giving me issues here? Is it Tomcat as the app server? Or are there known issues with roles based still and I should wait for CR1?
On another note, I love how snappy it feels in Safari. Things look much more crisp overall.
Thank you!
Dean
15 years, 3 months
Firing the rule at the basis of time
by saurabh maheshwari
Hi ,
how i can put a filter in the rule for particular time of the day
Suppose fire the rule at 23:10 to 1:20
I have the one timestamp field in the class.
can we put such a filter in rule or i 'll have to inside the code for each
rule since each rule has different timer. ?
Thanks ,
Saurabh
15 years, 3 months