Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
INTERSECTION ( Child[Child_2].hobbies ,
Panel
bgColorwhite

UNION


Adds two collections of the same base type to a new collection.


Syntax

Code Block
 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 instanceChild instanceChild.nameChild.ageChild.hobbies
Parent_1Child_1“Kim”11“Reading”, “Dancing”
Parent_1Child_2“Rick”9“Tennis”, “Dancing”
Parent_1Child_3“Bob”?“Painting”, “Basketball”, “Reading”
Parent_2Child_4“Mary”10“Football”
ExpressionResultTypeRemarks
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( ?, [1, 2] )UNKNOWNInteger (multivalued)

Back to top

Panel
bgColorwhite
Child[Child_3].age, [1, 2] )UNKNOWNInteger (multivalued)Since the age of Child_3 is unknown, the expression will result in unknown.
UNION( LIST(

INTERSECTION

This function determines the intersection of two collections. It returns a collection containing the items that are present in both specified collections.

Syntax

Code Block
INTERSECTION ( collection1 , collection2 )
Inputs
  • collection1, collection2 - Collections to be intersected. These collections must be of the same base type.

Return type

  • collection

Venn diagram

Image Removed

Examples

Suppose the following model. Entity Teacher has a multivalued relation with entity Child via the relation Teacher.teaches_Children.

Teacher instanceChild instanceChild.nameChild.hobbies
Teacher_1Child_1“Kim”“Reading”, “Dancing”
Teacher_1Child_2“Rick”“Tennis”, “Dancing”
Teacher_1Child_3“Bob”“Painting”, “Basketball”, “Reading”
Teacher_2Child_1“Kim”“Reading”, “Dancing”
Teacher_2Child_3“Bob”“Painting”, “Basketball”, “Reading”
Teacher_2Child_4“Mary”“Football”
ExpressionResultType
INTERSECTION ( Teacher[Teacher_1].teaches_Children , Teacher[Teacher_2].teaches_Children )[ Child_1 , Child_3 ]Collection of Child instances
INTERSECTION ( Teacher[Teacher_1].teaches_Children.name , Teacher[Teacher_2].teaches_Children.name )[ "Kim" , "Bob" ]String (multivalued)
INTERSECTION ( Child[Child_1].hobbies , Child[Child_3].hobbies )[ "Reading" ]String (multivalued)
Child[Child_3].
hobbies )[ ]String (multivalued)INTERSECTION( ?, 
age), [1, 2]
)UNKNOWNInteger (multivalued
)
back-to-top