Thanks for your reply Greg.
 
Actually I have 2 requirements:
 
1) Define the data objects in the rule itself so that the business user can define\modify the data objects
2) have a rule that can evalaute the data objects against the criteria the user requests..
 
It is my bad I started with the 2nd requirement :(
 
Regards,
cabear
On Wed, Nov 11, 2009 at 1:50 PM, Greg Barton <greg_barton@yahoo.com> wrote:
Funny you should bring that up, I was just having this debate with a co-worker. :)

A decision table is a means for defining rules, not working memory objects.  So no, out of the box a decision table as it's defined in drools (and other rule management systems) would not serve that purpose.  However, there's no reason why you couldn't parse a spreadsheet (or other tabular data format) to generate Data objects.

Now, are you sure it's Data objects you want to generate?  I'm guessing from how your question was phrased that it's Query objects you'd like to generate.  In that case the answer to the question is still no, but...if you use Wolfgang's approach to solve the problem (i.e. defining the queries in the rules themselves, and not in a working memory object) then using a decision table is appropriate.  In fact, it's probably the best way to define the rules. (It's most compact and readable when you have many rules with a repetitive structure.)

--- On Wed, 11/11/09, Wishing Carebear <wishing.carebear@gmail.com> wrote:

> From: Wishing Carebear <wishing.carebear@gmail.com>
> Subject: Re: [rules-users] some pointers for solution
> To: "Rules Users List" <rules-users@lists.jboss.org>
> Date: Wednesday, November 11, 2009, 3:38 PM
> Hi Greg:
> Is it possible to use decision table to populate the
> Data object that contains the criteria list
> information.
>  
> Thanks,
> Ravi
>
>
> 2009/11/8 Greg Barton <greg_barton@yahoo.com>
>
> There
> are a couple of ways to do this.  I'm sure there's
> a bit more clean way than the example I'm providing, but
> this should get you in the right direction.  It's not
> 100% rules, because it involves a bit of java collections
> trickery. (See attached project,
> collection_DroolsCriteriaMatch.tar.gz)
>
>
> The heart of it is a single rule:
>
> rule "Match"
>  when
>    d : Data()
>    q : Query( size <= d.size )
>    Number( intValue == q.size )
>    from accumulate(
>      Criteria( this memberOf d, this memberOf q ),
>
>      init( int total = 0; ),
>      action( total ++; ),
>      reverse( total --; ),
>      result( total )
>    )
>  then
>    System.out.println("Match: " + d + "
> and " + q) ;
> end
>
> The Data object holds data to be queried, Query objects are
> asserted to match the Data, and Criteria objects can be
> contained in either. (With the aforementioned collections
> trickery that if a Criteria is contained in a Query it can
> be found in a Data object, but the reverse isn't true.
>  See the Query.contains(Object) method for how that's
> implemented.)
>
>
> So the rule above basically says "There's a Data
> object, and all of the Query objects Criteria are contained
> in the Data object."
>
> There's an alternate way of doing this using eval and a
> bit more java fu.  See the eval_DroolsCriteriaMatch.tar.gz
> project attached.  This one's probably not optimal,
> though, as it's basically a brute force check of all
> Data objects against the asserted Query.
>
>
> I tried for a while to get a solution working with
> different criteria types from both Data and Query objects
> being asserted into working memory, but I couldn't get
> the accumulate syntax right.  Anyone know of a way to do
> that? (I figure that would get a "pure rules"
> solution.)
>
>
> --- On Sat, 11/7/09, Wishing Carebear <wishing.carebear@gmail.com>
> wrote:
>
> > From: Wishing Carebear <wishing.carebear@gmail.com>
>
> > Subject: [rules-users] some pointers for solution
> > To: rules-users@lists.jboss.org
> > Date: Saturday, November 7, 2009, 10:19 PM
>
>
>
> > Hello:
> > There are n selection criteria from s1 .. sn for each
> > item i1.. in. Each item can have a subset of criteria
> which
> > applies to them.
> >  
> > The end user, can choose a subset of criteria like c1
>
> > and c5 and only the item that has c1 and c5 valid
> should be
> > returned. For example: if item i1 and i2 have
> criterias
> > valid for c1, c2, c5, c6, c8 since the request is only
> for
> > criteria c1 and c5, i1 and i2 must be returned.
>
> >
> >  
> > Is it possible to write a rule using drools for this
> > requirement.
> >  
> > Thanks for your help and time,
> > cabear
> >
> > -----Inline Attachment Follows-----
>
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
>
> >
>
>
>      
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users