Jerome,
You can match against ordered facts like so:
(defrule myRule
(first second ? fourth fifth ? seventh)
=>
(printout t "Rule fired")
)
What this does is to match any of the following facts:
(assert (first second dontcare fourth fifth dontcare seventh))
(assert (first second anything fourth fifth here seventh))
(assert (first second x fourth fifth y seventh))
(assert (first second nil fourth fifth nil seventh))
The question marks in the rule above will make the rule pattern match
facts with the specified values (e.g. first, second, etc.) at the
positions indicated and with *any* value at ordinal position 3 and 6".
In this case the question marks are unnamed variables that get bound to
whatever is at those positions in the matching fact(s).
You could bind named variables like so:
(defrule myRule
(first second ?position3 fourth fifth ?position6 seventh)
=>
(printout t "Rule fired - values at position 3 and 6 are "
?position3 ", " ?position6)
)
I would suggest that you try a simplified version of your rule cut down
to just one or two fields and experiment with how the pattern matching
works.
(defrule run-service
?inputservice <- (inputservice ?service ?project
?org ?analystname ?analystrole ?priority ?reldatetime
?location)
?newserv <- (webservice (service ?service) (project
?project) (org ?org) (analystname ?analystname)
(analystrole ?analystrole) (priority ?priority)
(reldatetime ?reldatetime) (location ?location)
(action run) )
=>
(store RETURN "run")
(printout t "JESS: Found an existing service = "
?service crlf)
(printout t "JESS: The user-specified action is to
run the service! " crlf)
(retract ?inputservice))
If this rule isn't firing for you and you think it should, try removing
some of the slot matches in the second pattern. Maybe one or more of the
slot values aren't *exactly* the same in both facts and so are
preventing them from matching. Start with only one or two slots and keep
adding them back until the rule stops firing. For example,
(defrule run-service
?inputservice <- (inputservice ?service ?project ?org ?analystname
?analystrole ?priority ?reldatetime ?location)
?newserv <- (webservice (service ?service) (action run) )
=>
(store RETURN "run")
(printout t "JESS: Found an existing service = " ?service crlf)
(printout t "JESS: The user-specified action is to run the service! "
crlf)
(retract ?inputservice)
)
Good luck!
alan
--------------------------------------------------------------------
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]
--------------------------------------------------------------------