Re: JESS: Unruly rules

"Ernest Friedman-Hill" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <[email protected]>
On Nov 7, 2010, at 3:00 AM, Donald Winston wrote:

> This works but seems to me to defeat the purpose of using a rule  
> engine. Is this where predicate constraints are used?
> I did the following and it appears to work:
>
> (defrule set-dataset-isFree
>     (page "show-dataset.xslt")
>     (dataset (nobs ?nobs))
>     ?x <- (dataset (nvars ?nvars))
>     (subscription-prices (maxDataElements ?y&: (< ?y (* ?nobs ? 
> nvars))))
> =>
>     (modify ?x (isFree FALSE)))
>
> Am I going down the right path here? It looks like I'll be doing a  
> lot of this.
>


Yes, you're going down the right path -- this is definitely the right  
way to do it. However, there's a mistake here.  By using two different  
"dataset" patterns in the above, you've written a rule that can match  
using the "nobs" slot from one dataset, and "nvars" from another. If  
there's more than one "dataset" fact this is unlikely to be what you  
want. Instead, you want to just use the single pattern from the  
original version:


?x <- (dataset (nobs ?) (nvars ?))


---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.