달력 기간 비교

달력 기간은 년, 월, 주, 일 및 당일 시간이 포함된 시간 단위를 기반으로 합니다. 예를 들어, 두 시점이 동일한 달력 기간에 있는지 또는 이벤트가 주중 특정 요일이나 일중 특정 시간에 발생하는지를 확인할 수 있습니다.

다음 연산자를 사용하여 두 시점의 달력 기간을 비교할 수 있습니다.

  • is in the same calendar year as

    유사한 연산자를 월, 주 및 일에 사용할 수 있습니다.

    예: the departure time of 'the flight' is in the same calendar month as the start of 'the business trip'

  • is in the same hour as

    유사한 연산자를 분 및 초에도 사용할 수 있습니다.

  • is before 또는 is after

    예: the calendar year of the departure time of 'the flight' is after the calendar year of the start of 'the business trip'.

  • is during

    예: the scheduled departure time of 'the flight' is during the calendar year 2013.

  • is during the same time as

    이 연산자는 두 기간이 동일한 인스턴트에 시작하고 동일한 인스턴트에 종료하는지 확인합니다. 예: the calendar year of the scheduled departure time of 'the flight' is during the same time as the calendar year 2013.

다음 규칙은 공항이 항공편의 출발과 동일한 날에 닫히는지 여부를 확인합니다. 항공편 출발이 2014년 2월 11일인 경우, 규칙은 공항 닫힘 이벤트도 2014년 2월 11일에 발생하는지 확인합니다.

when an airport closed event occurs
definitions
    set 'the flight' to a flight in the flights of 'the airport';
if    this airport closed event is on the same calendar day as the scheduled departure time of 'the flight' 
then    print "The departure airport is closed on the day of the flight.";

다음 규칙은 여행 일정 중에 일별 지출이 지정된 금액을 초과하는지 여부를 판별합니다. 여행의 시작일과 종료일 중의 구매는 고려되지 않습니다.

definitions
  set 'the trip' to a trip in the trips of 'the customer'; 
  set 'on-trip purchases' to all purchase events where
    the calendar day of each purchase event is after the start of 'the trip' 
      and
    the calendar day of each purchase event is before the end of 'the trip';
if the total amount of 'on-trip purchases'/ 
   the duration between the start of 'the trip' and the end of 'the trip' in days    
   is more than 1000
then print "Average spending per day is high";

주중 요일

다음은 주말 중의 쇼핑과 주중 근무일 중의 쇼핑을 비교합니다.
definitions
    set 'purchases last 6 months' to all purchase events
        where each purchase event is during the last period of 6 months;
    set 'workweek purchases' to all purchase events in 'purchases last 6 months'
        where the day of week of each purchase event is after or the same as Monday
        and the day of week of each purchase event is before or the same as Friday;
    set 'weekend purchases' to all purchase events in 'purchases last 6 months'
        where the day of week of each purchase event is before Monday
        and the day of week of each purchase event is after Friday;
if    the total amount of 'weekend purchases' is more than the total amount of 'workweek purchases'
then    print "Spending is higher at weekends.";

다음 규칙은 화요일에 실시되는 기내 구매에 대한 프로모션을 제공합니다.

definitions
    set 'the flight' to a flight in the flights of 'the customer';
    set 'the flight period' to the period between the scheduled departure time of 'the flight' and the scheduled arrival time of 'the flight';
    set 'purchase on board' to a purchase event
        where this purchase event is during 'the flight period';
if    'purchase on board' is on Tuesday
then    print "apply special Tuesday discount for on-board purchases.";

당일 시간

당일 시간은 일반적인 시간 표기법으로 시, 분 및 초의 항목으로 지정됩니다(예: 11:59:59 PM).

다음 규칙은 지난 6개월 동안 오전 항공편의 수와 오후 항공편의 수를 비교합니다.

definitions
    set 'flights last six months' to all flights in the flights of 'the customer'
        where the scheduled departure time of each flight is during the last period of 6 months;
    set 'morning flights' to all flights in 'flights last six months'
        where the time of day of the scheduled departure time of each flight is before 12:00:00 PM;
    set 'afternoon flights' to all flights in 'flights last six months'
        where the time of day of the scheduled departure time of each flight is after or the same as 12:00:00 PM;
if    the number of flights in 'morning flights' is more than the number of flights in 'afternoon flights'
then    print "more morning flights than afternoon flights.";