No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Tuple is a fancy word for something “taped together from bits and pieces of other stuff”. This is very useful when it comes to building result sets that are not necessarily something that exists in your model - like sums or collecting names and addresses together even if they are stored in different classes. | |||
Tuples are what an SQL server returns when you omit the “*” and write explicit stuff in the select part. In fact, the columns in the select part are the tuple definition as far as the SQL server is concerned. | Tuples are what an SQL server returns when you omit the “*” and write explicit stuff in the select part. In fact, the columns in the select part are the tuple definition as far as the SQL server is concerned. | ||
Line 7: | Line 7: | ||
* [[OCLOperators collect|Collect]] | * [[OCLOperators collect|Collect]] | ||
==== Example ==== | ==== Example: ==== | ||
IElement elem = ocl.Evaluate(“Class1.allinstances.class2.class3->groupby(x|x.Attribute1)”); | <code>IElement elem = ocl.Evaluate(“Class1.allinstances.class2.class3->groupby(x|x.Attribute1)”);</code> | ||
What do I get back? A Tuple | |||
The tuple consists of a type with a generated name and specific properties. The properties are Attribute1 and List. | The tuple consists of a type with a generated name and specific properties. The properties are Attribute1 and List. | ||
The code below shows how to access the tuple result in code: | The code below shows how to access the tuple result in code: | ||
[[Category:OCLOperators]] | [[Category:OCLOperators]] |
Revision as of 07:29, 2 May 2023
Tuple is a fancy word for something “taped together from bits and pieces of other stuff”. This is very useful when it comes to building result sets that are not necessarily something that exists in your model - like sums or collecting names and addresses together even if they are stored in different classes.
Tuples are what an SQL server returns when you omit the “*” and write explicit stuff in the select part. In fact, the columns in the select part are the tuple definition as far as the SQL server is concerned.
OCL operators that create tuples are:
Example:
IElement elem = ocl.Evaluate(“Class1.allinstances.class2.class3->groupby(x|x.Attribute1)”);
What do I get back? A Tuple
The tuple consists of a type with a generated name and specific properties. The properties are Attribute1 and List.
The code below shows how to access the tuple result in code: