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