Skip to content
Maarten Hilferink edited this page Apr 8, 2026 · 7 revisions

Relational functions invert

syntax

  • invert(relation)

definition

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.

applies to

  • attribute relation with value type of the group CanBeDomainUnit

performance

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).

example

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
1
4
3
7
null

domain Region, nr of rows = 5

Clone this wiki locally