• Welcome to the Lightroom Queen Forums! We're a friendly bunch, so please feel free to register and join in the conversation. If you're not familiar with forums, you'll find step by step instructions on how to post your first thread under Help at the bottom of the page. You're also welcome to download our free Lightroom Quick Start eBooks and explore our other FAQ resources.
  • Stop struggling with Lightroom! There's no need to spend hours hunting for the answers to your Lightroom 6 questions. All the information you need is in Adobe Lightroom 6 - The Missing FAQ!

    To help you get started, there's a series of easy tutorials to guide you through a simple workflow. As you grow in confidence, the book switches to a conversational FAQ format, so you can quickly find answers to advanced questions. When you upgrade to subscription, there's also a Lightroom Classic version available.

Hierarchical keywording

rob211

Senior Member
Joined
Mar 17, 2014
Messages
1,115
Location
Walnut Creek, CA USA
Lightroom Experience
Advanced
Lightroom Version
I haven't been able to find a lot of info on this, so please verify if I'm on the right track. (Note, BTW, when I use ">" below I'm using it like LR does to display a hierarchy, while the "|" is an actual character.)

When Lightroom saves hierarchical keywording to an image it writes a list of all the words in the hierarchy to the IPTC keywords field. It also writes the hierarchy to "Hierarchical Subject" in XMP-lr. So keywords "animal>mammal>fox" in our LR keyword list would, in say a jpg, be IPTC keywords: "animal, fox, mammal" and in Hierarchical Subject: "animal|mammal|fox."

When LR imports keywords, it will structure them in an existing hierarchy if the keywords match. So, if I already have "animal>mammal>fox", and I import a new jpg (or load its metadata) that already has keyword: "fox," it will show up as "animal>mammal>fox" in my keyword list, and per the rule above, once I save it, it will ADD the two keywords "animal, mammal" to the jpg, and add to the jpg the Hierarchical Subject: "animal|mammal|fox."

So, by adding non-hierarchical keywords to jpg outside LR, and then processing them in LR (reading metadata; writing metadata) I can essentially convert a keyword into a hierarchical keyword; in my example just "fox" becomes a mammalian animal named fox, and now the jpg has the IPTC keywords "animal, fox, mammal" too. That's nice.

But what if I didn't already have "animal>mammal>fox" in my LR hiearchy? Indeed, if I had none of those words? If I import jpg with "fox" I get just "fox" and I'd have to create the hierarchy in LR by adding "animal" and "mammal." When I'm outside LR, I wanna create the hierarchy, but if I just add the new hierarchy by attempting "plant, vegetable, radish" I don't get anything but those three keywords in LR singly, flat. And I don't have any other program that could write to the Hierarchical Subject field.

But I found that if, with the new jpg, that if I want LR to import a new hierarchy I can put "plant|vegetable|radish" in the IPTC Keywords field and then LR will create a ""plant>vegetable>radish" hierarchy. The "plant|vegetable|radish" terms stay in the jpg IPTC keywords but as soon as LR does a "save" to the metadata those get transformed to "plant, radish, vegetable" in the IPTC keywords, and now "plant|vegetable|radish" is in the XMP-lr Hierarchical Subject field, and all is well.

I like to verify that I'm not missing something here, because I don't wanna mess up a ton of existing hierarchies by importing metadata that has keywords in the IPTC keyword field with the pipe "|" character and with both new and existing hierarchies in the xmp and jpg files themselves.

Thanks,
Rob
 
Joined
Jun 24, 2010
Messages
1,678
Location
Encinitas, CA USA
Lightroom Experience
Advanced
Lightroom Version
Classic
Hi Rob,

Yes you are on the right track. There are a couple of things to keep in mind that will help you keep things straight. First, internally Lightroom uses a hierarchal keyword structure as the source for all keywords even if it is a single bare keyword with no associated hierarchy. It then populates the IPTC keywords field in the manner you describe and keeps them in sync as you add or change keywords on an image. So internally the IPTC keywords field is always populated from the hierarchal tables. The lr:hierarchicalSubject field will always reflect the current contents of the internal keyword tables as of the last time you saved the metadata to disk.

On import Lightroom uses the IPTC keywords in the image file to look up against this internal structure and match the input terms as close as it can. It will try to match single bare keywords to any existing hierarchy with the identical leaf term. If does not find a match it will add the bare keyword to the internal tables. In the case where there is more than one possible match it I believe Lightroom punts and also just adds a single bare keyword because it cannot determine which of the available options is correct.

As you note this also works if the input image file has an element in the keywords field that Lightroom understands to be complete or partial hierarchy. This is any string with a special character defined by Lightroom as a hierarchy delimiter. The default is the pipe "|" character. Lightroom will attempt to match this input string with the internal table. If it finds a partial or complete match it will then assign the full hierarchy of the matched element to the imported image.

Something else to keep in mind is that internally a keyword is the complete hierarchical string of related elements. In your example for radish above the imported image only has one keyword that contains all the included terms. If in the Keywords List you also check vegetable and plant then the result reflected in the lr:hierarchicalSubject metadata will be three entries. Practically speaking this is identical to the single check on radish. However, this can cause some confusion when looking at the counts of keywords in the Keywords List as what is counted is only the checked elements and not the implied elements.

-louie
 

rob211

Senior Member
Joined
Mar 17, 2014
Messages
1,115
Location
Walnut Creek, CA USA
Lightroom Experience
Advanced
Lightroom Version
Great; that really helps.

Now if I can get this semi-automated I'm in business.
 
Top