2 Drools Rules in one DRL file and second Rule is not firing.
by Joe Donnelly
Hi All,
I'm new to drools and using 5.2.0
I have 2 test cases I want to run on my test xml files
1. Is the xml node there
2. Does it match XSD data type pattern
The XML file contents is loaded into a DTO(which has sub DTOs) and the DTO
is passed to the RuleService
I created one rule file called F1.drl with 2 rules in it.
rule "F1 - Exists"
when
fact : basicFact()
ojb1 : ObjectDTO() from fact.Objects
not(String() from ojb1.node1())
then
System.out.println("Missing Node Data");
end
rule "F1- Pattern Match"
when
fact : basicFact()
ObjectDTO( node1 not matches
"^[\\S]{1,100}$") from fact.Objects
then
System.out.println("Bad Node value");
end
test.java has 2 junit test cases
@test for TestFailExists.XML
@Test for TestFailPattern.XML
Regardless of which rule is first the first is only one that fires on the
file that it would apply to.
I tried commenting out 1 rule and the other works fine and vice versa. I
even tried separating the
Into separate DRL files which worked as expected.
Hopefully someone can shed some light on this for me
Thank you for your time,
Joe
12 years, 7 months
Drools variables
by skatta1986
Hi,
Could you please answer my queries:
1. Can we create int variable inside LHS (when)? If yes please give me an
example
2. I have a gobal variable which I want to use in timer(int : <variable> s)
and also in after[0s, <variable> s)
timer is accepting global variable but after is giving error.
[74,200]: [ERR 102] Line 74:200 mismatched input 'after' in rule
"EVENT_SUCCESS"
[0,0]: Parser returned a null Package
Please help out me in this. I would like to use a global variable which can
be changed at runtime.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-variables-tp3935404p3935404.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
[Drools.5.0.1] insertLogical abnormalities
by Stathis Rouvas
Hi List.
I am using Drools.5.0.1.
I am experiencing abnormalities using insertLogical(),
namely that in the following code
RaResultCode and RegistryUsed are found inserted (using the relevant queries), while
InternalResultCode is not found (using the query "get ircQuery")
and I cannot explain why this is hapenning.
The code in question is:
query "get RaCode"
rrc : RaResultCode()
end
query "get RaRegUsed"
regUsed : RegistryUsed()
end
query "get ircQuery"
irc : InternalResultCode()
end
rule "r5"
no-loop true
dialect "mvel"
when
gnId : GoodNumbers()
not ( logg : InternalResultCode( ruleId=="5", goodNo==gnId.goodNo) )
LogicalValue : HeaderMessage( gnId.goodNo==goodNo , totalItemNo == 3 )
v261 : t2206( )
then
InternalResultCode irrc = new InternalResultCode();
irrc.setRuleId("5");
irrc.setGoodNo(gnId.goodNo);
insertLogical(irrc);
RaResultCode rrc = new RaResultCode();
rrc.setResultRuleId("5");
rrc.setResultGoodNo(gnId.goodNo);
insertLogical(rrc);
RegistryUsed ruv261 = new RegistryUsed();
ruv261.setResultGoodNo(gnId.goodNo);
ruv261.setRegRowId(v261.regRowId);
ruv261.setVersionId(v261.versionId);
ruv261.setRuleId("5");
insertLogical(ruv261);
end
Using a statefull session,
the KnowledgeBase is created,
then 26 facts for "t2206" and one fact for "HeaderMessage" are inserted and finally
fireAllRules() is called.
Afterwards the defined queries are used to gather the results, but as noted in the begininning
results for "InternalResultCode", are missing.
There should be one for each of the "InternalResultCode", "RaResultCode" and "RegistryUsed" entities.
Can anyone shed some light?
Thank you for your time,
-Stathis
12 years, 7 months
please provide a rule for events timeout cases
by skatta1986
Hi,
I would like to write a rule for events timeout case.
Consider the events EventRecord(type=EventRequest, id=1) and
EventRecord(type=EventResponse, id=1).
I have written rules (in .drl file) for correlting the event request with
event response.
Now I would like to write timeout case. Suppose
EventRecord(type=EventRequest, id=2) is not followed by its response. If we
doesn't recieve response within 10 seconds, then it is considered as timeout
case.
I tried to use timers but it doen't work as it is not allowing me write
inside when (LHS) pattern.
Is there any other way to find timeout cases?
--
View this message in context: http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeou...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Re: [rules-users] Fwd: Re: make the Guvnor interface into French
by Qchevalier
Thank you for your answer.
No, I didn't tag the corrections. I will do the fork.
Your link<https://hudson.jboss.org/hudson/job/droolsjbpm-knowledge/lastSuccessfulBu...>doesn't
work, I got this :
HTTP Status 404 -
------------------------------
*type* Status report
*message*
*description* *The requested resource () is not available.*
------------------------------
JBoss Web/2.1.12.GA-patch-03
*Sorry for the delay :), **I was in holidays **.
Regards,
Quenitn
*
2012/4/7 Vincent Legendre [via Drools] <
ml-node+s46999n3892685h2(a)n3.nabble.com>
> This is exactly what I did. This procedure works like a charm.
>
> You said "a lot" of errors ? I can't be possible :) !!
> Did you tag your corrections ? the NWELL ?
>
>
> -------- Message original --------
> Sujet: Re: [rules-users] make the Guvnor interface into French Date : Fri,
> 6 Apr 2012 21:27:47 +0100 De : Michael Anstis [hidden email]<http://user/SendEmail.jtp?type=node&node=3892685&i=0> Répondre
> à : Rules Users List [hidden email]<http://user/SendEmail.jtp?type=node&node=3892685&i=1> Pour :
> Rules Users List [hidden email]<http://user/SendEmail.jtp?type=node&node=3892685&i=2>
>
>
> Hi Quentin,
>
> The droolsjbom-build-bootstrap\README.md is a good source (and kept up to
> date).
>
> The simplest (and preferred) approach might be to fork the github
> repository, apply your changes and submit a pull request.
>
> Please see here<https://hudson.jboss.org/hudson/job/droolsjbpm-knowledge/lastSuccessfulBu...>for more information.
>
> With kind regards,
>
> Mike
>
>
> On 6 April 2012 10:53, Qchevalier <[hidden email]<http://user/SendEmail.jtp?type=node&node=3892685&i=3>
> > wrote:
>
>> Hello,
>>
>> I got your last file (Constants_fr_FR.properties) Vincent, but I found a
>> lot
>> of errors. So here is my corrected file :
>> http://drools.46999.n3.nabble.com/file/n3889908/Constants_fr_FR.properties
>> Constants_fr_FR.properties
>>
>> I didn't manage to integrate this file into the guvnor war file.
>>
>> I understood that I have to rebuild the sources of guvnor, but I didn't
>> manage to do it. I found several documentations about "how to build guvnor
>> sources" but each time it was either old instructions, either partial
>> instructions.
>>
>> Can you share a good instruction source?
>>
>> Thanks & Regards,
>>
>> Quentin
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/rules-users-make-the-Guvnor-interface-i...
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=3892685&i=4>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=3892685&i=5>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://drools.46999.n3.nabble.com/rules-users-make-the-Guvnor-interface-i...
> To unsubscribe from [rules-users] make the Guvnor interface into French, click
> here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscr...>
> .
> NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_vi...>
>
--
View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-Fwd-Re-make-the-Guvnor-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Exception when building a template
by Sean Su
I am using 5.4.0.CR1 to build a template (decision table) but regardless
what I do, I will get this exception from the first column.
Are we aware of any known issues in this build? Or the way I am using the
tool is wrong? I can provide the repository if it helps.
Thanks
Sean
ERROR 19-04 15:25:31,518 (LoggingHelper.java:error:74) Unable to build
asset.
java.lang.IllegalArgumentException: value Lower Range is not a valid column
definition
at
org.drools.template.parser.ColumnFactory.getColumn(ColumnFactory.java:34)
at
org.drools.template.parser.DefaultTemplateContainer.parseTemplate(DefaultTemplateContainer.java:93)
at
org.drools.template.parser.DefaultTemplateContainer.<init>(DefaultTemplateContainer.java:47)
at
org.drools.template.DataProviderCompiler.compile(DataProviderCompiler.java:56)
at
org.drools.guvnor.server.util.BRDRTPersistence.marshal(BRDRTPersistence.java:57)
at
org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.getSourceDRL(BRLContentHandler.java:84)
at
org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.compile(BRLContentHandler.java:61)
at
org.drools.guvnor.server.builder.PackageAssemblerBase.compile(PackageAssemblerBase.java:88)
at
org.drools.guvnor.server.builder.PackageAssemblerBase.buildAsset(PackageAssemblerBase.java:72)
at
org.drools.guvnor.server.builder.AssetItemValidator$BuilderValidator.validate(AssetItemValidator.java:57)
at
org.drools.guvnor.server.builder.AssetItemValidator.validate(AssetItemValidator.java:44)
at
org.drools.guvnor.server.RepositoryAssetOperations.validateAsset(RepositoryAssetOperations.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44)
at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
at
org.drools.guvnor.server.RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.validateAsset(RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.java)
at
org.drools.guvnor.server.RepositoryAssetService.validateAsset(RepositoryAssetService.java:338)
at
org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientProxy.validateAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)
at
org.drools.guvnor.server.RepositoryServiceServlet.validateAsset(RepositoryServiceServlet.java:388)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
--
"But beware of the Dark Side. Anger, fear, aggression - the Dark Side of
the Force are they." -Yoda
12 years, 7 months
Re: [rules-users] Rules and Ruleflow GroupS
by Welsh, Armand
You understand the problem well enough.
I have never used agenda-group option, and am very fuzzy on how to implement it. I know I should look into it, and I should understand it better, to have a better grasp of all the options available to me. The drools expert documentation just isn't too clear on this feature, and I haven't had the time to explore it in code yet.
Thanks for your input, it's always good to hear other's opinions.
Armand
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Vincent LEGENDRE
Sent: Monday, April 23, 2012 10:52 AM
To: Rules Users List
Subject: Re: [rules-users] Rules and Ruleflow GroupS
Tell me if I understand well :
- you have a set of "lookup" rules that are independent of initial data in the WM
- you have another set of "lookup" rules that depends of data currently in the WM, that should trigger in the middle of data processing. In this second group, some business rules can update a fact that should immediately lead to insertion of other object via the lookup rules ?
Clearly, the second is the problematic one if it must be immediate ... If you can delay the insertion, I can't see why you can't place them in a separate ruleflow group (and the ruleflow-group identifier is reused in multiple main ruleflows ...)
May be you can use agenda groups here. All the 'same function' lookup rules could be placed in the same agenda-group, with auto-focus to true. And you then have to add some control rules that give focus to you data-lookup group when you need. This is one way I know that allow to trigger a group of rules in the middle of other rules execution. The other way is control facts ... In summary, you have the choice between adding control fact in each condition, or set an agenda-group and auto-focus on each rule + a main control rule. I prefer the agenda-group option because once the control rule done, you can add rules to the group by declaring its group whether that adding a condition (which should be reserved to business logic in a ideal system).
----- Mail original -----
De: "Armand Welsh" <AWelsh(a)statestreet.com>
À: "Rules Users List" <rules-users(a)lists.jboss.org>
Envoyé: Lundi 23 Avril 2012 19:03:17
Objet: Re: [rules-users] Rules and Ruleflow GroupS
Thanks for the feedback
Yeah.. my rules deal with data transformation. We convert vendor feed data to internal data for making trade decisions. So we have large data sets that need to be evaluated. So instead of inserting all data into working memory from our lookup tables in our DB, I have lookup rules that get just the data needed for the datasets. These rules insert just those lookup facts that are needed for the rules. Since many rules can share a common lookup criteria, I don't lookup use the from condition on each rule, instead I use the from condition on the lookup rule, that extracts the facts I need and inserts just those facts into working memory. The reason for this, is that inserting into working memory is a costly process. So inserting 100 facts is less intensive than inserting 10,000 facts, when I only need 100 for that specific set of data.
Most lookups can happen before any processing, because the bound conditions are set before execution, and they don't change. However, I have a small set of lookups that occur more than once, because they are based on fields that are generated by other rules, and each time the value changes, I need to the lookup to be reactivated, but I could benefit from having my lookup rules in their own rule flow group, and a small subset of those also in the data manipulation rule flow group, so that they get preloaded before any data processing decisions are made, and then they re-fire during data processing the dependent facts change.
I guess I will just have to use a processing control fact to prevent firing my lookup rules until I know the lookup has either completed, or failed to find lookup values.
Regards,
Armand
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Vincent LEGENDRE
Sent: Monday, April 23, 2012 9:26 AM
To: Rules Users List
Subject: Re: [rules-users] Rules and Ruleflow GroupS
No you can't ... or I really don't know how ..
You can duplicate a ruleflow group in a ruleflow (if your rule is only dependant of others rules in the same "group"), but if a rule is a subpart of multiple groups ... well ... I think you can't avoid to write your own agenda filter, or try to use agenda groups.
----- Mail original -----
De: "Armand Welsh" <AWelsh(a)statestreet.com>
À: "Rules Users List" <rules-users(a)lists.jboss.org>
Envoyé: Lundi 23 Avril 2012 17:59:24
Objet: [rules-users] Rules and Ruleflow GroupS
A while back, I was looking to use Ruleflow-Groups and a process flow. Due to some issues in the code that affected the use of the process flow, I was unable to use them. I believe those issues have been worked out, and now I am looking into using them again.
One thing I am not clear on, is if I can have a single rule participate in more than one ruleflow group?
Regards,
Armand
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
12 years, 7 months
Nested class, BRL and Java (error)
by TonyN
Hi,
I have nested classes in the domain model and I imported these nested
classes in order to use them in the guided editor. Things are ok except
when one of the rule required a custom java function, then I would get an
error at 'build' package time (the error is 'not able to resolve
TcItem$Dataset'). I think the compiler didn't like the '$' in the list of
imported statements. But if I don't import these nested classes, I won't be
able to use them in the guided editor.
I am new to Drools so I think there must be a way to be able to use nested
class (w/ '$') and custom java functions together.
Please advise.
I am using Guvnor 5.2 final.
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Nested-class-BRL-and-Java-error-tp39324...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Rules and Ruleflow GroupS
by Welsh, Armand
A while back, I was looking to use Ruleflow-Groups and a process flow. Due to some issues in the code that affected the use of the process flow, I was unable to use them. I believe those issues have been worked out, and now I am looking into using them again.
One thing I am not clear on, is if I can have a single rule participate in more than one ruleflow group?
Regards,
Armand
12 years, 7 months