Building complex XML using Knime Nodes

I'll try to keep this as succint as possible, basically I need to make available to a node some IDs of all adjacent nodes upstream nodes.

This is simple enough if you have a linear workflow, you could have a PREV_NODE_NAME flow variable that would be overwritten by each other node after it is read. When branching, however, this becomes problematic as when multiple nodes flow into a common one, there would be issues with multiple variables having the same name.

Would there be any way of implementing this ?


For in-depth details about my use-case, i've created the following question on stackoverflow

Instead of trying to use flow variables to carry this information, you can maybe try using a custom port object capable of carrying the information you need.  You may then need a 'merge' node to handle recombination of branches (remember that flow variables are always merged from the top port down so duplicate variables will be overwritten with one branch's content)

From memory, you probably would want to subclass AbstractSimplePortObject and AbstractSimplePortObjectSpec



Yeah, the poblem with flow variables overwriting eachother was my main issue. I didn't think about custom port types though, i'll definitely look into this, thanks :D

So you're manipulating xml, which is basically a special graph... And there are both xml cells as well as graph ports in Knime. Both may be useful without resorting to custom ports. In fact, my first approach would probably be to try to manipulate xml cells directly with the xpath node before trying to implement something custom. Implementing nodes would then be nothing more than solidifying these preliminary results. Maybe all that would be needed apart from custom nodes would be a wrapper for xml cells as in the case of the pmml cells. I don't know how easy this approach is with such more complex structures, though. These are just uninformed, unfiltered thoughts.

So i ended up going the way of creating my custom port objects as this saves me huge headaches. Except that the issue i have now is making this port object (available in a jar file) usable by multiple Knime nodes.

So far i know each knime plugin project needs its own lib folder with jars packaged, having multiple copies of the same jar in multiple projects would leat to nodes that don't recognize that they use the same type of port object. Is there any way to share a jar file containing a custom port object to multiple Knime plugin projects ?

Sure, just make that jar a bundle/eclipse plugin. After that you can simply depend on it just like any other bundle. (or export all of its packages from one of your jars, probably with the one defining the port object).

Cheers, gabor

Well that was easier than i thought, thanks yet again :D