Let's help clarify the difference between metanodes and components.
What's a metanode? What's a component? And when do you use what?
The common goal: make order in a messy workflow
Both metanodes and components are useful to clean up messy workflows. You can identify isolated blocks of logical operations in your workflows and include them inside either a metanode or a component. Your workflow will appear neat and tidy with less nodes than the original workflow.
And that is where the metanode goal in life ends.
Figure 1. 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.
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.
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.
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.
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.
- Components on the KNIME Hub
- Blog article: Declutter - four tips for an efficient fast workflow
- Component Documentation
- Series of videos on components