anyOfAny Function Description

Description

This function applies a Boolean function on each tuple from the cross product on all bags arguments, and returns "True" if and only if the predicate is "True" for at least one inside-function call. This function is commonly combined with the equality function e.g. to prove that there is at least one attribute value in the first bag equal to a value in another bag. Several datatypes have a shortcut method typeAtLeastOneMemberOf (e.g. stringAtLeastOneMemberOf) which can be used instead of using the anyOfAny higher order function.

anyOfAny belongs to the ALFA function reference's higher order bag functions category. It maps to the XACML function identifier urn:oasis:names:tc:xacml:3.0:function:any-of-any, takes n+1 arguments and returns a value of type boolean.

Property Value
Category higher order bag functions
# Arguments n+1
Arguments
  • function(n arguments of primitive type): boolean;
  • a combination of n bags or primitive values of the right data type according to the function passed in as first parameter
Return Value boolean
Expressed As pre-fix
Representation ALFA short name
Allowed In Target false
ALFA Shorthand None
Commutative false

Example

/**
 * Returns permit if the citizenship bag of values contains at least
 * one value equal to at least one value of the allowedCitizenships
 * bag. The parameters passed into the function can be atomic values or bags.
 */
rule anyOfAnyExample{
    permit
    condition anyOfAny(function[stringEqual], citizenship, allowedCitizenships)
    // condition anyOfAny(function[stringEqual], citizenship, "Swiss") // This is also valid
}

In this example, the rule returns Permit if the citizenship bag of values contains at least one value equal to at least one value of the allowedCitizenships bag.

Related Functions

Other functions in the higher order bag functions category:

Browse the full ALFA function reference.