No, you can't. This was asked on this very list just a few weeks ago;
see here for the explanation:
http://www.mail-archive.com/[email protected]/msg09159.html
On Mar 20, 2007, at 11:52 PM, ricktee wrote:
Hi Dr Hill,
I just read your eg on queries at
http://herzberg.ca.sandia.gov/jess/docs/61/language.html#queries
Im wonder if it's possible to search query via the fact's name
instead of
its slots and multislots
*****This is my "program-cardio" and "user" fact template
(deftemplate program-cardio
(slot ident)
(slot stageA-intesity%)
(slot stageA-duration-wks)
(slot stageB-intesity%)
(slot stageB-duration-wks) );;close
(deftemplate user
(slot answer) );;close
****this is my rule that asserts "program-cardion" fact if the user
answer
is "poor"
(defrule recommend-program-poor
(user (answer poor))
=> (assert (program-cardio (ident cardio-low)
(stageA-intesity% 30) (stageA-duration-wks 3)
(stageB-intesity% 50) (stageB-duration-wks
5)))
(printout t " Jess: recommends low-cardio running schedule " ) );close
****** This is my query search taken from
http://herzberg.ca.sandia.gov/jess/docs/61/language.html#queries
(defquery search
(declare (variables ?tofind ))
(program-cardio (ident ?tofind)
(stageA-intesity% ?a-int) (stageA-duration-wks ?a-wks)
(stageB-intesity% ?b-int) (stageB-duration-wks ?b-wks)))
I try to replace "program-cardio" with ?tofind but I will get an
error. Is
there a way for me to query facts via its own name? like
(defquery search
(declare (variables ?tofind ))
( ?tofind (ident ?id)
(stageA-intesity% ?a-int) (stageA-duration-wks ?a-wks)
(stageB-intesity% ?b-int) (stageB-duration-wks ?b-wks)))
below is the java code to run it, I need to replace "cardio-low" with
"program-cardio"
//...
engine.store("RESULT", engine.runQuery("search",
new ValueVector().add(new Value("cardio-low" ,
RU.ATOM))));
engine.executeCommand("(store RESULT (run-query search
cardio-low))");
// Fetch the result (an Iterator).
Iterator e = (Iterator)
engine.fetch("RESULT").externalAddressValue(null);
//...
Thank you very much
rick
---------------------------------------------------------
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]
--------------------------------------------------------------------