누락된 이벤트 발견

이벤트의 부재나 존재를 발견하려면, when <event> has occurred 절을 사용하는 규칙을 작성합니다.

일부 이벤트가 특정 기간 동안 발생했는지 테스트하려면, 고정 달력 지속 기간으로 참조 이벤트의 처리를 연기합니다. 또한 규칙에 동일한 기간 동안 발생한 이벤트를 확인하는 조건도 포함합니다.

다음 규칙에서는 구매 금액이 1000을 초과할 때 최근 구매 하루 뒤에 조치를 수행해야 합니다. 규칙은 최근 구매 하루 뒤의 기간 중에 기타 구매 이벤트의 부재를 발견합니다.

when a purchase event has occurred 1 day ago, called 'recent purchase'
where the amount of 'recent purchase' is more than 1000 
if    the number of purchase events during the period of 1 day after 'recent purchase' is 0
then
    print "No other purchase events after the recent purchase"

고정된 절대 또는 달력 기간 동안 또는 처리된 이벤트와 연관된 엔티티의 속성이 정의하는 절대 또는 달력 기간 동안 이벤트 부재를 발견할 수 있습니다.

다음 예제에서 규칙은 이 사용자의 시범 기간이 만료되기 전에 사용자가 서비스를 구입했는지를 확인합니다.

when a create account event has occurred,after a delay of the trial period of 'the user',
if    the number of purchase events is 0
then    print "The trial period of " + the name of 'the user' + "has expired. The user must purchase the service to continue using it."

now가 다른 이벤트와 동시임을 확인함으로써, when 파트가 포함되지 않는 규칙에서 이벤트의 부재를 발견할 수도 있습니다. 조건(definitions 및 if 파트)는 이벤트만 참조해야 합니다. 그렇지 않으면, 규칙의 인스턴스가 각각 두 번 이상 실행될 수 있습니다.

다음의 예에서, 에이전트가 항공편 출발 이벤트를 수신할 때 규칙은 에이전트가 항공편 출발 이벤트를 수신하지 않았음를 확인합니다.

definitions
    set 'the flight departure' to a flight departure event;
if    now is at the same time as the scheduled arrival time of 'the flight departure'
    and there is no flight arrival event
then    print "Missing flight arrival event";