Skip to main content
Known Participant
September 23, 2018
Question

dc:subject and lr:hierarchicalSubject keywords out of Synch

  • September 23, 2018
  • 1 reply
  • 1831 views

Hi, I'm hoping someone can suggest a way of fixing a keywording problem that I've run into.

I'm not an expert in this, but I have been using Photoshop and Bridge for several years, and with the help of these forums I'm starting to develop some basic scripting skills - very basic, to be honest.

My problem is that I have a LOT of files, and I have found many for which the abovementioned sets of keywords are inconsistent.  dc:subject is usually correct, but lr:hierarchicalSubject contains keywords I thought I had deleted from my images, and they are no longer in my keyword list.  I've included an example extracted from one of my files below.

I've searched the forums and I'm aware of the discussion at XMP Hierarchical Subject (lr:hierarchicalSubject)  which is the closest match I've found so far.  Unfortunately my scripting skills unequal to the script from SuperMerlin in this thread.  I'm happy to try modifying that script, but I'm likely to need all the help anyone is able to offer.

The ideal solution to my problem would be some sort of bulk editing.  I know it will take time, but I don't see a realistic alternative.  I have many cases in which the keywords metadata should be the same for a group of files.  That suggests using a Bridge Metadata Template to fix the problem, but that has not worked in the past because it does not seem to correct the corrupted lr:hierarchicalSubject keywords.  Perhaps I'm not doing it properly.  I do use a template to apply keywords, and that seems to work reliably.

The bold red items in the lr:hierarchicalSubject section of the metadata are relics from ancient times, and should not be in the metadata at all.  This is just one example; I've found other keywords that are incorrect in the sense illustrated here.  The offending keywords were, at one time or another, in my keyword list, but are no longer there because I deleted them.  I often create a new document by modifying an existing one, so when the new document is first saved, it has the keywords from the source document; at that point I'm supposed to fix the keywords in the new document, and I usually do, but obviously something has gone wrong.

Thanks in advance for any suggestions.

Here's an example I extracted from one of my files:

         <dc:subject>

            <rdf:Bag>

               <rdf:li>Web Gallery</rdf:li>

               <rdf:li>Seamless Repeating Patterns</rdf:li>

               <rdf:li>symmetrical coloring</rdf:li>

               <rdf:li>textured</rdf:li>

               <rdf:li>sculpted</rdf:li>

               <rdf:li>pearlescent</rdf:li>

               <rdf:li>opalescent</rdf:li>

               <rdf:li>tesselated</rdf:li>

               <rdf:li>tip to tip</rdf:li>

               <rdf:li>Tiled Pattern Master File</rdf:li>

               <rdf:li>Tiled Pattern Master File Universal Scale</rdf:li>

               <rdf:li>DS40402</rdf:li>

               <rdf:li>R015-01 Layout</rdf:li>

               <rdf:li>R015 Flowers</rdf:li>

               <rdf:li>R015-01 Flower C2 DS40402</rdf:li>

               <rdf:li>Flower C3</rdf:li>

               <rdf:li>Flower</rdf:li>

               <rdf:li>Flowers</rdf:li>

               <rdf:li>Flower C3 DS40402</rdf:li>

               <rdf:li>Delicate</rdf:li>

               <rdf:li>Flower Petal C3</rdf:li>

               <rdf:li>Flower Petal</rdf:li>

               <rdf:li>Flower Petals</rdf:li>

               <rdf:li>Flower Petal C3 DS40402</rdf:li>

               <rdf:li>Case YYYYYY</rdf:li>

               <rdf:li>Standardised Naming Convention</rdf:li>

            </rdf:Bag>

         </dc:subject>

         <lr:hierarchicalSubject>

            <rdf:Bag>

               <rdf:li>Repeating Patterns|R004 Swirl S3 DS40402</rdf:li>

               <rdf:li>Internal Keywords|Online Outlets|Web Gallery</rdf:li>

             <rdf:li>Seamless Repeating Patterns|R004 Swirl Patterns|R004-02 Layout|R004-02 Swirl S2 DS40402</rdf:li>

               <rdf:li>Seamless Repeating Patterns</rdf:li>

               <rdf:li>Seamless Repeating Patterns|R004 Swirl Patterns|R004-02 Layout</rdf:li>

               <rdf:li>Creations and their Characteristics|Appearance|symmetrical coloring</rdf:li>

               <rdf:li>Creations and their Characteristics|Appearance|textured</rdf:li>

               <rdf:li>Creations and their Characteristics|Appearance|sculpted</rdf:li>

               <rdf:li>Creations and their Characteristics|Appearance|pearlescent</rdf:li>

               <rdf:li>Creations and their Characteristics|Appearance|opalescent</rdf:li>

               <rdf:li>Seamless Repeating Patterns|Pattern Element Relationships|tesselated</rdf:li>

               <rdf:li>Seamless Repeating Patterns|Pattern Element Relationships|tesselated|tip to tip</rdf:li>

               <rdf:li>Seamless Repeating Patterns|Pattern File Type|Tiled Patterns|Tiled Pattern Master File</rdf:li>

               <rdf:li>Seamless Repeating Patterns|Pattern File Type|Tiled Patterns|Tiled Pattern Master File|Tiled Pattern Master File Universal Scale</rdf:li>

               <rdf:li>Creations and their Characteristics|Sources and Derivatives|DS40402</rdf:li>

               <rdf:li>Seamless Repeating Patterns|R015 Flowers|R015-01 Layout</rdf:li>

               <rdf:li>Seamless Repeating Patterns|R015 Flowers</rdf:li>

               <rdf:li>Seamless Repeating Patterns|R015 Flowers|R015-01 Layout|R015-01 Flower C2 DS40402</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flowers|Flower|Flower C3</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flowers|Flower</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flowers</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flowers|Flower|Flower C3|Flower C3 DS40402</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flowers|Flower|a. Flower Characteristics|Delicate</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flower Elements|Flower Petals|Flower Petal|Flower Petal C3</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flower Elements|Flower Petals|Flower Petal</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flower Elements|Flower Petals</rdf:li>

               <rdf:li>Creations and their Characteristics|Digital Creations|Floral Shapes|Flower Elements|Flower Petals|Flower Petal|Flower Petal C3|Flower Petal C3 DS40402</rdf:li>

               <rdf:li>Internal Keywords|Rights Management|Copyright Registration Management|Copyright Registration Collections|Copyright Registration Collection Next|Case YYYYYY</rdf:li>

               <rdf:li>Seamless Repeating Patterns|a. Naming Convention|Standardised Naming Convention</rdf:li>

            </rdf:Bag>

         </lr:hierarchicalSubject>

Message was edited by: Lionel Drew Corrected coloring of hierarchicalSubject text

This topic has been closed for replies.

1 reply

Stephen Marsh
Community Expert
Community Expert
September 24, 2018
Known Participant
September 24, 2018

Thanks for your response, Stephen.

I read the discussion you referenced.  I don't see a solution there, but I'm willing to bet that people posting to that discussion have this problem too.

Here's some more information:

  1. I have been aware for some time that there's a demon lurking in my keywords, but this is the first time I've been able to isolate the problem.
  2. It seems to me that in the course of changing keywords to make them more useful and informative, some images ended up with dc:Subject and lr:hierarchicalSubject containing inconsistent information as illustrated above.
  3. When this happens, hierarchicalSubject contains hierarchical keywords that do not display in any Bridge panel.
  4. The problem is that if you add a keyword that is a partial match to one of the phantom hierarchicalSubject keywords, Bridge will add a new transient keyword to the Keywords Panel.  This is the first indication I got that something was wrong.
  5. As far as I can tell, the only way to change the content of hierarchicalSubject is indirectly; deleting all the keywords in dc:Subject leaves hierarchicalSubject untouched, and it doesn't seem to matter how the deletion is done (i.e., via Metadata Panel, Keywords panel or script), hierarchicalSubject survives all the assassination attempts.  It lurks, and pounces when you introduce a keyword that triggers some sort of match.
  6. As far as I can tell, the only "official" mechanism for managing the content of hierarchicalSubject are indirect, by changes to dc:Subject.  You can see what hierarchicalSubject contains via File Info, but there's no way to change it directly.

I have been able to fix some files by examining hierarchicalSubject closely, adding the correct hierarchical keyword in the Keywords panel, and then clicking it to add the keyword to the image.  If you do this correctly, you can delete the keyword you just added, and that will remove it from hierarchicalSubject too.  However, this approach is not practical for me as I have thousands of files.  What I have noticed is that there seems to be a small number of distinct phantom keywords that have been propagated to lots of files.  A script that uses a list of offenders to remove them from hierarchicalSubject would be a practical solution, but that's way beyond my scripting ability.

Another approach I've considered is to recreate corrupted files as follows: open the file in Photoshop, drag all the layers into a new document and save it.  The new file loses all the metadata of the old one, but if your first step is to create a metadata template from the sick file, you can apply it to the new one.  It might even be possible to automate this process, but there's a catch: I don't know of a way of copying Layer Comps from the sick file to the new one, and that's a big problem for me as I have a collection of art files that make extensive use of Layer Comps.

UPDATE:  I've just tried recreating a file as described immediately above.  Immediately the file is saved, the metadata does not contain either dc:Subject or lr:hierarchicalSubject.  I saved to a copy, then grabbed metadata from the original file (using Bridge "Create Metadata Template") and injected it into the new file using Bridge "Replace Metadata".  This creates the dc:Subject field, but not lr:hierarchicalSubject.  I guess 1) Bridge needs the hierarchical keys to build lr:hierarchicalSubject, and 2) that info is not in the metadata template.  So, if I want hierarchicalSubject, the only way I see to get it is to click all the relevant keywords in the Keyword Panel.  Quite the mess.  Time to think about this very carefully.

I also found this discussion dc:subject, lr:hierarchicalSubject + Adobe Bridge  and I noticed that right at the end of it the OP says "I've created a Script for Bridge to fill lr:heriarchicalSubject on my own by looking up the values form dc:subject in my keyword hierarchy in Bridge."  A script like that would probably be very helpful to lots of CC users.

Stephen Marsh
Community Expert
Community Expert
September 24, 2018

Hi Lionel, heriarchical keywords are complex to work with compared to flat keywords. I am confident using ExifTool, however when it comes to wrangling heriarchical keyword structures I know next to nothing.

If you think that the issue is with the automatically added lr:hierarchicalSubject keywords, a possible solution is a brute force approach, removing them using ExifTool or a Bridge script, leaving the legacy IPTC:Keywords and DC:Subject keywords in place. I am guessing that if you then uncheck and recheck the required keywords in the keyword panel (ensuring your Bridge prefs are correct for writing keywords), then the structure will be correctly applied to all three tags (IPTC:Keywords, DC:Subject & lr:hierarchicalSubject). This semi automated approach may give you the best chance of sorting these with the control you need. I’d make use of the Keywords Filter panel to help select ranges of like images.