Combine_data
Relational functions combine_data
syntax
- combine_data (combined_domain, a_rel, b_rel)
definition
combine_data(combined_domain, a_rel, b_rel) results in an Attribute with Index numbers to the combined_domain Argument, combining the values of data items a_rel and b_rel.
description
The first argument combined_domain is usually made with a Combine function.
The combine_data function results in an attribute with an index to combined_domain for each element of the domain of a_rel and b_rel, with as Values unit the first Argument of the function (combined_domain) and as Domain unit the domain unit of the data items a_rel and b_rel.
applies to
- Unit combined_domain with value type from the group CanBeDomainUnit.
- attributes a_rel, b_rel with value type from group CanBeDomainUnit.
conditions
- The domain units of the data items a_rel and b_rel must match (or be all Void).
- values unit of b_rel must match the 2nd argument of the combine or combine_unit with which the combined_domain has been defined.
since version
7.131
performance
O(n) where n = number of elements in the domain of a_rel and b_rel. Single pass computing combined index from input relations.
combining multiple indices
combine_data can only be used to combine two indices.
When 3 (or more) indices need to be combined, chain them:
unit<uint32> BC := combine_unit(B, C);
unit<uint32> ABC := combine_unit(A, BC);
attribute<ABC> ABC_rel (domain) := combine_data(ABC, domain/A_rel, combine_data(BC, domain/B_rel, domain/C_rel));
example
unit<uint32> NHCityYear := combine(NHCity, YearDomain);
attribute<NHCityYear> NHCityYear_rel (Adomain) := combine_data(NHCityYear, NHCity_rel, YearDomain_rel);
| NHCity_rel | YearDomain_rel | NHCity | Year | NHCityYear_rel |
|---|---|---|---|---|
| 0 | 0 | Amsterdam | 1995 | 0 |
| 0 | 1 | Amsterdam | 2005 | 3 |
| 1 | 1 | Haarlem | 2005 | 4 |
| 2 | 0 | Alkmaar | 1995 | 2 |
| 2 | 1 | Alkmaar | 2005 | 5 |
ADomain, nr of rows = 5
| nr_1 | nr_2 | NHCityName | Year |
|---|---|---|---|
| 0 | 0 | Amsterdam | 1995 |
| 0 | 1 | Amsterdam | 2005 |
| 1 | 0 | Haarlem | 1995 |
| 1 | 1 | Haarlem | 2005 |
| 2 | 0 | Alkmaar | 1995 |
| 2 | 1 | Alkmaar | 2005 |
domain NHCityYear, nr of rows = 6
| NHCity/name |
|---|
| Amsterdam |
| Haarlem |
| Alkmaar |
domain NHCity, nr of rows = 3
| YearDomain/Year |
|---|
| 1995 |
| 2005 |
Yeardomain, nr of rows = 2
see also
- full configuration example: Overlay versus Combine data