Rjoin

From ObjectVision

Jump to: navigation, search

Relational functions rjoin

Contents

syntax

  • rjoin(foreign_key, primary_key, values)

definition

rjoin(foreign_key, primary_key, values) results in an attribute with the values of argument values for the domain unit of argument foreign_key.

The resulting data item has the same values unit as the values argument and the same domain unit as the foreign_key argument.

description

The rjoin function is advised if an attribute is available to relate domain (e.g. a region code), not being a relation in GeoDMS terms.

If a relation is available, use the faster lookup function.

A rjoin function is rewritten to a rlookup function (to create a relation) and a lookup function (to use the relation), see the example.

We advise that the primary_key argument can be used as primary key for the domain unit of this argument. If multiple instances of this argument occur, the resulting value will be based on the first index number found.

applies to

conditions

  1. The values unit of the arguments foreign_key and primary_key must match.
  2. The domain of arguments primary_key and values must match.

since version

5.15

example

attribute<degrees> rjoinTemperature (City) := rjoin(City/RegionCode, Region/RegionCode, Region/Temperature);

This is rewritten within the GeoDMS to:

attribute<Region>   Region_rel  (City)  := rlookup(City/RegionCode, Region/RegionCode)
attribute<degrees> Temperature (City) := Region/Temperature[Region_rel];
City/RegionCode rjoinTemperature
100 12
200 11
300 null
200 11
400 14
null null
400 14

domain City, nr of rows = 7

Region/RegionCode Region/Temperature
100 12
200 11
300 null
400 14
500 13

domain Region, nr of rows = 5

Personal tools