RE: Multiple clauses in KW:FINDALL
Sigh. I found the trouble. It seems I must package-qualify the TEST
operator, like this:
(kw:findall '?x '(and (hobbit ?x age ?a) (kw:test (< ?a 50))))
The only reason I stumbled upon this solution is because I happened to run a
test within the KW-USER package and it worked.
Ah well...
dey
-----Original Message-----
From: Jason Trenouth [mailto:jason.trenouth@globalgraphics.com]
Sent: Wednesday, September 29, 2004 5:13 AM
To: Young, David
Cc: 'lisp-hug@xanalys.com'
Subject: Re: Multiple clauses in KW:FINDALL
Young, David wrote:
>Hi. I would like to query our kb using something similar to the following.
>Assume I have to kw instances of class FRODO, one with age = 30, the other
>with age = 60. I then evaluate:
>
>(kw:findall '?x '(and (frodo ?x age ?age) ((< ?age 50))))
>
>However, I clearly don't understand somthing about FINDALL, as the above
>query returns *both* instances rather than just one. What am I doing wrong?
>
>
>
I think the (( ... )) syntax just means: run the Lisp code. The result
is not used to control the Prolog backtracking. If you want the result
to control the backtracking then I think you have to use (test ( ... )). ie
(kw:findall '?x '(and (frodo ?x age ?age) (test (< ?age 50))))
__Jason
This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.