Map operator
Purpose
The Map operator produces its output by using only selected parts of its input.
The correspondence between input parts and corresponding output parts is called mapping, hence the name of the operator.
The Map operator is particularly useful downstream of a Join block to "clean up" the composite output of that operator or to create a customized version of it, as the final output of the workflow or as the input to further blocks. For this reason, it can be considered a post-processor.
Defining the map
The map between input and output is defined by editing the block in the workflow editor.
To create a mapping:
- Edit the block.
- Select the plus key and it is displayed the output key on the left, a drop-down menu on the right, ans and the Filter components hexagon between them.
- Enter the name of the output key in the left field.
-
Select the corresponding input property from the drop-down menu.
Note
Select Filter components if you have a workflow with many blocks and you want to display in the drop-down menu on the left only the keys of a single component.
Enter a string in the input keys drop-down to filter them according to your need.
In the image below you can see an example of mapping.
The drop down menu shows "dotted" entries, for example:
block name.document.categories
together with the names of their "parent" blocks.By choosing a block name instead of one of its "dotted" properties, the corresponding portion of the output of the Map block is an object whose value is the entire portion of the input produced by the chosen input block.
If all or part of the output comes from an ML model and has not been filtered along the path, only the ML output is available despite the possibility of mapping also for the symbolic part.
In this case, trying to map a symbolic key returns a null
value in output.
Select Remove to remove a single mapping.
Select Clear to clear the single input key.
Output
The output of a Map block is a JSON object containing the results of the input mapping. Its structure is as follows:
{
first key: mapped input property
second key: mapped input property
third key: mapped input property
...
}
If a mapped input property is missing at run time, the corresponding output object will be set to null
.
Block properties
A Map operator block has these properties:
- The unique block ID and the service version, displayed in the title bar (read only, displayed also in the block tooltip in the canvas).
- Block name.