2010/11/2 赵侃侃
> I get the following errors:
>
> Rule Compilation error : [Rule name='no B for 2 minutes']
> com/sample/Rule_no_B_for_2_minutes_0.java (7:571) : Main cannot be resolved
> Rule Compilation error : [Rule name='B arrives']
> com/sample/Rule_B_arrives_0.java (7:632) : Main cannot be re
I get the following errors:
Rule Compilation error : [Rule name='no B for 2 minutes']
com/sample/Rule_no_B_for_2_minutes_0.java (7:571) : Main cannot be resolved
Rule Compilation error : [Rule name='B arrives']
com/sample/Rule_B_arrives_0.java (7:632) : Main cannot be resolved
It seems that 'Main
Absence of events can only be detected by checking the past.
This means that a trigger must be inserted whenever it's time
to check the last two minutes. This check cannot be done in
a uniform way for all players because the arrival of an EventB
is the start of another 2 minute interval. The soluti
this.session = createSession();
SessionPseudoClock clock = session.getSessionClock();
session.insert( new Player( 1 ) );
session.insert( new Player( 2 ) );
clock.advanceTime( 3*60, TimeUnit.SECONDS );
session.insert(new EventB(1));
session.fireAllR
System.out.println( "Test no B" );
session = kBase.newStatefulKnowledgeSession( config, null );
clock = session.getSessionClock();
session.insert( new Player( 1 ) );
clock.advanceTime( 3*60, TimeUnit.SECONDS );
session.fireAllRules();
session.dispose();
The rule fires w
The "no B:x for 2 minutes" will not fire if nothing comes in even after
2minutes. e.g. if no characters get killed then no events will come in.
If I add a timer to this rule, say like timer (2m 1s), then the rule will
fire every second after 2 minutes.
Best Regards,
Kevin
2010/10/29 Wolfgang Laun
OK; your original version somehow put me off the right track.
This rule will fire as soon as there is no B:n according to the
Player index for 2 minutes.
rule "no B:x for 2 minutes"
when
$b : Player( $index: index )
not ( EventB( index == $index) over window:time( 2m ) )
then
System.ou
My last mail should actually read:
A player may have multiple characters and the rule should fire when *ALL* of
its characters live longer than 2 minutes. that's why "characters" do not
have a unique identification and there isn't any event representing a
character birth.
Best Regards,
Kevin Zh
A player may have multiple characters and the rule should fire when any of
its characters live longer than 2 minutes. that's why "characters" do not
have a unique identification and there isn't any event representing a
character birth.
Best Regards,
Kevin Zhao
2010/10/28 Wolfgang Laun
> If Ev
If EventB( index == 3 ) signifies that the "character" owned by player 3 has
been killed: what is the event that this character has been born? Life is
the time between birth and death; these two are well-defined (well, mostly)
events, and they ought to be represented by clean-cut events in any
appl
Hello Wolfgang,
I tried your rules but they don't seem to work correctly. Nothing comes back
thus the consequences are not executed.
I think we need to introduce a timer to trigger the rule once a while
because if there nothing comes in (e.g. no one get killed) then nothing will
get executed.
Bes
To be honest, I don't quite understand the rules you wrote. Let me explain
this a little bit with a real world scenario.
Assume this is an on-line game that EventB indicates a 'kill' event that a
player is losing its character who might be killed by some other player.
The property index points to t
2010/10/28 赵侃侃
> Hello Wolfgang,
>
> Index is just like the index in an array. the value can be any from 0 to
> the array length.
> for the previous example, the length is 1 so index can be either 0 or 1.
> but in the real case, the length can be an arbitrary number.
>
> another question, there a
Hello Wolfgang,
Index is just like the index in an array. the value can be any from 0 to the
array length.
for the previous example, the length is 1 so index can be either 0 or 1. but
in the real case, the length can be an arbitrary number.
another question, there are 2 rules here, do both of the
Kindly state your requirements precisely.
Perhaps
not ( EventB ( index != $index,... )
is what you need.
-W
2010/10/28 赵侃侃
> I haven't tested this rule, but what about the case that property index
> would have arbitrary number of possible values?
>
> 2010/10/27 Wolfgang Laun
>
>> Omitting t
I haven't tested this rule, but what about the case that property index
would have arbitrary number of possible values?
2010/10/27 Wolfgang Laun
> Omitting the Entry Points:
>
> rule "B-0-1-not OK"
> when
>$b : EventB( $index: index )
>not ( PatternConsumer( id == "B01", events contains
Omitting the Entry Points:
rule "B-0-1-not OK"
when
$b : EventB( $index: index )
not ( PatternConsumer( id == "B01", events contains $b ) )
not ( EventB( index == (1 - $index), this after[0s,2m] $b ) )
then
System.out.println( "B:" + $index + ", but no B:" + (1-$index) );
end
rul
Hello,
With the help from the community I managed to get my first rule working, and
I'm trying to write my second rule on my own but it just doesn't seem to
work correctly.
Here is the scenario, what I want is to identify a pattern that there's no
EventB coming in within 2 minutes with a particula
a charm! Nice functionality! Would it be worth it to
include this in Wiki?
Thanks,
Vlad
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: 06 March 2007 16:19
To: Rules Users List
Subject: Re: [rules-users] what's wrong with this rule?..
ED] On Behalf Of Edson Tirelli
Sent: 06 March 2007 16:19
To: Rules Users List
Subject: Re: [rules-users] what's wrong with this rule?...
Vlad,
You should not use the "return" keyword and the ";" inside the result
block as it is implicit. Also, remember that anything inside
Vlad,
You should not use the "return" keyword and the ";" inside the result
block as it is implicit. Also, remember that anything inside eval() is
pure java code, so you cant do $count < 4 if $count is an Integer object.
Finally, try to always avoid eval() when writing rules.
Try something l
Hi,
I have the following rule:
rule "FG.23C"
when
exists
Record( $psc : psc=="323",
pa =="7[0-9]*",
sa =="F39040"
22 matches
Mail list logo