Hi Michael,

thanks for the reply. I hadn't thought of using a function - that might be
the best way for now. I had thought about writing my own semantic module -
that might be the most elegant long term solution.

Adrian.



                                                                                
                                                                 
                      Michael Neale                                             
                                                                 
                      <[EMAIL PROTECTED]         To:      
[email protected]                                                        
         
                      mail.com>                cc:                              
                                                                 
                                               Subject: Re: [drools-user] best 
practice for ruleset constants?                                   
                      17/01/2006 10:56                                          
                                                                 
                      Please respond                                            
                                                                 
                      to user                                                   
                                                                 
                                                                                
                                                                 
                                                                                
                                                                 




You can actually put constants in functions, and use them in rules as you
would normally.

<java:functions>

    public static final int SOME_VALUE_HERE = 42;
    public static final String ANOTHER_CONST = "Slartibartfast";

</java:functions>

But I am not sure if thats exactly what you want. If these are parameters
that you want users to tweak on the fly, probably best to put them in a
properties file, or a database with a web front end to change them. The
rule
engine can then access them as application data, as you said. In Drools 2
there isn't really another way to make it neater (short of creating your
own
XML language, which might be more work then you are prepared to do).



On 1/17/06, Adrian Bigland <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> I need several constants in a ruleset - they represent confidence factors
> (weights) for different inputs.
>
> These weights are decided by the business and need to be changed in the
> same way as the business rule logic, so I'd like to represent the values
> in
> the ruleset definition file.
>
> I also need to use the JSR-94 API.
>
> My question is - what is the most elegant way to set up these constants
in
> a rule file.
>
> I can think of a few possible approaches, but I haven't figured out a way
> to do it yet:
>
> - application data - but I have yet to find out how to set the values in
> the rulefile.
> - use rules to assert values - I'm currently trying to figure out how to
> control when these fire.
>
> Am I trying to do something in a very non-rule engine way here? Or has
> anyone had some experience of doing this that they would like to share?
>
> Thanks,
>
> Adrian Bigland.
>
>
>
>
>
> **********************************************************************
>
> This e-mail and any attachment is intended for the named addressee(s)
> only, or person authorised to receive it on their behalf. The content
should
> be treated as confidential and the recipient may not disclose this
message
> or any attachment to anyone else without authorisation. Unauthorised use,
> copying or disclosure may be unlawful. If this transmission is received
in
> error please notify the sender immediately and delete this message from
your
> e-mail system. Any view expressed by the sender of this message or any
> attachment may be personal and may not represent the view held by First
> Choice Holidays PLC and its subsidiaries. All electronic transmissions to
> and from First Choice are recorded, may be monitored and are scanned for
> viruses and content. E-mails containing viruses will be deleted without
> notification. Whilst we maintain virus checks on inbound e-mails we
accept
> no liability for viruses or other material introduced with this message.
>
> All companies form part of the First Choice Holidays PLC group of
> companies.
>
> First Choice Holidays PLC Company Registration No: 48967 (England)
>
> Registered Office: First Choice House, London Road, Crawley, WestSussex
> RH10 9GX
>
> **********************************************************************
>
>
>
>



Reply via email to