The only requirement in this case is that when you create the
KnowledgeBuilder and starting adding the resources to it (DRL, flows, dsls,
etc), a given resource can only reference an asset that was previously
loaded. So, you must make sure the DRL with your functions is the first
resource to be added. Other than this, everything else should work just
fine.
[]s
Edson
2009/6/18 Chris Richmond <crichmond(a)referentia.com>
Yes….for the most part, a non developer wouln’t be able to write
the
rules anyway….you need someone with domain knowledge of the objects being
injected, so I don’t see a non developer writing rules. I was trying to
take the approach that if, from the application code perspective, I only
worrry about injecting objects I wish to reason on, and not try to think of
new functions, new stats/bookkeeping classe I might need..if I can
demonstrate doing that all within the rule, it seems to show it’s
flexibility more than having to modify your codebase(beyond simple
session/api calls) to analyze those objects you are injecting.
One think to keep in mind is that I am utilizing mainly Fusion…since I am
dealing with sensor type data simply being fed into the system
contintuously, so It’s very fluid as to the types of calculations/rules I
might have to implement compared perhaps with a standard business object
type of data. I want to become a guru and munging, creating, and using all
sorts of constructs within Fusion for being able to accomplish almost any
rule withought having to do anything besides simply injecting my sensor data
ojbects into the memory stream…in my mind, that will lead me to the greatest
flexibility and demostration of the power of being able to add the rules
engine onto an already fully functioning and robust application that was
written without planning for rules automation.
I should mention I do not use the eclipse plugin or eclipse at all for my
rules testing/development, so I don’t have any issues with eclipse plugin
not breaking.
So….assuming I **did** want to put a simple function in my .drl
file….*where* do I have to put it? My oringal question about how to make a
simple function declaration is still a mystery to me.
Thanks
Chris
------------------------------
*From:* rules-users-bounces(a)lists.jboss.org [mailto:
rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Edson Tirelli
*Sent:* Thursday, June 18, 2009 2:25 PM
*To:* Rules Users List
*Subject:* Re: [rules-users] functions
Chris,
I understand. Although functions in DRL files where conceived to be very
simple things to reside with the rules. So, although you can have a DRL file
with all your functions and, as long as this file is the first you load into
your knowledge builder, use the functions on other files, we did not
implement any king of specific multifile import... meaning that the eclipse
plugin, for instance, will raise errors when accessing functions from one
file into another... but your application will run fine...
Regarding recompiling the application, I think you just said that
meaning recompiling the java file with the functions right? since the java
file can be anywhere, including your domain model jar or even in a jar by
himself... in any case, be it a function or a java static method, it is code
and you will need a developer to do it, right?
[]s
Edson
2009/6/18 Chris Richmond <crichmond(a)referentia.com>
Edson,
Thanks…and I am considering that option as well…but the nice thing about
the functions in the drl file is the system remains much more fluid..in
other words, if I can focus on doing what I want to do all within the DRL
file, it proves the flexibility of the system more to me than having to
have developer recompile the application itself with new classes. Does
that make sense? Also, I would just like to know that I can actually make
functions work for future reference.
Thanks,
Chris
------------------------------
*From:* rules-users-bounces(a)lists.jboss.org [mailto:
rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Edson Tirelli
*Sent:* Thursday, June 18, 2009 1:15 PM
*To:* Rules Users List
*Subject:* Re: [rules-users] functions
Chris,
If you are creating a function library, why don't you create it as
static methods in a java class? easier to develop, to unit test and you can
use "import function" in the DRL to import all of them.
[]s
Edson
2009/6/18 Chris Richmond <crichmond(a)referentia.com>
Ok…I am trying to build a function library in my .drl file and I added this
one test function
function String outputString(String sData){
return sData;
}
And no matter where I place this in my .drl file, I get an exception one
way or the other with compiling when I try instaniate and fire my rules.
The .drl file works exactly as expected if I remove this function
declaration, and when I **do** try to add it, I do not actually call it
anywhere…but get those errors.
So my question is, where exactly do I need to place function declarations..
Thanks,
Chris
_______________________________________________
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, a division of Red Hat @
www.jboss.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, a division of Red Hat @
www.jboss.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, a division of Red Hat @