如何在dslr规则中使用not()?

问题描述 投票:1回答:1

我想表达类似的规则

rule "R"
when
    a: A()
    c: C(a.timestamp<timestamp)

    not(B(a.timestamp<timestamp && timestamp<c.timestamp))
then
    // error no B between A and C
end

但是使用DSL

我如何表达not

rule "R"
when
    there is an A a
    there is a C c
      - with timestamp greater than a.timestamp

    there is NOT a B
      - with id between a.timestamp and b.timestamp
then
    // error no B between A and C
end
[condition][]there is an A {a}={a}: A()
[condition][]there is a C {c}={c}: C()
[condition][]there is NOT a B=not(B())
[condition][]- with timestamp greater than {timestamp}=timestamp > {timestamp}
[condition][]- with timestamp between {lower} and {upper}={lower}<timestamp && timestamp<{upper}
drools dsl dslr
1个回答
0
投票

rdslr

rule "R"
when
    There is an A
    There is a C
      - with timestamp greater than $A.timestamp
    There is a B
      - not with timestamp between $A.timestamp and $C.timestamp
then
    // error no B between A and C
end
© www.soinside.com 2019 - 2024. All rights reserved.