[rules-users] How to manage lists of data

Michael Anstis michael.anstis at gmail.com
Tue Mar 22 07:05:13 EDT 2011


Thanks for the corrections Wolfgang; I always get "high" \ "low" salience
wrong :)

You'd think if I always get it wrong I'd be able to correct myself ;)

With kind regards,

Mike

2011/3/22 Wolfgang Laun <wolfgang.laun at gmail.com>

> 2011/3/22 Michael Anstis <michael.anstis at gmail.com>
>
>> You could investigate the lists being set-up with a low salience rule and
>> suitable declarative model (or static in a JAR):-
>>
>> rule "setup"
>> when
>> then
>>     insert(new Cheese("cheddar"));
>>     insert(new Cheese("brie"));
>> end
>>
>
> This should have a very high salience.
>
>
>>
>> rule "likes cheese"
>> when
>>     $c : Cheese( )
>>     $p : Person( likedCheeses contains $c )
>> then
>>     System.out.println($p.getName() + " likes " + $c.getName());
>> end
>>
>>
>
> I think the request was for a check of a fact property being one out of a
> list. If there's just one list,
> you can do
>    $c : Cheese()
>    $p : Person( favouriteCheese == $c,... )
> or
>    $p : Person(...)
>    Cheese( name == $p.favouriteCheese )
>
> With multiple lists, you might add a distinguishing property to the list
> element, e.g.
>   insert(new Cheese("French", "Roquefort"));
> and then
>   $p: Person(...)
>   $c: Cheese( country ==  $p.country, name == $p.favouriteCheese )
>
> -W
>
>
>
>
>
>
>
>> This appears to be possible in Guvnor, although tbh I've not tried in
>> anger.
>>
>> With kind regards,
>>
>> Mike
>>
>> 2011/3/22 Alexander, Scott F <scott.f.alexander at jpmorgan.com>
>>
>>> Hi,
>>>
>>> Im pretty new to drools and have been going through the docs for the
>>> Expert and guvnor.  I have some basic unit tests running with the rules I am
>>> trying to replicate from a legacy system.  One of the rules my current
>>> system uses is to check a property in an Object against a list of values and
>>> fire if the property is present in the list ie list.contains(someValue);
>>>
>>>
>>>
>>> I am trying to find out what the best practise is for setting up the
>>> lists which will be checked against.  I don’t want to have to include these
>>> lists in java classes and upload them as facts.  I would much rather be able
>>> to manage them through guvnor so my non technical users can manage them
>>> themselves without the need to release a new jar file.
>>>
>>>
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> This email is confidential and subject to important disclaimers and
>>> conditions including on offers for the purchase or sale of securities,
>>> accuracy and completeness of information, viruses, confidentiality, legal
>>> privilege, and legal entity disclaimers, available at
>>> http://www.jpmorgan.com/pages/disclosures/email.
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110322/840152c4/attachment.html 


More information about the rules-users mailing list