[rules-users] Defining facts declaratively with TypeDeclaration and assert facts from java

Ronald Brindl rbrindl at thegoldensource.com
Fri Feb 6 10:25:50 EST 2009


Referring to threads 
http://thread.gmane.org/gmane.comp.java.drools.devel/2860 
        Dynamic Facts: how to get jar wih Facts declared in drl
http://thread.gmane.org/gmane.comp.java.drools.devel/2595 
        TypeDeclaration plugin heirarchy

I am just in the process of evaluating the possibilities of using Drools.

Our use case is the following:
We have a dynamic metamodel, which gets generated from database during
application initialisation phase.  Then a runtime model gets instantiated,
which is fed from incoming messages (files, jms, etc.)
Both models are highly generic, basically maps of maps (lists of lists, for
model instances)

Now, i would like to publish the metamodel to Guvnor as fact model, so that
business rules users can use it there and define 

In the last 2 days i dived into the sources, read the mailing list entries
above, documentation and so on, but i still don't have a clear vision on
how to accomplish that.

Our first approach was to use TypeDeclaration, i.e. to dynamically create
DRL that defines the fact types as defined in our metamodel, but i don't
have a clue on how to assert data for those types, since i don't have the
resulting java classes available in Java.
(There was also some confusion: in the documentation (M5) it says, bytecode
is generated for declaratively defined Facts, but i could not find anything
in the code, where this byte code is generated)

Our next approach was to generate interfaces as Fact types and create
proxies to access the data. This would also allow us to implement another
use case, that demands access to messages already stored in the database
with the same id as the incoming messages, and compare what fields are new
and to provide merging of new and old data.

I also had a quick look at the new Pipeline concept, but as far as i
understand that, it builds on a statically defined FactModel.

Then i dived a little bit more into the code and saw code generation for
accessing Java class facts, which also might be a reasonable solution for
us.

However, what i was asking myself was, if there is some entry point for
functionality like that, some existing API.

Thank you,
ron.


-- 
Ronald Brindl
Sr. Software Developer
Member of Architecture Team
The Goldensource Corporation




More information about the rules-users mailing list