This isn't "not working", it's just the expected behavior. If you
write a rule that matches a fact and modifies it, and the modified
fact also matches the rule, then you have a loop. You can use the
"watch" function to see a trace of what's happening. I expect your
first version "works" because the modify doesn't actually change
anything -- those are probably the values that are already in the fact.
To stop the loop, use the "no-loop" declaration:
(defrule get-nonsyn
(declare (no-loop TRUE))
...
On Mar 22, 2007, at 11:28 AM, Hsin Terry Shen wrote:
Sorry, what I meant was that when I include (rank (+ ?y 0.5))
instead of just (rank ?y) or just some number (rank 0.5)l then it
looks like it goes into an infinite cycle or something. No facts
are being returned, it looks like it's still processing... though
I could keep waiting and seeing if something eventually comes back.
But I change to just (rank ?y), I get back:
f-408 (MAIN::Synonymity (type "coding-nonsynonymous,reference")
(rsnum "rs13266634"))
f-409 (MAIN::SNPRank (id "rs13266634") (rank 0.1) (category nil))
~~Terry
------------------------------------------------------------
Hsin Yi (Terry) Shen, MSPH
NLM Predoctoral Fellow
Department of Medical Education and Biomedical Informatics
School of Medicine, Box 357240
University of Washington
Seattle, WA 98195-7240
Lab Phone: 206-616-8414
[EMAIL PROTECTED]
http://students.washington.edu/hyshen
On Thu, 22 Mar 2007, Ernest Friedman-Hill wrote:
"No longer works" in what way? The code looks fine, should do what
you expect if ?y is bound to a number, anyway.
On Mar 21, 2007, at 11:37 PM, Hsin Terry Shen wrote:
Hi everyone,
I have a simple rule that modifies a fact, it works in this
scenario:
(defrule get-nonsyn
?syn <- (Synonymity (type ?nspfr&:(regex ?nspfr
"nonsynonymous")) (rsnum ?id))
?r <- (SNPRank (id ?sid) (rank ?y))
=>
(modify ?r (rank ?y) (category "nonsynonymous"))
)
However, as soon as I try to include an addition function to the
"rank" slot of the modify function, it no longer works:
(defrule get-nonsyn
?syn <- (Synonymity (type ?nspfr&:(regex ?nspfr
"nonsynonymous")) (rsnum ?id))
?r <- (SNPRank (id ?sid) (rank ?y))
=>
(modify ?r (rank (+ ?y 0.5)) (category "nonsynonymous"))
)
---------------------------------------------------------
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 owner-jess-
[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 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]
--------------------------------------------------------------------