renaming + changing location of shared components

Hi,
I have the following scenario:
I created some workflows including multiple shared components. Everything is currently created on my LOCAL space. Now I want to move parts of it to our SERVER. HOWEVER, the challenge is the following. (a) I want to move all shared components into a collective folder on the server (different path structure then in my LOCAL space). (b) I want to rename some of the shared components, in order to fit the global environment. But I do not want to manually go through hundreds of instances in my workflows and change the names manually.

Acc. (a): I came up with an XML-read-change-write-flow to search for all settings.xml files in the the respective workflows, that contain a link (‘sourceURI’), and change that link from what ever it is, to the new location on the server.
Does somebody have a smarter idea?

Acc. (b): I can use my XML-read-change-write flow to even put a new referenced name for the shared component, by simply changing the name within the link-string. That is, the respective instance of the shared component than references to the renamed shared component. HOWEVER, opening the the workflow, that uses this shared component, I see that the ‘Component Name’ still is the original, but not the one, that I put into the link within the settings.xml. NOTE: the update of the shared component works, with the new link, but the name of the instance just shows a different name within the workflow. I guess in order for KNIME to know what to show on top of a component, in terms of ‘Component Name’, it must be stored somewhere.
Where is actually the ‘Component Name’ saved?
How can I change the ‘Component Name’, at best programmatically, not manually via unlink… ?

NEW:


image

OLD:


image

P.S. I found only those two posts connected to this, but not satisfying to my challenge:
Working with Components
Editing shared Components

Thanks for your comments.
Best D

Hi @d00m,

interesting use case, which is not that easy to implement.

Regarding (a): I don’t have a better idea and would probably approach this in the same way.

Regarding (b): To rename the component you need to change in addition the workflow.knime file in the components folder of the workflow.

The workflow.knime file is also a xml file and can be edited by a workflow. The only point I don’t know how to solve (yet) is to rename it back in knime.workflow. Still looking for a solution for this :slight_smile: but this is probably only possible with a small Java Snippet.

Cheers
Kathrin

PS: I will come back to you regarding the last open point as soon as possible

1 Like

Hi @d00m,

and now I also found a solution for the rename file step. Please have a look at this example workflow and let me know in case of any questions.

Cheers
Kathrin

2 Likes