숫자를 테스트하는 조건
하나 이상의 오브젝트가 데이터 세트에 존재하는지 확인하는 조건을 빌드할 수 있습니다.
다음 정의는 지정된 데이터에 대해 테스트하는 연산자를 포함합니다.
- there are
there are 연산자는 규칙을 호출하는 애플리케이션의 데이터에 특정 유형의 오브젝트가 지정된 수로 있는지 여부를 테스트합니다.
다음 조건은 두 항공편을 확인합니다.
if there are 2 flights in the flights of 'the customer' then...
where 연산자를 사용하여 비즈니스 용어에 적용할 추가 조건을 지정할 수 있습니다.
10명의 고객이 있는 경우와 각 고객이 골드 카테고리의 구성원인 경우에만 다음 규칙 조건이 true입니다.
if there are 10 customers where the category of each customer is Gold, then...
시간 필터 연산자를 사용하여 오브젝트의 콜렉션이 특정 기간 또는 시점과 관련된 시간에 존재하는지를 확인할 수도 있습니다. where 연산자가 있는 조건에서는 시간 필터 연산자가 우선으로 적용됩니다.
다음 연산자를 사용하여 기간에 따라 오브젝트의 콜렉션을 필터링할 수 있습니다.- before
- after
- during
다음 연산자를 사용하여 시점에 따라 오브젝트의 콜렉션을 필터링할 수 있습니다.- before
- after
- at
- before or at
- at or after
예를 들어, 시간 창에서 during 연산자를 사용하여 이 시간 창에 따라 비즈니스 용어에 필터링을 적용할 수 있습니다. 다음 규칙 조건은 고객이 골드 카테고리의 멤버인 지난 2주 간의 두 항공편을 확인합니다.
if there are 2 flights in the flights of 'the customer' during the last period of 2 weeks where the category of 'the customer' is Gold, then...
- there are at least 및 there are at most
다음 연산자는 데이터에 포함된 비즈니스 용어의 인스턴스가 지정된 수보다 많은지 적은지를 검사합니다.
there are at least: 비즈니스 용어의 발생 수가 지정된 수 이상인 경우 이 조건은 true입니다.
there are at most: 비즈니스 용어의 발생 수가 지정된 수 이하인 경우 이 조건은 true입니다.
다음 조건은 3명 이하의 골드 고객이 있는지 검사합니다.
if there are at most 3 customers where the category of each customer is Gold, then...
다음 조건은 골드 고객이 실버 고객보다 많은지 여부를 검사합니다. 규칙이 다음 변수를 정의하여 시작됩니다.
silver customers: 실버 카테고리의 고객 목록입니다.
silver count: 실버 카테고리의 고객 수입니다.
그러면 규칙이 이러한 변수를 사용하여 골드 고객 수를 실버 고객 수와 비교합니다.
definitions set 'silver customers' to all customers in the boarded passengers of 'the flight' where the category of each customer is Silver; set 'silver count' to the number of 'silver customers' if there are at least ('silver count' + 1) customers where the category of each customer is Gold, then...
- there is at least one
there is at least one 연산자는 규칙을 호출하는 애플리케이션의 데이터에 비즈니스 용어의 인스턴스가 최소한 하나가 있는지 확인합니다. 데이터에는 비즈니스 용어의 인스턴스가 둘 이상 포함될 수 있습니다.
다음 조건에서 하나 이상의 customer 오브젝트를 찾습니다.
if there is at least one customer then...
다음 예제에서는 한 명 이상의 시니어 골드 고객이 있는지 검사합니다.
definitions set 'gold customers' to all customers in the boarded passengers of 'the flight' where the category of each customer is Gold; if there is at least one customer in 'gold customers' where the age of this customer is at least 65, then...