Solutions to "Just KNIME It!" Challenge 8 - Season 3

:tophat: This week let’s wear our data engineer’s hat for our new Just KNIME It! challenge. :gear: You are reorganizing your company’s data warehouse and has a list of folders that should be created in the process. The filesystem you are using is smart, and if you ask it to create, for example, a folder2 inside a folder1 and none of them exist, it creates both in the right order without raising errors. How can you leverage this feature to reduce the list of folders you actively have to create? :eyes:

Here is the challenge. Let’s use this thread to post our solutions to it, which should be uploaded to your public KNIME Hub spaces with tag JKISeason3-8.

:sos: Need help with tags? To add tag JKISeason3-8 to your workflow, go to the description panel in KNIME Analytics Platform, click the pencil to edit it, and you will see the option for adding tags right there. :slight_smile: Let us know if you have any problems!

4 Likes

Interesting challenge - glad that this time around no dashboarding is required for a change!
Also keen to see what the simplest way to solve this is.

I went for a recursive approach where loop is stopped via variable:

8 Likes

Hello, this is my solution for this challenge.
I also used a recursive loop.
At the end, the list of folders is created.

6 Likes

Hello everyone, this is my workflow.

The no-code solution was not successful in my experiment. :sweat_smile: So, with the help of LLM and Python nodes, I got the answer.

7 Likes

Hi all,
This is a no-code solution consisting of only 10 nodes.

11 Likes

Here’s my solution:

4 Likes


Added a folder tree view - Ask K-AI in generic ECharts deserves all the credit for that!

8 Likes

Kudos to you. Ingenious!

5 Likes

Hi, Guys!!
Here’s my solution :

cheers

4 Likes

Hi all,
Here is my solution.

I got inspiration from @sryu 's solution, making solution that has only 3 nodes!!:slight_smile:
Very exiting challenge!!

14 Likes

@Tofusa
Wonderful!
It’s impossible to think of a simpler no-code solution than this.

6 Likes

Here’s my solution. I wanted to see if there was a way to avoid using loops. No particular good reason; just curiosity.

4 Likes

Congrats. You win the prize!

6 Likes

Hello everyone,
I am impressed with @Tofusa 's workflow! I only changed the part of his workflow where he gets the parent folders. I used Regex Split instead of String Manipulation.
image

7 Likes

Hi all,
Here is my solution.

My workflow is similar to @Tofusa 's solution.
I learned from his solution that the GroupBy process (to remove duplicated column) is not needed.
Congrats!!

4 Likes

Hi all,
Here is my second solution.
I was inspired by @Tofusa and @tark to consider other possibilities.

5 Likes

Wow, what compact solutions… Very inspiring to see. While mine might not be the most compact, I’m happy to contribute:

The logic:

  • Split the hierarchical folders into different columns
  • Flag the duplicates without the last column
  • Assess which duplicates should we keep
  • Go one “column” back (in a recursive way, with just the rows that are not filtered)
  • Stop the recursive loop where we are at the root folder
4 Likes

my submission -JKI-S3C8 – KNIME Community Hub

4 Likes

Hello JKIers,
Wow! Very amazing and efficient solutions. I just went straight away to test my first idea, based in ‘Recursive Loop’ plus regexMatcher(). And it worked :upside_down_face:

BR

4 Likes

Thank you @alinebessa for this simple yet interesting challenge. I’m hoping I understood the problem right. My solution is slightly convoluted but has some decent logic that also provides some intermediate statistics. You can find my solution here

  1. Initially creates a collection column of the hierarchy and counts the elements in each set.
  2. For each set, determines if it’s a possible subset by comparing it to the deepest file path.
  3. For possible subsets, uses a variable loop to match for sets and counts the number of occurrences (excluding perfect matches to itself).
  4. Filters out subsets from initial file and writes a new table.

Please do let me know if any feedback!

3 Likes