Skip to main content

Hey FME'ers,

It's been a while since we had an online challenge, so I thought I would throw out something to test you - especially now that we have FME home licenses available!

If you remember, in a previous challenge I gave some names (Alf, Max, Ben, Ann, etc) and challenged you to find the transformer that they represented. The solution is that Alf is the SpatialFilter (because it is the only transformer containing that name), Max is the RasterBandMinMaxExtractor, and so on.

Type Alf into the FME Workbench Quick Add to prove it:

See? There can be only one!

Well, today I was helping out on transformer documentation and wondered how many transformers in FME could be identified by a unique three-letter string in Quick Add. Not necessarily names, but any three-letter string; for example the Clipper could be "CLI" and the AttributeFileWriter could be AFW (because the search dialog allows Camel-Case entries).

But you can't have "EME" for the ListElementCounter, because it clashes with the FeatureMerger.

Challenge

You can probably guess where this is going...

of 480 transformers that I extracted from FME2017. The challenge is to scan that list and generate as many unique three-letter codes as you can.

Obviously I don't want you to just use your eyes, or spend hours typing combinations into Workbench to see what works. No, I want you to use FME. The challenge is to create a workspace that generates as many combinations as possible.

I don't think it's going to be as hard as I thought at first, but we'll see. I thought there would need to be iteration, but now I'm not so sure.

The winner will be the person who identifies the most unique codes. If you get the full 480 (I seriously doubt it) I'll push for the docs team to add them into the FME documentation, since that might be quite useful.

In the event of a tie I'll make a decision (or ask someone neutral at Safe to). You could try to impress me/us by calculating four-letter codes, five-letter codes, six-letter, etc. In fact, perhaps you could figure out the minimum number of letters to create a full set of unique codes? Or generate a set of mixed 3/4-letter codes? Once you have the basics done, I think these variations should be easy.

Some Rules:

I can only think of one rule: No Python. Or Tcl. Or any other scripting. Just pure FME transformers (you know what I mean). I think I will allow regular expressions... provided you don't just write one very, very long expression to do the whole thing.

Oh, actually, the second rule is just to use the attached list. Don't worry about hub transformers or formats that might come up if you type that string. And this list is the official one, even if I might have included a transformer that is now deprecated or missed a new one.

Prizes:

Knowledge centre reputation for sure. Probably a unique knowledge centre badge. And possibly some FME-branded swag, if I can persuade the marketing team to hand some over.

And obviously you win the admiration of your fellow FME users, which is not to be treated lightly.

So, go for it! You can post your solutions here (others should not cheat by peeking) and be sure to mention the number of unique strings you have identified.

And apologies in advance in case this challenge makes your entire office grind to a halt, or delays a family vacation, because you're all so busy trying to do it!

Regards

Mark

An experiment for XML lovers :-) This workspace extracts required transformer names and 3-letter codes from the transformers list (txt) using XQuery expressions, and then outputs the result as an HTML table.

lUpdated] unique-3-letter-code-to-html-3.fmwt (FME 2017.0)

0684Q00000ArL3lQAF.png

0684Q00000ArL5TQAV.png

You can specify the number of characters per a code via a published user parameter named N.

(: XMLTemplater ROOT Template Expression :)let $s := <s>{fme:process-features("SUB")}</s>let $t := <t>{    for $code in fn:distinct-values({for $x in $s/xformer return $x/@code})    let $names := {for $x in $s/xformeri@code=$code] return $x/@name}    where fn:count($names) eq 1    return <xformer name="{$names 1]}" code="{$code}" />}</t>return <table>    <thead>        <th>No.</th><th>Transformer</th><th>Unique $(N)-Letter Codes</th><th>Count</th>    </thead>    <tbody>{        for $name at $i in fn:distinct-values({for $x in $t/xformer return $x/@name})        let $codes := {for $x in $t/xformer @name=$name] return $x/@code}        return <tr>            <td>{$i}</td>            <td>{$name}</td>            <td>{fn:string-join($codes, ",")}</td>            <td>{fn:count($codes)}</td>        </tr>        }        <tr>            <td/>            <td/>            <td>Total Number of Unique $(N)-Letter Codes</td>            <td>{fn:count($t/xformer)}</td>        </tr>    </tbody></table>
(: XMLTemplater SUB Template Expression :)let $n := $(N)for $code in fn:distinct-values({    let $src := fn:upper-case(fme:get-attribute("text_line_data"))    for $i in (1 to fn:string-length($src) - $n + 1)    return fn:substring($src, $i, $n),    let $src := fn:replace(fme:get-attribute("text_line_data"), "La-z]", "")    for $i in (1 to fn:string-length($src) - $n + 1)    return fn:substring($src, $i, $n)})return <xformer name="{fme:get-attribute("text_line_data")}" code="{$code}"/>

I created a custom transformer to do that: [2017-07-08 Update: Please see the latest comment]

I updated the custom transformers so that digits [0-9] will be considered as Camel-Case characters.

 

If you have installed the previous custom transformers (ThreeLetterEnumerator, NLetterEntryEnumerator), once delete them from Transformer Gallery, then open this template that contains new implementations.

 

fme-challenge-transformer-naming-part-ii.fmwt

 


I am in awe of all of you. Very very impressive.


If you allow numbers and also the AutodeskA360Connector trick: 743 codes for 316 unique transformers

challenge3chars.fmwt

Without the AutodeskA360Connector trick :738 codes for 316 unique transformers

challenge3charsii.fmwt

If it's only allowed to have letters: 720 codes for 309 unique transformers

challengeonlyletters.fmwt

All workspaces contain 10 transformers.


So a late Saturday evening revision because I just couldn't let it go! I re-read some of the comments and realised I wasn't accounting for numeric values in the unique values. But I had read the following:

 

 

"The challenge is to scan that list and generate as many unique three-letter codes as you can."

 

 

Letters not number otherwise it might have said characters ;)

So my revised new total is 735 unique values containing a mix of numbers and letters, for 316 Transformers @Mark2AtSafe

Good point. I guess I wasn't thinking about numbers when I wrote the challenge. But yes, it should say unique characters.

 


This is awesome work everyone. I will check out the results and award prizes when I'm back from vacation in a couple of weeks.

 

 


Looks like no one has suggested this approach to enumerate N-characters codes.

[Correction] I missed that this approach has been suggested by @egomm already.

  1. Create N copies of the source string.
  2. Remove leading (N-1) characters from Nth string.
  3. Extract every N-characters substring with the StringSearcher.

fme-challenge-transformer-naming-part-ii-2.fmwt

Something extra:


Reply