Specifies the cardinality constraint of the group:
OneOf
: Requires exactly one of the input-group members to be present.OneOrMoreOf
: Requires one or more of the input-group members to be present.ZeroOrOneOf
: Requires that at most one of the input-group members.ZeroOrMoreOf
: Allows any number of the input-group members.As their names suggest, these specify the minimum and maximum quantities of member inputs that must be present (and valid) for this input-group to be valid upon evaluation.
The FindCountry
action below searches for a country given the two letter country code (for example, US) or the three letter country code (for example, USA). The system will prompt
for a countryCode value if neither the two letter nor the three letter code is provided.
action (FindCountry) {
description ("Search for a country given the two letter or three letter country code")
type (Search)
collect {
// require a postal code or a search region or both
input-group (countryCode) {
// require at least either a two letter country code (for example, 'US') or a three letter country code (for example, 'USA')
requires (OneOf)
collect {
input (two_letter_code) {
type (ISOCountryCode2)
min (Optional)
}
input (three_letter_code) {
type (ISOCountryCode3)
min (Optional)
}
}
}
}
output (Country)
}
As another example the FindPointOfInterest
action below searches for a point of interest (POI) inside the given search region given the POI's name or type or both. The system will prompt for a countryCode value if neither the two letter nor the three letter code is provided.
action (FindPointOfInterest) {
description ("Search for a point of interest (POI) inside the given search region given the POI's name or type.")
type (Search)
collect {
input (searchRegion) {
type (geo.SearchRegion)
min (Required)
}
input-group (typeAndOrName) {
// search either by type (for example, `lake`) or name (`shasta`) or both
requires (OneOrMoreOf)
collect {
input (type) {
type (PointOfInterestType)
min (Optional)
}
input (name) {
type (PointOfInterestName)
min (Optional)
}
}
}
}
output (PointOfInterest)
}
The date input-group
in the FindReservation
action below declares that the action can take either a date (for example, Wednesday) or a date & time (for example, Wednesday at 3 p.m.) as an input (but cannot take both).
action (FindReservation) {
type (Search)
description ("Retrieve action for flight booking reservation using origin, destination or one of departure date (Wednesday) or departure date & time (Wednesday at 3 p.m.)")
collect {
input (origin) {
type (DepartureAirport)
min (Optional) max (Many)
}
input (destination) {
type (ArrivalAirport)
min (Optional) max (Many)
}
input-group (dates) {
// look up the reservation either by date or by date and time
requires (ZeroOrOneOf)
collect {
input (departureDate) {
type (viv.time.Date)
min (Optional) max(One)
}
input (departureDateTime) {
type (viv.time.DateTime)
min (Optional) max(One)
}
}
}
}
output (Reservation)
}
The FindContact
action below can search for contacts either by the organization name or a combination of given, middle and family names.
action (FindContacts) {
type (Search)
description (Get user's contacts.)
collect {
input (organizationName) {
type (OrganizationName)
min (Required)
max (One)
}
input-group (name) {
requires (ZeroOrMoreOf)
collect {
input (givenName) {
type (viv.person.GivenName)
}
input (middleName) {
type (viv.person.AdditionalName)
}
input (familyName) {
type (viv.person.FamilyName)
}
}
}
}
output (Contact)
}
}