Do you mean that you'd like ?iA and ?mP to be lists, and the query to
return facts which contain any of the listed values in both the
corresponding slots? You could do it something like this:
(defquery search-by-property
"find matched process models"
(declare (variables ?iA ?mP))
(processmodel (processName ?processname) (intendedApplication $?
iAf) (measuredProperty $?mPf))
(test (and
(neq () (intersection ?iA ?iAf))
(neq () (intersection ?mP ?mPf)))))
On Mar 14, 2007, at 5:59 AM, Peizhao Hu wrote:
Hi all,
I have the following rule definitions.
;; =========================== Rule =======================
(deftemplate processmodel
(slot processName)
(multislot intendedApplication)
(multislot measuredProperty)
)
(defquery search-by-property
"find matched process models"
(declare (variables ?iA ?mP)) ;; <=== how can i take a list of
variables, and match each of them in the list?
(processmodel (processName ?processname) (intendedApplication $? ?
iA $?) (measuredProperty $? ?mP $?))
)
(deffacts data
(processmodel (processName PeopleDetection) (intendedApplication
Detection) (measuredProperty Object Pattern))
(processmodel (processName FaceRecognition) (intendedApplication
Recognition) (measuredProperty Pattern))
(processmodel (processName RoomTemperature) (intendedApplication
Measurement) (measuredProperty Temperature))
(processmodel (processName PresentStatus) (intendedApplication
Detection) (measuredProperty Event Object))
)
(reset)
(bind ?result (run-query* search-by-property Detection Object))
(while (?result next)
(printout t (?result getString processname) crlf))
;; =========================== End Rule =======================
I can get the result:
PeopleDetection
PresentStatus
however, how can I make this query more dynamic? The numbers of my
query variable are not fixed. so one can provide any number of
query variables for this matching. so is there anyone know how to
do it?
--
regards;
Peizhao
--------------------------------------------------------------------
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 owner-jess-
[EMAIL PROTECTED]
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
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]
--------------------------------------------------------------------