Skip to main content

Celonis Product Documentation

LINK_PATH_SOURCE - LINK_PATH_TARGET
Description

The LINK_PATH_SOURCE - LINK_PATH_TARGET operators return tables containing the links, respectively joined to source or target object, that were used during LINK_PATH traversal.

The output of LINK_PATH_SOURCE/LINK_PATH_TARGET is a column with all links of all paths contained in the LINK_PATH result table. Each row's data corresponds to the value of the traversed link in the specified mapping table column. The generated columns are joined to LINK_PATH's activity table in a N:1 fashion.

Syntax
 LINK_PATH_SOURCE ( link_path_table , mapping_table1.column [, mapping_table2.column ] ... )
 LINK_PATH_SOURCE ( link_path_table.column , mapping_table1.column [, mapping_table2.column ] ... )
 LINK_PATH_TARGET ( link_path_table , mapping_table1.column [, mapping_table2.column ] ... )
 LINK_PATH_TARGET ( link_path_table.column , mapping_table1.column [, mapping_table2.column ] ... )
NULL handling
  • Object Link mapping table entries with NULL values in the IN or OUT column will register the object specified in the none-NULL entry. However, no link will be added to the Object Link graph.

  • NULL values in the mapping_table.column are retained in the output.

Warning

Result table size: As the result contains all links that are used when traversing the graph, with multi-links the size of the table can become really large. The current limitations documented in Engine Limitations also hold for the result of LINK_PATH_SOURCE/LINK_PATH_TARGET. This means that the hard upper limit of rows for the result column of LINK_PATH_SOURCE/LINK_PATH_TARGET is 5 billion rows, and the recommended limit of rows is 800 million rows. In the following example you can see how the amount of rows in the LINK_PATH_SOURCE and LINK_PATH_TARGET table grows with the amount of multi-links.

Object_Link_LINK_PATH_SOURCE_TARGET_BLOWUP.png
Examples
Object_Link_example_graph.png

[1]

LINK_PATH_SOURCE and LINK_PATH_TARGET simply return a column of all involved links that have been visited during traversal. If the traversal of the Object Link graph does not contain any multi-edges, rows in that column will be joined in a 1:1 fashion with the associated SOURCE or TARGET node in the LINK_PATH table. In general, however, the connection between these tables and the LINK_PATH table is N:1, since there are N possible edges for 1 pair of nodes in the case of multi-edges. Therefore, we usually also don't have a common table between the LINK_PATH_SOURCE/LINK_PATH_TARGET tables.

This example lists all links that were traversed from any raw ingredient involved in producing 'Hard boiled eggs'. Note that the result of this example is independent of whether we use LINK_PATH_SOURCE or LINK_PATH_TARGET, as the outcome of these operators only differs in the join partner with the LINK_PATH table.

Query

Column1

         CASE_ID_COLUMN ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Dough' ) ) ) ) || ': ' || LINK_PATH_SOURCE ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Dough' ) ) ) , "ACTION"."OUT" ) || ' -> ' || LINK_PATH_SOURCE ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Dough' ) ) ) , "ACTION"."IN" )
        

Input

Output

ACTION

OUT : string

IN : string

DESCRIPTION : string

DURATION : int

'Olive oil'

'Dough'

'mix'

3

'Flour'

'Dough'

'mix'

3

'Egg'

'Dough'

'mix'

3

'Vegetables'

'Veggie pasta'

'steam'

10

'Chicken'

'Chicken pasta'

'roast'

25

'Chicken'

'Egg'

'lay'

null

'Egg'

'Chicken'

'hatch'

null

'Egg'

'Hard boiled eggs'

'boil'

7

'Egg'

'Hard boiled eggs'

'boil'

8

'Dough'

'Dough'

'knead'

5

'Dough'

'Pasta'

'rest & shape'

30

'Pasta'

'Veggie pasta'

'cook'

2

'Pasta'

'Chicken pasta'

'cook'

2

MATERIAL

ID : string

CATEGORY : string

QUANTITY : float

UNIT : string

PRICE : float

'Coal'

null

10.0

'kg'

1.0

'Olive oil'

'raw ingredients'

2.0

'tbsp'

0.08

'Flour'

'raw ingredients'

250.0

'g'

0.1

'Vegetables'

'raw ingredients'

500.0

'g'

2.3

'Chicken'

'raw ingredients'

1.0

'lbs'

6.0

'Egg'

'raw ingredients'

1.0

null

0.5

'Dough'

'intermediate goods'

400.0

'g'

1.0

'Pasta'

'intermediate goods'

400.0

'g'

3.5

'Veggie pasta'

'finished meals'

800.0

'g'

8.5

'Chicken pasta'

'finished meals'

900.0

'g'

9.5

'Hard boiled eggs'

'finished meals'

2.0

null

2.0

'Salad'

'finished meals'

500.0

'g'

6.5

Result

Column1 : string

'0: Dough -> Pasta'

'0: Pasta -> Veggie pasta'

'1: Dough -> Pasta'

'1: Pasta -> Chicken pasta'

[2]

This example shows how to solve the issue of having multiple links per pair of objects by utilizing a PU-operator. We can see that the result contains NULL values when the target object does not have a join partner in the operators' results and also when the link attribute is NULL.

Query

Column1

         CASE_ID_COLUMN ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."CATEGORY" = 'raw ingredients' ) , END ( "MATERIAL"."ID" = 'Hard boiled eggs' ) ) ) )
        

Column2

         LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."CATEGORY" = 'raw ingredients' ) , END ( "MATERIAL"."ID" = 'Hard boiled eggs' ) ) )
        

Column3

         PU_AVG ( ACTIVITY_TABLE ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."CATEGORY" = 'raw ingredients' ) , END ( "MATERIAL"."ID" = 'Hard boiled eggs' ) ) ) ) , LINK_PATH_TARGET ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."CATEGORY" = 'raw ingredients' ) , END ( "MATERIAL"."ID" = 'Hard boiled eggs' ) ) ) , "ACTION"."DURATION" ) )
        

Input

Output

ACTION

OUT : string

IN : string

DESCRIPTION : string

DURATION : int

'Olive oil'

'Dough'

'mix'

3

'Flour'

'Dough'

'mix'

3

'Egg'

'Dough'

'mix'

3

'Vegetables'

'Veggie pasta'

'steam'

10

'Chicken'

'Chicken pasta'

'roast'

25

'Chicken'

'Egg'

'lay'

null

'Egg'

'Chicken'

'hatch'

null

'Egg'

'Hard boiled eggs'

'boil'

7

'Egg'

'Hard boiled eggs'

'boil'

8

'Dough'

'Dough'

'knead'

5

'Dough'

'Pasta'

'rest & shape'

30

'Pasta'

'Veggie pasta'

'cook'

2

'Pasta'

'Chicken pasta'

'cook'

2

MATERIAL

ID : string

CATEGORY : string

QUANTITY : float

UNIT : string

PRICE : float

'Coal'

null

10.0

'kg'

1.0

'Olive oil'

'raw ingredients'

2.0

'tbsp'

0.08

'Flour'

'raw ingredients'

250.0

'g'

0.1

'Vegetables'

'raw ingredients'

500.0

'g'

2.3

'Chicken'

'raw ingredients'

1.0

'lbs'

6.0

'Egg'

'raw ingredients'

1.0

null

0.5

'Dough'

'intermediate goods'

400.0

'g'

1.0

'Pasta'

'intermediate goods'

400.0

'g'

3.5

'Veggie pasta'

'finished meals'

800.0

'g'

8.5

'Chicken pasta'

'finished meals'

900.0

'g'

9.5

'Hard boiled eggs'

'finished meals'

2.0

null

2.0

'Salad'

'finished meals'

500.0

'g'

6.5

Result

Column1 : int

Column2 : string

Column3 : float

0

'Egg'

null

0

'Hard boiled eggs'

7.5

1

'Chicken'

null

1

'Egg'

null

1

'Hard boiled eggs'

7.5

[3]

Since individual paths consist of multiple objects and these objects have multiple links associated with them, we need to resolve two consecutive N:1 connections if we want to relate link information to a single path. In this example, we calculate how many paths traverse the same objects, starting from eggs. Before we multiply the numbers of available links between connected objects, we have to explicitly ignore 0 counts by setting them to NULL.

Query

Column1

         VARIANT ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Egg' ) ) ) )
        

Column2

         PU_PRODUCT ( CASE_TABLE ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Egg' ) ) ) ) , REMAP_INTS ( PU_COUNT ( ACTIVITY_TABLE ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Egg' ) ) ) ) , LINK_PATH_SOURCE ( LINK_PATH ( "MATERIAL"."ID" , CONSTRAINED BY ( START ( "MATERIAL"."ID" = 'Egg' ) ) ) , "ACTION"."OUT" ) ) , [ 0 , NULL ] ) )
        

Input

Output

ACTION

OUT : string

IN : string

DESCRIPTION : string

DURATION : int

'Olive oil'

'Dough'

'mix'

3

'Flour'

'Dough'

'mix'

3

'Egg'

'Dough'

'mix'

3

'Vegetables'

'Veggie pasta'

'steam'

10

'Chicken'

'Chicken pasta'

'roast'

25

'Chicken'

'Egg'

'lay'

null

'Egg'

'Chicken'

'hatch'

null

'Egg'

'Hard boiled eggs'

'boil'

7

'Egg'

'Hard boiled eggs'

'boil'

8

'Dough'

'Dough'

'knead'

5

'Dough'

'Pasta'

'rest & shape'

30

'Pasta'

'Veggie pasta'

'cook'

2

'Pasta'

'Chicken pasta'

'cook'

2

MATERIAL

ID : string

CATEGORY : string

QUANTITY : float

UNIT : string

PRICE : float

'Coal'

null

10.0

'kg'

1.0

'Olive oil'

'raw ingredients'

2.0

'tbsp'

0.08

'Flour'

'raw ingredients'

250.0

'g'

0.1

'Vegetables'

'raw ingredients'

500.0

'g'

2.3

'Chicken'

'raw ingredients'

1.0

'lbs'

6.0

'Egg'

'raw ingredients'

1.0

null

0.5

'Dough'

'intermediate goods'

400.0

'g'

1.0

'Pasta'

'intermediate goods'

400.0

'g'

3.5

'Veggie pasta'

'finished meals'

800.0

'g'

8.5

'Chicken pasta'

'finished meals'

900.0

'g'

9.5

'Hard boiled eggs'

'finished meals'

2.0

null

2.0

'Salad'

'finished meals'

500.0

'g'

6.5

Result

Column1 : string

Column2 : int

'Egg, Dough, Pasta, Veggie pasta'

1

'Egg, Dough, Pasta, Chicken pasta'

1

'Egg, Chicken, Chicken pasta'

1

'Egg, Hard boiled eggs'

2

See also: