I have just done a “reverse” test, using the principles I outlined in this post
I started by using my app to apply Animal|Mammal|Bear
from the known hierarchy Animal|Mammal|Bear|Black Bear

Now, my app assumes that all levels above a selected node will automatically be included, so I get an XMP that looks like this…
<dc:subject>
<rdf:Bag>
<rdf:li>Animal</rdf:li>
<rdf:li>Mammal</rdf:li>
<rdf:li>Bear</rdf:li>
</rdf:Bag>
</dc:subject>
…
<lr:hierarchicalSubject>
<rdf:Bag>
<rdf:li>Animal</rdf:li>
<rdf:li>Animal|Mammal</rdf:li>
<rdf:li>Animal|Mammal|Bear</rdf:li>
</rdf:Bag>
</lr:hierarchicalSubject>
… which PL5 then reads like this…

Perfect!
If I then manually edit the XMP file to remove Mammal
from the hierarchy…
<dc:subject>
<rdf:Bag>
<rdf:li>Animal</rdf:li>
<rdf:li>Mammal</rdf:li>
<rdf:li>Bear</rdf:li>
</rdf:Bag>
</dc:subject>
…
<lr:hierarchicalSubject>
<rdf:Bag>
<rdf:li>Animal</rdf:li>
<rdf:li>Animal|Mammal|Bear</rdf:li>
</rdf:Bag>
</lr:hierarchicalSubject>
… PL5 shows the “out of sync” icon and, upon refreshing, then shows…

This also seems to be as expected.
If I then go back to my app and re-read the file, I get…

… which makes me a very happy bunny, because my app doesn’t care about any “missing” nodes in lr:hierarchicalSubject
, as long as all nodes down to the lowest leaf are included in dc:subject
.
However, if I remove Mammal
by unchecking it in PL5, this then re-writes the XMP, not only removing Animal|Mammal
form lr:hierarchicalSubject
, which is perfectly fine to do, but it also removes Mammal
from dc:subject
…
<dc:subject>
<rdf:Bag>
<rdf:li>Animal</rdf:li>
<rdf:li>Bear</rdf:li>
</rdf:Bag>
</dc:subject>
…
<lr:hierarchicalSubject>
<rdf:Bag>
<rdf:li>Animal</rdf:li>
<rdf:li>Animal|Mammal|Bear</rdf:li>
</rdf:Bag>
</lr:hierarchicalSubject>
… which is not so fine as it breaks the ability to search in other apps like mine and macOS Finder.
In my opinion, this test proves that the only thing that needs to change in how PL5 writes hierarchies is that dc:subject
must contain all keywords mentioned in lr:hierarchicalSubject
.
Unless someone (Bryan @BHAYT @Musashi) or others can prove I have got it wrong, I believe that DxO uses the lr:hierarchicalSubject
tag to determine which keywords to “select” in their keywords display and that this is sufficient for compatibility with other software but…………
… only as long as dc:subject
contains all keywords mentioned. i.e. as in PL5.1.3/4
I have even tried removing any DOP and XMP sidecars to force reading from the database and, so far, haven’t found any need to mark keywords as “applied”. It would seem that DxO’s use of lr:hierarchicalSubject
to list only those “hierarchies” that are checked is sufficient.
As a final double check, I manually added Mammal
back in to the dc:subject
only and it didn’t affect what PL5 displayed in either the keywords field or the tree view.