Hi,
       Please help for some rule text at 1 and 2 to achieve the desired
result.

       For every element in "requiredParameter" there must be "Param" fact.
      In below example the rule "Function-Parameter-Required-NOT-Passed"
should fire.

      If fact

      (assert(Param  (name Department)(value Sales))))

      is added then "Function-Parameter-Required-Passed"  should get fired.




------- Rules -----

(defrule Function-Parameter-Required-Passed
      "Check current Function Required Parameter"
      (Input (name Function) (value ?functionName))
      (Function (name ?functionName)(requiredParameter
$?requiredParameterList))

      ;; 1. check for each parameter in the "requiredparameterList" there
is an Fact
      ;;    "Param" with matching "name" slot.

      =>
      (printout t "All Parameter Passed" crlf)
)


(defrule Function-Parameter-Required-NOT-Passed
      "Check current Function Required Parameter"
      (Input (name Function) (value ?functionName))
      (Function (name ?functionName)(requiredParameter
$?requiredParameterList))

      ;; 2. check

      =>
      (printout t "Parameter Missing : (missing parameters)" crlf)

)


(deftemplate Param "Parameter"
      (slot name)
      (slot value)
)

(deftemplate Input "Input"
      (slot name)
      (slot value)
)
(deftemplate Function "ApplicationFunction"
      (slot name)
      (slot status (default InActive))
      (multislot requiredParameter)
)


------- Facts----

(assert(Function (name CreateContact) (requiredParameter (create$ Location
Commodity Department))))

(assert(Input    (name Function)(value CreateContact))))
(assert(Param    (name Location)(value 12345))))
(assert(Param    (name Commodity)(value Coal))))


Thanks

Sanjay

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to