KNIME logo
Contact usDownload
Read time: 4 min

Metanode or Component – What's the Difference?

Get explanations of both to improve clarity of your workflow and make it easier to reuse and share work with colleagues

August 3, 2020
Put simply
2020-08-03-component-vs-meatnode.png
Stacked TrianglesPanel BG

As a data scientist, you need to know exactly what happens with the data along the different stages of your process. That's why visual workflows make sense: You can see and examine what's happening to your data at each individual step.

Sometimes, however, even visual processes can get messy and it becomes difficult to keep track of the operations and then collaborate and share work with colleagues.

In this article we want to show you how "metanodes" and "components" in the low-code KNIME Analytics Platform enable you to organize logical chunks of your process into units for more process clarity and reusability. We'll explain the difference between a metanode and a component and give tips on when to use what.

Let's have a closer look.

What's a metanode? What's a component? And when do you use what?

Metanodes and components share a common goal: They both make order in a messy workflow. You can use them both to improve the readability of untidy workflows. Identify isolated blocks of logical operations in your workflows and put these steps inside either a metanode or a component. Your workflow will appear neat and tidy with less nodes visible in comparison to the original workflow.

And that is where the metanode goal in life ends.

knime-components-blog.png
Two visual configurations of the same example workflow. The usage of metanode and components (right) makes the view neat and clear.

What can a component do that a metanode cannot?

Let’s see now what a component can do additionally in comparison with a metanode.

A component can encapsulate flow variables

"What happens in the component stays in the component." This sentence describes the vacuum character of a component. Flow variables created within the component will not leave the component unless this is expressly set in the “Component Output” node. Note that flow variables created in the workflow but outside of the component will not enter the component, unless expressly set to do so in the “Component Input” node.

2-metanode-or-component.png

Figure 2. Sub-workflow view inside a component (Ctrl+double click the component to open this view).

In a metanode, all flow variables come in from the parent workflow and all flow variables created within the component go out into the workflow. No barriers, no limits. The risk is to otherwise generate an overpopulation of flow variables.

A component can have a configuration window

Components can have a configuration window, metanodes cannot.

Inserting one or more nodes from the folder “Workflow Abstraction/Configuration” provides one or more items for the configuration window of the component. The settings in the configuration window for these nodes are passed into the configuration window of the component. You can give a component a more or less complex configuration window, by inserting more or less of the configuration-type nodes.

Note. This is a way to create a new node without coding! All of the node templates in “EXAMPLES/00_Components” in the KNIME Explorer panel (or here on the KNIME Hub) are actually components that have a configuration window.

3-metanode-or-component.png

Figure 3. Configuration nodes inside a component (left). The configuration window of the component will let the user select the desired options (right).

A component can be given a view

Components can get a view, metanodes cannot.

Inserting one or more nodes from the folder “Workflow Abstraction/Widgets” means that you have one or more items for your component views. The interactive view of these nodes is passed into the interactive view of the component. Views with many items from many corresponding widget nodes are called composite views.

4-metanode-or-component.png

Figure 4. Widget nodes inside a component (left). Each widget node is shown in the interactive view of the component (right).

In addition, Widget node views inside the same component subscribe to the selection and visualization of the same data. This means that what is selected in the view of a plot, for example, is also selected (and can be visualized exclusively) in the view of another plot within the same view of the same component.

5-metanode-or-component.gif

Figure 5. Component interactive view. Each visualization subscribes to the selection of the other plots, changing appearance accordingly.

You can give a component a more or less complex composite view, by inserting more or less complex, interactive, connected Widget-type nodes.

How to make the choice

At this point the choice is easy. Try asking yourself these questions:

  • Do you need a new node with configuration settings? -> a component
  • Do you need a node producing a composite view? -> a component
  • Do you have a huge workflow and you would like to remove some of the flow variables going around in the workflow? -> a component
  • Do you just need to make space in an overcrowded workflow? -> a metanode

Refer to this table summary showing what a metanode can do and what a component can do.

6-metanode-or-component.png

Resources