<br> Ok, thanks for checking. I just opened a ticket:<br><br><a href="http://jira.codehaus.org/browse/MVEL-200">http://jira.codehaus.org/browse/MVEL-200</a><br><br> Meanwhile, what I can suggest is a workaround, adding a helper method to the BlacklistItemDRL that returns the pattern ready for use:<br>
<br>onBlackList : ArrayList( size > 0 ) from collect( <br> BlacklistItemDRL( blacklistItemType matches "MAIL_DOMAIN",<br> customer.currentContactInformation.partyEmailAddress.email<br>
<div id=":1hq" class="ii gt"> matches blacklistItemValuePattern )<br> from blackList.getItems())<br>
</div><br> As soon as MVEL is fixed, should be just a matter of updating the jar.<br><br> Edson<br><br><br><div class="gmail_quote">2010/1/15 Lukas Svoboda <span dir="ltr"><<a href="mailto:lukasvoboda@googlemail.com">lukasvoboda@googlemail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I tried the latest MVELs 2.0.15 and 2.0.16 and no luck.<br>
<br>
The error message says now:<br>
<div class="im"> [java] Unable to determine the used declarations.<br>
</div> [java] [Error: unexpected symbol ' ']<br>
[java] [Near : {... s.email ~= ( ".*@" + blacklist ....}]<br>
[java] ^<br>
[java] [Line: 1, Column: 61] : [Rule name='BL: Block mail domain']<br>
<div><div></div><div class="h5"><br>
<br>
<br>
Edson Tirelli-4 wrote:<br>
><br>
> The error message you reported means that MVEL could not properly parse<br>
> this expression:<br>
><br>
> ".*@" + blacklistItemValue + ".*"<br>
><br>
> What is obviously strange, but that is what the error message says.<br>
><br>
> Quick try is: download and replace the mvel jar you have (should be<br>
> mvel<br>
> version 2.0.10) by the newest one from here (2.0.15):<br>
><br>
> <a href="http://mvel.codehaus.org/Downloading+MVEL" target="_blank">http://mvel.codehaus.org/Downloading+MVEL</a><br>
><br>
> I did not tested the new mvel for regressions, but you might get lucky.<br>
> Otherwise, please open a jira against Drools adding your test case and we<br>
> will make sure it gets fixed and updated.<br>
><br>
> Thanks,<br>
> Edson<br>
><br>
> 2010/1/14 Lukas Svoboda <<a href="mailto:lukasvoboda@googlemail.com">lukasvoboda@googlemail.com</a>><br>
><br>
>><br>
>> I'm not sure whether mvel version matters for compilation of drools,<br>
>> anyway<br>
>> I'm using mvel2.jar distributed in drools5.0.1-binaries.<br>
>><br>
>> I'm more suspicious whether it's related to compiler since it requires<br>
>> eclipse jdt (I'm using org.eclipse.jdt.core_3.4.2.v_883_R34x.jar) unlike<br>
>> drools 4.0.7 I was using originally.<br>
>><br>
>> Do I have to setup somehow KnowledgeBuilder by creating custom<br>
>> KnowledgeBuilderConfiguration.<br>
>><br>
>> I assume default is java dialect with Eclipse compiler. Is it right?<br>
>><br>
>> Lukas<br>
>><br>
>><br>
>><br>
>> Edson Tirelli-4 wrote:<br>
>> ><br>
>> > What version of MVEL are you using?<br>
>> ><br>
>> > Edson<br>
>> ><br>
>> > 2010/1/13 Lukas Svoboda <<a href="mailto:lukasvoboda@googlemail.com">lukasvoboda@googlemail.com</a>><br>
>> ><br>
>> >><br>
>> >> I'm getting some generic not-anything-saying error message:<br>
>> >> [java] Unable to determine the used declarations.<br>
>> >> [java] unexpected symbol ' ' : [Rule name='BL: Block mail domain']<br>
>> >><br>
>> >> When I remove that concatenated matches expression (".*@" +<br>
>> >> blacklistItemValue + ".*") it compiles.<br>
>> >><br>
>> >> Complete rule looks like:<br>
>> >> rule "BL: Block mail domain" ruleflow-group "black-list"<br>
>> >> salience 1001<br>
>> >> when<br>
>> >> not RejectionResult();<br>
>> >><br>
>> >> customer : CustomerPartyDRL();<br>
>> >> blackList: BlacklistDRL();<br>
>> >><br>
>> >> onBlackList : ArrayList( size > 0 )<br>
>> >> from collect( BlacklistItemDRL( blacklistItemType<br>
>> matches<br>
>> >> "MAIL_DOMAIN" &&<br>
>> >> customer.currentContactInformation.partyEmailAddress.email<br>
>> >> matches blacklistItemValue )<br>
>> >> from blackList.getItems())<br>
>> >> then<br>
>> >> auditLogger.addDeclineRule( "BL: Block mail domain " +<br>
>> >><br>
>> >><br>
>> >><br>
>> customer.getCurrentContactInformation().getPartyEmailAddress().getEmailLowercase());<br>
>> >><br>
>> >> RejectionResult rejection = new OrderRejectionResult(<br>
>> );<br>
>> >> rejection.setMessage("BL: Block mail domain " +<br>
>> >><br>
>> >><br>
>> >><br>
>> customer.getCurrentContactInformation().getPartyEmailAddress().getEmailLowercase());<br>
>> >><br>
>> >> insert( rejection );<br>
>> >><br>
>> >> end<br>
>> >><br>
>> >><br>
>> >> And fragment of the code I'm using to compile rule package is:<br>
>> >><br>
>> >> Reader testSource = new<br>
>> >><br>
>> >><br>
>> InputStreamReader(RuleCompiler.class.getResourceAsStream("/perthTestRule.drl"));<br>
>> >> Reader sourceFlow = new<br>
>> >><br>
>> >><br>
>> InputStreamReader(RuleCompiler.class.getResourceAsStream("/perthScoreCustomerFlow.rf"));<br>
>> >><br>
>> >> // add the package to a rulebase (deploy the rule<br>
>> >> package).<br>
>> >> KnowledgeBase kbase =<br>
>> >> KnowledgeBaseFactory.newKnowledgeBase();<br>
>> >> KnowledgeBuilder kbuilder =<br>
>> >> KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
>> >><br>
>> >><br>
>> >> kbuilder.add(ResourceFactory.newReaderResource(testSource),<br>
>> >> ResourceType.DRL);<br>
>> >><br>
>> >> kbuilder.add(ResourceFactory.newReaderResource(sourceFlow),<br>
>> >> ResourceType.DRF);<br>
>> >><br>
>> >> System.out.println(kbuilder.getErrors().toString());<br>
>> >><br>
>> >> Collection<KnowledgePackage> pkgs =<br>
>> >> kbuilder.getKnowledgePackages();<br>
>> >><br>
>> >> try {<br>
>> >> kbase.addKnowledgePackages(pkgs);<br>
>> >><br>
>> >> StatefulKnowledgeSession ksession =<br>
>> >> kbase.newStatefulKnowledgeSession();<br>
>> >><br>
>> >> System.out.println("Knowladge session<br>
>> >> initialized...");<br>
>> >> } catch (Exception e) {<br>
>> >> e.printStackTrace();<br>
>> >> }<br>
>> >><br>
>> >><br>
>> >> Edson Tirelli-4 wrote:<br>
>> >> ><br>
>> >> > It should work... what error do you see?<br>
>> >> ><br>
>> >> > Edson<br>
>> >> ><br>
>> >> > 2010/1/13 Lukas Svoboda <<a href="mailto:lukasvoboda@googlemail.com">lukasvoboda@googlemail.com</a>><br>
>> >> ><br>
>> >> >><br>
>> >> >> How can I get drools 5.0.1 compiled if I have regular expression<br>
>> >> matches<br>
>> >> >> part<br>
>> >> >> concat from static text + dynamic string?<br>
>> >> >><br>
>> >> >> See example:<br>
>> >> >> onBlackList : ArrayList( size > 0 )<br>
>> >> >> from collect( BlacklistItemDRL( blacklistItemType<br>
>> >> matches<br>
>> >> >> "MAIL_DOMAIN" &&<br>
>> >> >> customer.currentContactInformation.partyEmailAddress.email<br>
>> >> >> matches (".*@" + blacklistItemValue + ".*") )<br>
>> >> >> from blackList.getItems())<br>
>> >> >><br>
>> >> >><br>
>> >> >> Problem is when I'm trying to do email matches (".*@" +<br>
>> >> >> blacklistItemValue<br>
>> >> >> +<br>
>> >> >> ".*"), which worked in drools 4.0.7 but can't be compiled now in<br>
>> 5.0.1<br>
>> >> >><br>
>> >> >> Is there any way how to use in matches part of reg exp dynamic<br>
>> >> property<br>
>> >> >> value plus static string?<br>
>> >> >><br>
>> >> >> Thanks,<br>
>> >> >> Lukas<br>
>> >> >> --<br>
>> >> >> View this message in context:<br>
>> >> >><br>
>> >><br>
>> <a href="http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p119197.html" target="_blank">http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p119197.html</a><br>
>> >> >> Sent from the Drools - User mailing list archive at Nabble.com.<br>
>> >> >> _______________________________________________<br>
>> >> >> rules-users mailing list<br>
>> >> >> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> >> >> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>> >> >><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > --<br>
>> >> > Edson Tirelli<br>
>> >> > JBoss Drools Core Development<br>
>> >> > JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > rules-users mailing list<br>
>> >> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> >> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>> >> ><br>
>> >> ><br>
>> >><br>
>> >> --<br>
>> >> View this message in context:<br>
>> >><br>
>> <a href="http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p119353.html" target="_blank">http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p119353.html</a><br>
>> >> Sent from the Drools - User mailing list archive at Nabble.com.<br>
>> >> _______________________________________________<br>
>> >> rules-users mailing list<br>
>> >> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> >> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>> >><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Edson Tirelli<br>
>> > JBoss Drools Core Development<br>
>> > JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
>> ><br>
>> > _______________________________________________<br>
>> > rules-users mailing list<br>
>> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>> ><br>
>> ><br>
>><br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p120451.html" target="_blank">http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p120451.html</a><br>
>> Sent from the Drools - User mailing list archive at Nabble.com.<br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Edson Tirelli<br>
> JBoss Drools Core Development<br>
> JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
<br>
--<br>
</div></div>View this message in context: <a href="http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p121944.html" target="_blank">http://n3.nabble.com/Drools-5-0-concat-string-in-matches-of-regular-expression-tp119197p121944.html</a><br>
<div><div></div><div class="h5">Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>