Using the WorkflowManager to create a KNIME workflow from scratch

Hello,

It is our goal to load/save the structure of a KNIME workflow in a file/database.

Normally a KNIME workflow is edited by the user and stored in the workspace. In our application, however, we want to be able to create and process (large amounts of) workflows automatically. The problem is, that a workflow graph once stored in a file/database cannot be visualized as a KNIME workflow anymore.

The WorkflowManager class appears to provide this functionality. I imagine that with its help one can create an empty workspace and make the wanted nodes, their configurations and links appear, then store it away in a specified KNIME workfow file.

So far I was not able to instantiate a WorkflowManager or fetch one from inside a NodeModel.execute() method. There is a forum post from 2007 that seems to be related to the problem mentioned but the interface of the WorkflowManager seems to have changed until then.

http://tech.knime.org/node/20218

I would appreciate your advice in the matter.

Best regards
Jorgen

Hi J├Ârgen,

I am not quite sure I understand where you are heading with this? Do you want to use the WorkflowManager class to automatically create/store/retrieve entire workflows or do you want to manipulate the workflow from the "inside" - which is what you seem to indicate when you refer to the execute() method? If it's the latter - do you mind outlining your use case? The NodeModel does not have access to its workflowmanager on purpose - we don't want nodes messing with their surroundings so that KNIME can keep control over execution/storage etc of each node.

For the former you can simply use the WorkflowManager API and load/save workflows. The way I understand your post, I would simply put archives of workflows into the database (similar to what the import/export creates) that way you can later open them also in the KNIME GUI again. Also here I'd be curious to hear why you are planning on doing that :-)

Please note that we do not consider the WorkflowManager API to be part of the stable setup that is intended for "outside" use - so it may change in future versions. For the Node API we pay great attention to remaining backwards compatible but we can't guarantee this for all classes in the workflow package. We'd love to but sometimes progress requires disruption...

Cheers, Michael