Debug rule functions ?
by ipeshev
Hello,
could some give me some tips for debugging *functions* in .drl ?
by now I'm not able to debug *inside the functions* which are called by the
rule sequence.
I follow the
http://docs.jboss.org/tools/3.0.0.GA/en/drools_tools_ref_guide/html_singl...
JBoss Drools Tools Reference Guide but what is show there is how to debug a
very simple *rule sequence*. I have no problem with that - following the
guide everything is ok.
BUT
There is nothing shown about a more complex case when there are functions
(java-like) in the .drl file and the rule calls one or more of these
functions. And one function calls another etc. (just like in normal
programming)
When a put a breakpoint inside functions I cannot debug them.
I can only debug the *rule* ("then" section)
Any help would be appreciated?
Or any official info if this supported at all.
versions etc.
Best Regards
Ivan
--
View this message in context: http://drools.46999.n3.nabble.com/Debug-rule-functions-tp3689774p3689774....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Calling Technical rule assets in Guvnor
by Manasi
Hi,
How to call Technical rule assets stored in Guvnor from Java application?
Currently I have one drl rule which is stored in Technical rule assets
section.
But I am not able to call it from my Java application.
I am using following code to call my rules stored in Guvnor :
UrlResource urlResource = (UrlResource)
ResourceFactory.newUrlResource(http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/GuiKontrolKiss.FeltKnapRestriktionerKundeMedAnl/LATEST");
urlResource .setBasicAuthentication("enabled");
urlResource.setUsername("admin");
urlResource.setPassword("admin");
urlResource.setResourceType(ResourceType.PKG);
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
try {
kbuilder.add(ResourceFactory.newInputStreamResource(urlResource
.getInputStream()), ResourceType.PKG);
} catch (IOException e) {
e.printStackTrace();
}
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
// create session
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
NyssCaseSO caseSO = droolsRequest.getNyssCaseSO();
NyssCaseStateSO caseState = caseSO.getNyssCaseStateSO();
NyssOfferSO offerSO = droolsRequest.getNyssOfferSO();
session.insert(caseSO);
session.insert(offerSO);
session.insert(caseState);
AgendaFilter filter = new AgendaFilter() {
public boolean accept(Activation activation) {
if (activation.getRule().getName().contains("testDrl")) {
return true;
}
return false;
}
};
session.fireAllRules(filter);
for (Object o : session.getObjects()) {
if (o instanceof ResultSO) {
ResultSO resultSO = (ResultSO) o;
reply.setResultSO(resultSO);
}
}
session.dispose();
With above I am able to call my rules stored in *"Business rule assets"*
section.
Thanks,
Manasi
--
View this message in context: http://drools.46999.n3.nabble.com/Calling-Technical-rule-assets-in-Guvnor...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Error in adding BRL in Guvnor
by vargheseps
I have created a Model named applicationHealth which contain a class
“com.xyz.rims.model.Application” on Guvnor.
Also created a Business rule asset named ‘ApplicationHealthRule’ which
uses ‘Application’. I have
created a business rule task in a BPMN2 process and gave the
‘ruleflow-group’ as same as a Business rule assets .
kbuilder.add(ResourceFactory.newUrlResource(DROOLS_COMMON_URL+"ApplicationHealthRule/binary"),
ResourceType.BRL);
I used the above code to add the resource to kbuilder The error I get is:
[Unable to resolve ObjectType 'Application' : [Rule
name='ApplicationHealthRule']
]
--
View this message in context: http://drools.46999.n3.nabble.com/Error-in-adding-BRL-in-Guvnor-tp4020555...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Field value is different when and then section, very strange. Is it mvel vs java issue
by kina06
I have inserted 3 accounts into knowledge session with the following account
statuses 1-NEW, 2-TRANSFER,3-CLOSE.
EXPECTED BEHAVIOR:
As per below given rules, first rule should change all of them to 'pending'
status, so second rule should never fire and third rule always fire for
above 3 accounts.
ACTUAL BEHAVIOR:
second rule is fired for account with new status, i.e. the first one, but in
the system out its status is shown as PENDING before i set it to ERROR.
Can't figure out what's wrong with this, does it has to do anything with
MVEL vs JAVA usage? I mean in when claues it's mvel and in then clause it's
java, so is that causing problem?
rule "Rule1"
salience -1
when
account : Account();
then
System.out.println("Ac state rule1 before change "+
account.getAccountStatus());
account.setAccountStatus( "PENDING" );
System.out.println("Ac state rule1 after change "+
account.getAccountStatus());
end
rule "Rule2"
salience -2
when
account : Account(StringUtils.equals(accountStatus,"NEW"))
then
System.out.println("Ac state RuleNo2 before change "+
account.getAccountStatus());
account.setAccountStatus("ERROR");
System.out.println("Ac state RuleNo2 after change "+
account.getAccountStatus());
end
rule "Rule3"
salience -3
when
account : Account(StringUtils.equals(accountStatus,"PENDING"))
then
System.out.println("Ac state "+ account.getAccountStatus()+ ".
YES
this is expected");
end
--
View this message in context: http://drools.46999.n3.nabble.com/Field-value-is-different-when-and-then-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Re: [rules-users] Basic rules carrying state/field changes.
by Esteban Aliverti
What you need to understand is that rules evaluation and rules execution
happen in different times. Whenever you insert/update(modify)/retract a
fact, all the rules that could potentially match are evaluated by Drools. A
rule having its conditions satisfied generates an ACTIVATION (but the THEN
part is not yet executed). All the ACTIVATIONS are put together in
something called the AGENDA.
When you call fireAllRules() an algorithm (that takes into account the
salience of the rules) gets ONE activation from the AGENDA and executes it
(the THEN part gets executed). If the execution didn't
insert/modify/retract any fact, then another ACTIVATION is selected and
executed until the AGENDA is empty. If an ACTIVATION causes the
insertion/modification/retraction of a fact, then the rules are evaluated
again possibly generating new ACTIVATIONS or cancelling existing ones.
All this should be explained in drools documentation:
Drools Introduction:
http://docs.jboss.org/drools/release/5.5.0.CR1/droolsjbpm-introduction-do...
Drools Expert:
http://docs.jboss.org/drools/release/5.5.0.CR1/drools-expert-docs/html_si...
I'm not in favor of answering Drools related questions arriving directly to
my inbox. This is the last email I'm going to reply to.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
On Tue, Oct 30, 2012 at 5:26 PM, <reachkn6(a)gmail.com> wrote:
>
>
> http://drools.46999.n3.nabble.com/Field-value-is-different-when-and-then-...
>
> Esteban, you seem to understand how Drools Rules work, I'm trying to
> understand how a field value changed in 'then'/consequence be retained so
> next rule can see it.
>
> Posted above is a link for my question, can you help me fix it. Share any
> links that helps me understand how to do it right, I have written about 100
> rules, to my surprise this basic fact that one field changed in rule 1 is
> not visible in rule2, I couldn't test earlier as my data wasn't good enough.
>
> Any help is greatly appreciated.
>
12 years
Guvnor 5.4.Final can't save BPMN process imported from 5.3 repo
by mpgong
Hello,
I'm looking to upgrade to from drools 5.3 to 5.4 and i'm having some issues
with Guvnor. The exported repo from 5.3 imported fine and my packages all
built fine but when i go to edit a process and try to save it, after i click
the check in button i get this error. I'm using designer 2.2 as well. Does
anyone know what might be causing this? Thanks.
18:22:48,601 INFO [org.drools.guvnor.server.RepositoryAssetService]
(http--0.0.0.0-8080-2) USER:admin CHECKING IN asset: [ScheduleReportImport]
UUID: [dc38e1fd-987d-4d31-93db-0bbd2d8034f4]
18:22:48,632 ERROR [org.drools.guvnor.server.RepositoryServiceServlet]
(http--0.0.0.0-8080-2) Service method 'public abstract java.lang.String
org.drools.guvnor.client.rpc.AssetService.checkinVersion(org.drools.guvnor.client.rpc.Asset)
throws com.google.gwt.user.client.rpc.SerializationException' th
rew an unexpected exception: java.lang.NullPointerException:
java.lang.NullPointerException
at org.drools.repository.AssetItem.updateContent(AssetItem.java:390)
[guvnor-repository-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.guvnor.server.contenthandler.drools.BPMN2ProcessHandler.storeAssetContent(BPMN2ProcessHandler.java:155)
[classes:]
at
org.drools.guvnor.server.RepositoryAssetOperations.checkinVersion(RepositoryAssetOperations.java:180)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.guvnor.server.RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.checkinVersion(RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.java)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.guvnor.server.RepositoryAssetService.checkinVersion(RepositoryAssetService.java:155)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientProxy.checkinVersion(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.guvnor.server.RepositoryServiceServlet.checkinVersion(RepositoryServiceServlet.java:596)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[rt.jar:1.7.0_01]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[rt.jar:1.7.0_01]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.7.0_01]
at java.lang.reflect.Method.invoke(Method.java:601)
[rt.jar:1.7.0_01]
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
[gwt-servlet-2.3.0.jar:]
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
[gwt-servlet-2.3.0.jar:]
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
[gwt-servlet-2.3.0.jar:]
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
[gwt-servlet-2.3.0.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.10.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.10.Final.jar:]
at
org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
[solder-impl-3.1.1.Final.jar:3.1.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.10.Final.jar:]
at
org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
[solder-impl-3.1.1.Final.jar:3.1.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.10.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154)
[jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
[jbossweb-7.0.10.Final.jar:]
at
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
[jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-4-Final-can-t-save-BPMN-proces...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Drool rules vs java code, effiency
by kina06
Please don't ignore this question as routine, did google and read posting,
didn't get satisfying answer, hope you guys can help.
I have seen some drool rules in our company, I know drools provide
declarative rules, easy to modify etc etc, but I see it does need some
programming knowledge, so why not put all your rule logic into Java code,
what is drools doing different can't be implemented in Java a separate
package (like your logic package). Except losing flexibility of modify
code/logic in text file I don't see much benefit.
Please help me understand, whats the major benefit of drools rules that
can't be done in Java with same set of concise code.
--
View this message in context: http://drools.46999.n3.nabble.com/Drool-rules-vs-java-code-effiency-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
errors compiling resources (returns a null package)
by Cotton, Ben
Hi,
I am extending the Drools 5.4 templates example (which uses Cheese.drt and ExampleCheese.xls) in effort to learn how to generate a .DRL generically (from my .drt and my .xls).
I am getting these errors:
Error compiling resources:
[ERR 101] Line 7:56 no viable alternative at input '==' in rule "IRS_CURRENCY_RULE_FR_REPOSITORYMOCK_TEMPLATE"
[ERR 101] Line 35:56 no viable alternative at input '==' in rule "IRS_CURRENCY_RULE_FR_REPOSITORYMOCK_TEMPLATE"
Parser returned a null Package
Exception in thread "main" java.lang.IllegalStateException: Error compiling resources
at com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRulesRepoViaDRT.buildKBase(GenerateDRLfromEligibilityRulesRepoViaDRT.java:81)
at com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRulesRepoViaDRT.executeExample(GenerateDRLfromEligibilityRulesRepoViaDRT.java:39)
at com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRulesRepoViaDRT.main(GenerateDRLfromEligibilityRulesRepoViaDRT.java:33)
I wouldn't dare ask anyone on this list to explicitly help debug this for me, however - I have no idea what Line 7:56 and Line 35:56 could be referring to - Line &:56 of what? Could anyone supply some general insight as to what might be problematic?
Thanks, Ben
Ben D Cotton III
Morgan Stanley & Co.
OTC Derivatives Clearing Technology
1221 AOTA Rockefeller Ctr - Flr 27
New York, NY 10020
(212)762.9094
ben.cotton(a)ms.com<mailto:ben.cotton@ms.com>
________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
12 years
Drools planner: unbreakable constraint question
by Michiel Vermandel
Hi,
I have a planning project that is determined by quite some constraints.
Translated in rules this results in a number of hard constraints and a number of soft constraints.
Now I have one rule (hard constraint) that simply many not be broken, never, ever.
If a planning that fails this rule would be executed, we face a lawsuit.
Of course I can (and will) do a post-evaluation to find out if this rule is broken,
but I want to know if there is a possibility in drools planner to forcefully reject any "solution" that breaks this one rule,
continue searching for other solutions and guarantee that the "best solution" will not propose a combination that fails this rule?
Is this possible?
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
12 years
Intercept event handling / why rule salience does not affect execution order?
by jpullmann
Hello,
in my scenario part of the KB is managed by means of "command events".
Rules with a low salience consume these events, assert, modify or retract
facts and remove the command event afterwards. Rules from separate files
with a higher salience are expected to transparently intercept handling
of these commands, but regardless of conditions like read order, salience
value the intercepting rules are called (or not) in an unpredictable
manner.
Example default handler:
rule "Create finite context"
salience -10
when
$start : StartCommand( time < endTime ) from entry-point
"events/context"
not( Context( name == $start.name ) )
then
insert(new TemporalContext( $start.getName(), $start.getTime(),
$start.getEndTime() ));
retract($start);
end
Example intermediary handler:
rule "Intercept context creation"
salience 10
when
$start : StartCommand() from entry-point "events/context"
not( Context( name == $start.name ) )
then
System.out.println( "Context creation intercepted: "+$start);
end
While this roughly worked with Drools 5.4, the results vary significantly
in Drools 5.5.0* for every test run. The salience attribute alone
apparently
does not guarantee for proper invocation of the intermediary handlers ?
Thank you
Jaro
--
View this message in context: http://drools.46999.n3.nabble.com/Intercept-event-handling-why-rule-salie...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years