4 Replies Latest reply on Mar 26, 2012 2:34 AM by gcoupe

    LR4 - Hierarchical Keyword Metadata Writing Problem


      Having found a problem with LR4 in reading hierarchical metadata from photo files, I now seem to have found a similar problem when writing metadata to files.


      As before, I use hierarchical keywords with the "/" character as the separator in the photo files metadata.


      Let's say I assign the keyword "Christmas" to a photo. This actually has the hierarchy "Events/holidays/Christmas"


      When I write out the metadata to the photo, I want, and expect, the hierarchical keyword string to be written: Events/holidays/Christmas.


      Instead, what I get are three separate keywords written out separated by commas: Events,holidays,Christmas.


      This is pointless - LR4 has just destroyed my keyword hierarchy and just given me a flat list of keywords.


      Is this a bug, or is this indeed expected behaviour of LR4? Because if it's the latter, then LR4 is not going to work for me as a metadata editor.



        • 1. Re: LR4 - Hierarchical Keyword Metadata Writing Problem
          johnrellis Most Valuable Participant

          That's the expected behavior of LR 3 and 4.   Some background:


          There is no widely accepted industry standard yet for handling hiearchical keywords.  (The Metadata Working Group has defined a standard, but I don't know of any application that has implemented it yet.)


          LR stores hierarchical keywords in the XMP:HierarchicalSubject metadata field (a non-standard field recognized by LR and Bridge), with the elements of the hierarchy separated by "|", e.g. Events|Holidays|Christmas.   In the industry-standard field XMP:Subject, LR only stores non-hierarchical keywords.  You can control whether the containing keywords (e.g. Events and Holidays) are also stored in the XMP:Subject field with the keyword options Export Containing Keywords and Include On Export.


          Other non-standard approaches store hierarchical keywords in the XMP:Subject field, with the elements separated by "|", ".", or "/".  For compatability, LR will recognize those hierarchical keywords when it reads metadata, controlled by the options in Preferences > File Handling.  But LR always writes out its hierarchical keywords using its own non-standard approach.


          Perhaps in a few years, the industry will have converged on a standard and implemented it.

          1 person found this helpful
          • 2. Re: LR4 - Hierarchical Keyword Metadata Writing Problem
            gcoupe Level 1

            Thanks John for the explanation. Very helpful, but it does confirm to me that I will not be able to use LR4 to handle my metadata.


            Windows Live Photo Gallery is one of those applications that uses the "/" separator in the XMP:Subject field. Since that is an easy to use application for other family members, I would prefer to stick to using the "/" separator method. My main DAM application at the moment is IDimager, which is flexible enough to handle a variety of methods for hierarchical keywords, both reading and writing.


            Since LR4 only handles reading, it's a one way street, and one that I don't care to go down.


            Thanks again.

            • 3. Re: LR4 - Hierarchical Keyword Metadata Writing Problem

              Not that it's as good as Lightroom natively supporting writing out the hierarchy with the desired separator character, which I agree would be a good thing, but this is fixable with EXIFTool. Here's an EXIFTool config file:


              %Image::ExifTool::UserDefined = (
                         'Image::ExifTool::XMP::xmp' => {
                                   HierarchicalSubject => {
                                             Require => 'HierarchicalSubject',
                                             ValueConvInv => '$val =~ s#\|#/#g; $val',


              You'd save this somewhere, say C:\exiftool.conf, then run EXIFTool as follows (I'm assuming you're on Windows here):


              exiftool.exe -config C:\exiftool.conf "-Subject<HierarchicalSubject" C:\your\picture\here.jpg


              This command will overwrite the XMP "Subject" field with a copy of the "HierarchicalSubject" that has all the "|" characters replaced with "/". You could put this in a batch file if you like, and/or substitute a wildcard like *.jpg for a specific file if you want to modify all the files in a directory.

              1 person found this helpful
              • 4. Re: LR4 - Hierarchical Keyword Metadata Writing Problem
                gcoupe Level 1

                Thanks very much for the tip - Exiftool to the rescue yet again!