[rules-dev] MVEL in functions?

Mark Proctor mproctor at codehaus.org
Mon Oct 12 18:55:10 EDT 2009


As MVEL functions can't be called directly from java, this doesn't work yet.

I did get MVEL functions to work from the drools-clips module, so there 
is some plumbing for this. We'd probably have to generate stab wrappers 
to get MVEL functions working in DRL itsef, so both java and mvel 
semantics can call it.

Mark
Michael Neale wrote:
> OK created this: https://jira.jboss.org/jira/browse/JBRULES-2298
>
> On Tue, Oct 13, 2009 at 9:38 AM, Michael Neale <michael.neale at gmail.com> wrote:
>   
>> Hi Steve - yes that seems to work - hence why I have not noticed it
>> before. I wonder with 4.0.x if it was actually using MVEL for the
>> function body, or flipping back to the java dialect (which is what
>> happens when you put it in a different DRL now).
>>
>> On Tue, Oct 13, 2009 at 1:24 AM, Steve Ronderos <steve.ronderos at ni.com> wrote:
>>     
>>> Hi Michael,
>>>
>>> We are experiencing the same issue.  We have had to put our functions in a
>>> different .drl to get around this for now.  If it helps any, this was
>>> working ok in version 4.0.7, and broke when we went to 5.0.1.
>>>
>>> Thanks,
>>>
>>> Steve Ronderos
>>>
>>> rules-dev-bounces at lists.jboss.org wrote on 10/11/2009 11:52:04 PM:
>>>
>>>       
>>>> [image removed]
>>>>
>>>> [rules-dev] MVEL in functions?
>>>>
>>>> Michael Neale
>>>>
>>>> to:
>>>>
>>>> Rules Dev List
>>>>
>>>> 10/11/2009 11:53 PM
>>>>
>>>> Sent by:
>>>>
>>>> rules-dev-bounces at lists.jboss.org
>>>>
>>>> Please respond to Rules Dev List
>>>>
>>>> Hey is mvel in functions broken? I have a distant memory of something
>>>> along these lines. I was just trying something like:
>>>>
>>>> package jboss.cloud
>>>>
>>>> dialect "mvel"
>>>>
>>>>
>>>> #trying to get functions working...
>>>> rule "something"
>>>>     when
>>>>         s: SimpleFact(id == 42, name == "michael")
>>>>     then
>>>>         System.out.println("hello");
>>>> end
>>>>
>>>> function String doSomething() {
>>>>  return "hey";
>>>> }
>>>>
>>>> And I get:
>>>>
>>>> java.lang.NullPointerException
>>>>    at org.drools.rule.builder.dialect.mvel.MVELDialect.compile
>>>> (MVELDialect.java:510)
>>>>    at org.drools.rule.builder.dialect.mvel.MVELDialect.addFunction
>>>> (MVELDialect.java:338)
>>>>    at
>>>> org.drools.compiler.PackageBuilder.addFunction(PackageBuilder.java:1104)
>>>>    at
>>>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:626)
>>>>    at org.drools.compiler.PackageBuilder.addPackageFromDrl
>>>> (PackageBuilder.java:290)
>>>>    at org.drools.compiler.PackageBuilder.addKnowledgeResource
>>>> (PackageBuilder.java:488)
>>>>    at org.drools.builder.impl.KnowledgeBuilderImpl.add
>>>> (KnowledgeBuilderImpl.java:25)
>>>>
>>>> (haven't tried trunk) - anyone else seen this?
>>>> removing the dialect "mvel" at the package level at it is fine.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Michael D Neale
>>>> home: www.michaelneale.net
>>>> blog: michaelneale.blogspot.com
>>>> _______________________________________________
>>>> rules-dev mailing list
>>>> rules-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>>>         
>>> _______________________________________________
>>> rules-dev mailing list
>>> rules-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>>
>>>
>>>       
>>
>> --
>> Michael D Neale
>> home: www.michaelneale.net
>> blog: michaelneale.blogspot.com
>>
>>     
>
>
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20091012/ed34fdb5/attachment.html 


More information about the rules-dev mailing list