timeUnion Function Description

Description

This function takes two or more arguments that are both a bag of time values. It returns a bag of time such that it contains all elements of all the argument bags. The function gets rid of duplicates, as determined by the equality functions.

timeUnion belongs to the ALFA function reference's Set functions category. It maps to the XACML function identifier urn:oasis:names:tc:xacml:1.0:function:time-union, takes 2 or more arguments and returns a value of type A bag of values of type time with no duplicates..

Property Value
Category Set functions
# Arguments 2 or more
Arguments
  • A bag of type time
  • A bag of type time
  • Optionally more bags of type time
Return Value A bag of values of type time with no duplicates.
Expressed As pre-fix
Representation ALFA short name
Allowed In Target false
ALFA Shorthand None
Commutative true

Example

/**
* Allow a user to eat if it's  mealtime or snacktime. Note the use of special
* attribute currentTime which the PDP resolves itself to the current time. Note the use
* of timeUnion() to construct a collection of times.
*/
rule timeUnionExample{
    target clause Attributes.actionId=="eat"
    permit
    condition timeIsIn(timeOneAndOnly(Attributes.currentTime),timeUnion(mealTimes, snackTimes))
}

In this example, we use the timeUnion function in conjunction with timeIsIn to determine whether a single atomic value is in the union of 2 bags of values. This also shows how functions can be combined together in ALFA.