[rules-users] Hold the Beans!

Edson Tirelli tirelli at post.com
Fri Sep 10 10:31:32 EDT 2010


   On top of Wolfgang's suggestions, you can also use Smooks for
transformations, or, Camel/Spring similar to what Mark describes here:

http://blog.athico.com/2010/07/declarative-rest-services-for-drools.html

   Edson

2010/9/10 Wolfgang Laun <wolfgang.laun at gmail.com>:
> If you insert POJOs as facts in Jess, you'll have to write a
>    (deftemplace X (declare (from-class X)))
> and the fields available for pattern matching in rules rely on the JavaBeans
> convention.
>
> I have (quite successfully) used POJOs resulting from unmarshalling an XML
> document (via JAXB) as facts, both in Drools and in Jess; most certainly
> without writing any "copycat" fact classes and tedious transformations.
>
> As for globals: They play the same role in Drools as in Jess; in neither
> system are they part of the working memory.
>
> I don't know what you could mean by a "standard fact class".
>
> As for iterating over all fact objects in Drools' WM, Drools provides
> getObjects() in WorkingMemory; or you could set up a query and run this.
>
> -W
>
>
> On 10 September 2010 14:54, Donald Winston <satchwinston at yahoo.com> wrote:
>>
>> I'm reviewing JBoss Rules (Drools) for an application I'm starting to
>> build. It appears that the only way to assert facts is to use the
>> insert(Object) method where the object is a bean using the proper naming
>> conventions for it's properties. There also appears to be a way to use
>> arbitrary objects using globals but do these end up in the fact base? It's
>> disturbing to me that I have to create a bunch of classes whose sole purpose
>> in life is to support the rule base. This is similar to using java server
>> pages and having to create a bunch of classes just to support each page.
>> That's why I don't use java server pages and use xsl transformations
>> instead. I want to use my xml jdom document to represent my data and not
>> have to create a bunch of beans. I can't seem to find anything in the api
>> where I can assert facts without creating my own custom classes. There's no
>> standard Fact class?
>>
>> I've been also experimenting with Jess and it provides an easy way for me
>> to do this. I just iterate through my jdom document and create Fact objects
>> and assert them. I can then execute the rules and then iterate through the
>> updated fact base using engine.listFacts() and update my jdom document. It
>> couldn't be easier or more natural. Is there an analogous way to do this in
>> Drools?
>>
>>
>> Thank you very much.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com




More information about the rules-users mailing list