(deftemplate dataset
(slot name)
(slot nobs (default 0))
(slot nvars (default 0))
(multislot variables)
(multislot variableTypes)
(slot submitEditDatasetForm)
(slot has-errors (default FALSE))
(slot isFree (default TRUE)))
(deftemplate subscription-prices
(slot maxDataElements)
(slot monthlyPrice)
(slot yearlyPrice))
(deffacts initial-facts
(nextPage nil)
(R nil)
(subscription-prices (monthlyPrice 25) (yearlyPrice 100) (maxDataElements
500)))
(defrule set-dataset-isFree
(page "show-dataset.xslt")
?x <- (dataset (nobs ?) (nvars ?))
?y <- (subscription-prices (maxDataElements ?))
=>
(if (> (* ?x.nobs ?x.nvars) ?y.maxDataElements) then
(modify ?x
(isFree FALSE))))
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.
Donald Paul Winston
[email protected]