Invert - ObjectVision/GeoDMS GitHub Wiki
Relational functions invert
- invert(relation)
invert(a) inverts the relation argument.
Inverting means the resulting attribute has as domain unit the values unit and as values unit the domain unit of the relation argument.
- attribute relation with value type of the group CanBeDomainUnit
O(n) where n = number of elements in the domain of relation. Single pass finding last occurrence of each value. For multiple occurrences per value, see invertAll which builds linked lists in O(n).
For a resulting row that is null, the value info dialog reports no row of the inverted
attribute refers to this row: no element of the relation argument holds that row number. For a row
that does have a value, the dialog lists every element of relation that maps onto it, not only
the one that was kept — which is how a value dropped because of a duplicate becomes visible. In the
example below, row 1 of the result lists both row 1 and row 3 of City/Region_rel. (since 20.16.0)
attribute<Region> invertRegion_rel (Region) := invert(City/Region_rel);
| City/Region_rel |
|---|
| 0 |
| 1 |
| 2 |
| 1 |
| 3 |
| null |
| 3 |
domain City, nr of rows = 7
| InvertRegion_rel |
|---|
| 0 |
| 3 |
| 2 |
| 6 |
| null |
domain Region, nr of rows = 5