You are viewing the documentation for Blueriq 16. Documentation for other versions is available in our documentation directory.
UNION
Adds two collections of the same base type to a new collection.
Syntax
UNION ( collection1 , collection2 )
Inputs
- collection1 - First collection to be added to the new collection.
- collection2 - Second collection to be added to the new collection.
Return type
- collection
Venn diagram
Examples
Suppose you have a Parent
and a Child
entity, where Parent
has a multivalued relation with Child
via the relation Parent.has_Children
. With this model the following instances are created:
Parent instance | Child instance | Child.name | Child.age | Child.hobbies |
---|---|---|---|---|
Parent_1 | Child_1 | “Kim” | 11 | “Reading”, “Dancing” |
Parent_1 | Child_2 | “Rick” | 9 | “Tennis”, “Dancing” |
Parent_1 | Child_3 | “Bob” | ? | “Painting”, “Basketball”, “Reading” |
Parent_2 | Child_4 | “Mary” | 10 | “Football” |
Expression | Result | Type | Remarks |
---|---|---|---|
UNION ( Parent[Parent_1].has_Children , Parent[Parent_2].Has_Children ) | [ Child_1, Child_2 , Child_3, Child_4 ] | Collection of Child instances | |
UNION ( Parent[Parent_1].has_Children.name , Parent[Parent_2].Has_Children.name ) | [ “Kim”, “Rick”, “Bob”, “Mary” ] | String (multivalued) | |
UNION ( Child[Child_2].hobbies , "Reading" ) | [ “Tennis”, “Dancing”, “Reading” ] | String (multivalued) | |
UNION ( Child[Child_1].hobbies , Child[Child_2].hobbies ) | [ “Reading”, “Dancing”, “Tennis” ] | String (multivalued) | |
UNION( Child[Child_3].age, [1, 2] ) | UNKNOWN | Integer (multivalued) | Since the age of Child_3 is unknown, the expression will result in unknown. |
UNION( LIST(Child[Child_3].age), [1, 2] ) | [1, 2] | Integer (multivalued) | The result of LIST(Child[Child_3].age) is an empty list. |
Overview
Content Tools