Declarative Objectivity (DO) Language : Expressions : Collection Structures
Collection Structures
A collection structure is an expression whose components specify the element values of a list, set, or map.
Syntax 

collectionStructure : listStructure | setStructure | mapStructure;
listStructure : LIST '{' expression (',' expression)* '}' ;
setStructure : SET '{' expression (',' expression)* '}' ;
mapStructure : MAP '{' mapElement (',' mapElement )* '}' ;
mapElement : expression ':' expression;
Quick Look 
Return the vehicles whose service records consist (only) of two specified strings:
FROM Vehicle WHERE servRecs == LIST{'initial inspection', 'oil change'} RETURN *;
Replace the rental company’s set of vehicles with the specified set:
UPDATE RentalCompany SET vehicles TO SET{3-3-1-9, 3-3-1-12, 3-3-1-15};
Replace the rental company’s map of customers with the specified map:
UPDATE RentalCompany SET customers TO MAP{'009':3-3-1-5, 'martin123':3-3-1-26};
Create a new location with the specified airport code and list of stalls:
CREATE Location{airportCode:'LAX', stalls: LIST{3-3-1-47, 3-3-1-48}};
Discussion 
A collection structure is an expression that specifies the type of a collection and provides at least one of its elements.
Specifying a Collection Structure’s Type
A collection structure must begin with a keyword that specifies the type of collection being represented:
LIST{...}
Represents a list and its elements.
SET{...}
Represents a set and its elements.
MAP{...}
Represents a map and its elements.
By convention, the keywords are written all uppercase, but they are not case-sensitive. For example, LIST could be List, list, and so on.
Specifying Elements in a List Structure
A list is an ordered grouping of elements, which may include duplicates. Furthermore, a list maintains its elements in the order in which you add them.
You specify a list’s elements as a sequence of comma-separated expressions enclosed in curly braces. Each expression must return a value of the element type defined for the list.
Because element ordering is significant in a list, you should to provide the element expressions in the appropriate order. If you attempt to use a LIST structure to qualify an object that has a list attribute, and the element ordering in the LIST structure does not match the element ordering of the object’s list, the predicate will not evaluate to true.
If the list you are representing has a fixed size, and you specify too many elements, an error is returned.
Specifying Elements in a Set Structure
A set is an ordered or unordered grouping of unique elements. A set automatically organizes its elements based on their identity or values, without regard to any user-defined ordering.
You specify a set’s elements as a sequence of comma-separated expressions enclosed in curly braces. Each expression must return a value of the element type defined for the set.
Because element ordering is not significant in a set, the order of specified element expressions is not checked.
If you include element expressions that evaluate to duplicate values, only one of those values is used, and the remaining duplicates are ignored.
Specifying Elements in a Map Structure
A map is an ordered or unordered grouping of elements that are key-value pairs. The keys within a map must be unique, although they may lead to duplicate values. A map automatically organizes its elements based on the keys, without regard to any user-defined ordering.
You specify a map’s elements as a sequence of comma-separated mapElement expressions enclosed in curly braces. Each mapElement expression consists of a key:value pair, where key and value are expressions whose return types are compatible with the key and value types defined for the map.
Because element ordering is not significant in a map, the order of specified mapElement expressions is not checked in map structure.
If you include mapElement expressions with duplicate keys, only the last (rightmost) mapElement is used. For example, the following map structure includes three map elements with the same key ('martin123'). Of these, only the last (with the value 3-3-1-785) is used:
MAP{'martin123':3-3-1-34, '009':3-3-1-5, 'martin123':3-3-1-26, 'martin123':3-3-1-785}