:not - not what i expected

0 views
Skip to first unread message

jason

unread,
Oct 3, 2009, 1:08:08 PM10/3/09
to Ruleby
dear groupies,

the :not existential quantifier is not doing what I am expecting. i.e.
what am i doing wrong.

I am expecting the following rule to fire when, and only when, NO
objects of class Jweba::Rules::LowerPage and NO objects of class
Jweba::Rules::HigherPage are in the set of facts.

However it seems to me to make do difference.
The rule always fires - objects existing or not
and
The v[:pages_with_initiating_action] and v[:pages_with_action] always
return nil - regardless.

Where am i going wrong. ? help much appreciated! thanks.

rule :no_other_exisitng_actions,
[Jweba::Rules::CurrentPage, :current_page],
[:not, Jweba::Rules::LowerPage, :pages_with_initiating_action],
[:not, Jweba::Rules::HigherPage, :pages_with_action],
[Celerity::Link, :link, m.text( &condition{ |s| !s.match(/job|
stelle|impressum/i).nil? } ) ] do |v|
puts "do something"
end

Joe Kutner

unread,
Oct 3, 2009, 3:19:54 PM10/3/09
to Ruleby
If you change the order of your conditions so that the :not conditions
are last, I think you will find that it works:

rule :no_other_exisitng_actions,
[Jweba::Rules::CurrentPage, :current_page],
[Celerity::Link, :link, m.text( &condition{ |s| !s.match(/job|
stelle|impressum/i).nil? } ) ],
[:not, Jweba::Rules::LowerPage, :pages_with_initiating_action],
[:not, Jweba::Rules::HigherPage, :pages_with_action] do |v|
puts "do something"
end

This is a bug, and I will create a ticket for it. Thanks.

Joe

jason

unread,
Oct 3, 2009, 9:56:06 PM10/3/09
to Ruleby
Thanks Joe,

However, with reference to your comments here:
http://groups.google.com/group/ruleby/browse_thread/thread/25aff8f97e4a7322

I feel that I really need to granulate my rules much more. Thanks for
taking time on this.

Jason.
Reply all
Reply to author
Forward
0 new messages