Jerome,

I'm a little confused as to why your example below would work for either set of facts.

First of all, your "rule" isn't a rule at all - it is a fact.

(MAIN::webservice
   (service getaddress)
   (project sage)
   (org georgetown)
   (analystname blake)
   (analystrole lead)
   (priority low)
   (reldatetime within_an_hour)
   (location dc)
   (action run)
)

You must have a rule you aren't showing.

Also, in your example, you listed both ordered and unordered facts. The fact above is an ordered fact and will only match a rule like this:

(defrule run-service-unordered
   (webservice
      (service ?serviceName)
      (project ?projectName)
      ;; more slots could be placed here
   )
=>
   (printout t "run-service-unordered rule fired")
)

This will fire for all facts with (service) slot values and any (project) slot values. If you wanted to restrict the matching facts to particular values, just specify the values instead of the variables, like so:

(defrule run-service-unordered
   (webservice
      (service inputservice)
      (project sage)
      ;; more slots could be placed here
   )
=>
   (printout t "run-service-unordered rule fired")
)

This rule will only fire for unordered facts with (service inputservice) and (project sage) values.

The other facts you list below would only match a rule like this:

(defrule run-service-ordered
(inputservice getaddress sage georgetown blake lead low within_an_hour dc))
=>
   (printout t "run-service-ordered rule fired")
)

Also, w.r.t. nil (unknown) values in ordered templates, you can simply specify an unnamed variable to hold the place in the pattern, like so:

(defrule run-service-ordered
   (inputservice getaddress sage ? ? lead low within_an_hour dc))
=>
   (printout t "run-service-ordered rule fired")
)

The two question marks are unnamed variables that are bound to the values at those positions (4 and 5) in the fact.

I suggest that you stick to unordered facts w/ slot names - it prevents errors caused by accidentally leaving out a position/variable. You might also want to explicitly define your unordered facts using (deftemplate).

Please review the following part of the users manual for more information:

http://herzberg.ca.sandia.gov/jess/docs/70/rules.html

Good luck!

alan



Jerome Butchergreen wrote:
hey guys,
i racked my head on this for a while then we decided
just to have the engine fire on specific examples for
the demo.

so ive been working on another project and now im back
to this one and i fear that my time off will make it
impossible for me to figure this out alone so please
help!

we want this rule (already stored):
(MAIN::webservice (service getaddress) (project sage)
(org georgetown) (analystname blake) (analystrole
lead) (priority low) (reldatetime within_an_hour)
(location dc) (action run))

to fire with both of these assertions (now it only
fires for the first):
(assert (inputservice getaddress sage georgetown blake
lead low within_an_hour dc))
and
(assert (inputservice getaddress sage nil nil lead low
nil dc))

where nil is simply unspecified in the request

...even though we arent goin to implement any
functionatity in this way id also know if its possible
to have it fire if instead of nil's there were other
random values ...that for one reason or another dont
matter in this case (i realize that i can simply
replace those with nil ...but i wonder none the less)

thanks a bunch
-Jerome BG


                
__________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.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]
--------------------------------------------------------------------


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