How to compare two collection

Hi,

Is there a way to quickly compare two set of collections/lists? I am trying to run a comparaison between an initial input of tags combination, and a second set of tags generated through an auditing process.

Ideally, the output would be in the form of two columns (Tag added | Tag removed)

I have attached a sample data set for your reference.

Thanks

Julien 

 

 

Dear Julien,

what would be the output of your example flow?

I am thinking about the two nodes Set Operator and Subset Matcher. But I am unsure what the output should be.

Best, Iris

Hi Iris,

Thanks for mentioning these two nodes. They look very promising, but maybe not for the issue at hand. Basically the output I am trying to create is two additional columns, one for the removed tags and one for the added tags:

List 1                                      List 2                                      Tag added                          Tag removed

[A, B, C, D]                          [A, B, D]                                                                               C

[B, C]                                     [A, B]                                     C                                           A

[A, C, D]                               [C, D]                                                                                    A

[A]                                          [B, C]                                     B, C                                       A

[C, D]                                     [C, D]

Many thanks for your help

Julien

 

Hi Julien,

this helped a lot :-)

Use the Column Aggregator. First calculate the exclusive or from list and list 2 = XOR12

Than calculate tag added = List 2 XOR XOR12

and tag removed would be = List1 XOR XOR12

Hence you will need 3 column aggregators and inbetween two column rename nodes, as the column aggregator  always produces the same column name for the same aggregation type.

Best, Iris

Hi Iris,

Okay, I've managed to calculate the "exclusive or" from list and list 2. However I can't seem to manage to calculate the tag added and tag removed. I've tried with the "exclusive or" function as well as few others but none have worked.

If I understand correctly, the "exclusive or" function combine all the options from both list. So it is a sort of concatenate function isn't it? But I don't see how I can use the same "exclusive or" to calculate the delta between a) list and XOR12 and b) list 2 and XOR12.

Thanks for your help

Julien

 

 

Can you post me your workflow?

Best, Iris

Hi Iris,

Please find attached

Thanks

J

 

Dear Julien,

I am sorry this is a small bug we will fixed with 12.1.. I work with our nightly built and so I didn't had this problem. Currently the exclusive or works like a default or.

If this problem is urgent I can only refer to the Java Snippet node. With it you can also work on our set cells. See as in the attached workflow.

Best, Iris

Dear Iris,

Thank you so much for this. No, this not an urgent problem so I'll wait till the next update.

RE the Java Snippet node, I have so far tried to stir clear from them because I have a hard time understanding how the coding works. Is there some tutorial or training material you would suggest, bearing in mind I am a novice when it comes to coding.

Thanks

Julien 

 

 

Dear Julien,

the next update will be next week.

About the java snippet node, no there is no further documentation. Basically any Java documentation can be used. But this is of course overkill.

Best, Iris

Hi Iris,

i have knime version 2.12.0, and XOR doesn´t work for me.

    [1097,1270,2011]   XOR [1270,2011] = [1097,1270,2011]

i think this is an OR operation, not XOR.

The column types are "SetCell (Collection of: StringCell).

Any problem with this operation?

Thanks

Jose

 

Dear Jose,

this is a Bug we have in KNIME 2.12.0 which will be resolved with 2.12.1

I will comment here as soon as it is published.

Best, iris

Dear Iris,

i thought it was resolved in last update, i didn´t read properly the version. i will wait for the new one.

thank you.

Best, Jose

Hi Everyone,

we just published 2.12.1 and fixed the XOR bug.

Best, Iris