How to migrate categories to @Keywords with a metadata template

Started by Ferdinand, September 20, 2014, 02:48:21 PM

Previous topic - Next topic


I have done a little work on this, but I haven't ever done this in a full production run, so I suggest that you test this before you use it on all your files.

First, a preliminary comment.  I'm not advocating migrating all your categories to keywords, only those that you want embedded in your files.  So I migrated things like "Who" and "Where", but not categories which indicated workflow, sales, version type, etc.  I haven't even migrated "What" because it's in a state of flux and prone to reorganisation, which gets hard once the hierarchy is embedded in the files.  My advice is to be selective and give some thought to what categories it makes sense to migrate to @keywords and so embed in your files.


If you want to write the Where category branch to keywords then you could use the following metadata template:

In XMP::Lightroom\HierarchicalSubject write {File.Categories.Direct|Filter:Where}

You will need one such template for each keyword branch that you want to write to @Keywords.  You could remove the filter parameter and write all your categories to @Keywords but think very carefully before you do this.

From IMatch 5.2.6, you don't need to specify in your metadata template what to write to flat keywords (XMP:Subject and IPTC:Keywords).  IMatch will do this automatically based on your metadata preferences.  So it's best to understand these and have them configured how you want them before you embark on the large-scale application of a metadata template like this.

For example, if you only want the leaf node ("Montmartre" from "France|Paris|Montmartre") in flat keywords, then you will need to have the following options unchecked in metadata preferences:  (i) Write hierarchical keywords (ii) Write path elements.


It is not uncommon for people who use categories like "Where" to want to mark this top node as Group.  So that if you have the category "Where|France|Paris|Montmartre" as a category then only "France|Paris|Montmartre" is written as a keyword, although the thesaurus shows "Where|France|Paris|Montmartre".  So "Where" is just an organisational convenience in the thesaurus.  It won't even show in @Keywords.  The template to do this is:

In XMP::Lightroom\HierarchicalSubject write {File.Categories.Direct|Filter:Where;replace:Where|==}

If you do this, then before you run the template you would be well advised to export this category branch using the export function, import it into the thesaurus and mark "
Where" as a Group node.  If you don't do this then IMatch won't recognise what has happened and may well want to start setting a whole series of write-backs after you have applied the metadata template.


There is also the option to mark "Where" as an Excluded node, instead of Group.  (If you do this then almost certainly you're writing more than just the leaf node (e.g. "Montmartre") into flat keywords.)  From my experiments it's going to be hard to give a general template to use in this case.  What I would do is first export the category branches you're migrating to an external file and import then into the thesarus, mark the nodes that you want excluded as Exclude, then run just this line as a metadata template:

In XMP::Lightroom\HierarchicalSubject write {File.Categories.Direct|Filter:Where}

and then let IMatch write out the matching keywords in a second round write-back.


If you've got one of the more complex cases, e.g. Exclude, and you want to avoid multiple rounds of write-backs, you can use my cats to keywords script.  Mario will say that it isn't needed, you can use metadata templates in IMatch 5, and while that's correct, it can make life slightly easier in certain instances.  But it takes some planning to use effectively.

[attachment deleted by admin]