Re: debug log of clips rule

45 views
Skip to first unread message

Lode Hoste

unread,
Nov 15, 2012, 4:59:35 PM11/15/12
to clip...@googlegroups.com
What about the following?

(defrule my_rule
    (temp_A
          (my_slot_1 ?my_var_1)
          (my_slot_2 ?my_var_2)
          (my_slot_3 ?my_var_3)
          (my_slot_4 ?my_var_4)
    )
    (test (or (neq  ?my_var_1 10)
                (neq  ?my_var_2 20)
                (neq  ?my_var_3 30)
                (neq  ?my_var_4 40)))
=>
    (printout t "i am fired :)")
)

If this does not resolve your question, try to provide additional information on how it should behave.


2012/11/15 rajiv gandhi <rgan...@gmail.com>
Hello experts ,

Please see the following rule (kindly excuse me if there is some syntax error as i just typed it without compiling) 

(defrule my_rule
    (temp_A
          (my_slot_1 ?my_var_1)
          (my_slot_2 ?my_var_2)
          (my_slot_3 ?my_var_3)
          (my_slot_4 ?my_var_4)
    )
    (test (eq  ?my_var_1 10))
    (test (eq  ?my_var_2 20))
    (test (eq  ?my_var_3 30))
    (test (eq  ?my_var_4 40))

=>
    (printout t "i am fired :)")
)

so in the above rule there are four conditions and we know that if one or more condition do not met
then this rule won't execute

I need to print all those variables which do not met with given conditions  (in the case when rule does not get fired)
please note that I can not have negate of this rule as i have multiple rules active

i do not know if clips provide that sort of information by any mean,
       if yes please provide pointer to that
       if not then I can change the code if required to get this information so please guide me where to start.


thanking you in advance.

--
You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To post to this group, send email to CLIP...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
 
--> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Click on "Edit my membership" link.
Select the "No Email" radio button.
Click the "Save these settings" button.

--> IF YOU WANT TO UNSUBSCRIBE <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Sign in
Click on "Edit my membership" link.
Click the "Unsubscribe" button.
Note: This appears to be the most reliable way to unsubscribe
 
Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.

Artem Novikov

unread,
Nov 15, 2012, 9:51:02 PM11/15/12
to clip...@googlegroups.com
An axample:


(defrule my_ne_rule1

   (value ?v&:(!= ?v 10))

=>

   (printout t ?v "!= " 10 crlf))




четверг, 15 ноября 2012 г., 16:22:58 UTC+8 пользователь rajiv gandhi написал:

Artem Novikov

unread,
Nov 15, 2012, 10:02:13 PM11/15/12
to clip...@googlegroups.com
PS. For vars:

(defrule my_ne_rule1

   (value ?v&:(!= ?v 10)&:

                  (!= ?v 20)&:

                  (!= ?v 30)&:

                  (!= ?v 40))

=>

(printout t " NE " crlf))


пятница, 16 ноября 2012 г., 10:51:03 UTC+8 пользователь Artem Novikov написал:

rajiv gandhi

unread,
Nov 16, 2012, 1:23:23 AM11/16/12
to clip...@googlegroups.com
Lode@ you are suggesting the negate of rule and for which i have already mentioned in, my earlier port that, i can not have it, since in rule session there are lots of rules active.

rajiv gandhi

unread,
Nov 16, 2012, 1:28:21 AM11/16/12
to clip...@googlegroups.com
basically i need debug information, tracing that i should be able to pin point exact reason why rule (one among many) did not fire
and i think we can achieve this by adding printf statement in code where we are comparing lhsparsednode

I just need to know the place where it is safer to add, please guide
Reply all
Reply to author
Forward
0 new messages