Hierarchical KW to Flat KW mapping with Thesaurus

Started by Erik, May 15, 2014, 05:34:56 AM

Previous topic - Next topic

Erik

I'm working towards setting myself up for production focusing on cleaning up all my files and making more extensive use of the thesaurus.


Question:  If I edit the thesaurus and change a keyword to be excluded from the flat keywords, is there an easy way to update a selection of images so that the flat keywords reflect the updated thesaurus? 

For instance... I have a hierarchy of what.object.knife.  I want object to be excluded, so I mark it as such.  Files that have that keyword already have object in their flat keyword.  Is there an easy way to force imatch to refresh the connection so that the flat keywords are updated and object is removed.


I tried using the metadata panel, and I can go one image at a time and select the pencil to mark the field as read, but it's less than ideal if I get to larger numbers of images.  I tried selecting all the images, but it synchronized all their keywords, which is not desirable.  Ideally, I'd like to be able to force the keywords to be marked as needing write-back for all selected images but not so that the keywords are all merged together. 

The only other thing I've been able to do is add some fake keyword to my files.  Write-it-back (which removes the excluded leaves). And finally, remove the fake keyword.  I'm not a big fan of that method, but it would work.

Mario

Question:  If I edit the thesaurus and change a keyword to be excluded from the flat keywords, is there an easy way to update a selection of images so that the flat keywords reflect the updated thesaurus? 

The thesaurus is a universal store for textual data. It stores data for headlines, captions, copyright information, and hierarchical keywords. Making a change in the thesaurus does not go out and change the metadata existing in your files.

When you want to change a keyword in many files:

Select the files
In the Keyword Panel, delete what.object.knife
Add what.knife
Save.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Erik

Quote from: Mario on May 15, 2014, 07:52:03 AM
Question:  If I edit the thesaurus and change a keyword to be excluded from the flat keywords, is there an easy way to update a selection of images so that the flat keywords reflect the updated thesaurus? 

The thesaurus is a universal store for textual data. It stores data for headlines, captions, copyright information, and hierarchical keywords. Making a change in the thesaurus does not go out and change the metadata existing in your files.

When you want to change a keyword in many files:

Select the files
In the Keyword Panel, delete what.object.knife
Add what.knife
Save.

THat's not quite what I was asking:

Hierarchical Keywords:

I have What.Object.Knife
I want to keep What.Object.Knife. 

Regular Keywords (and XMP Subject):

I have Object and Knife (separate keywords)
I changed the thesaurus so that Object is excluded (not removed).  i.e. I don't want to change the hierarchical keywords, I just want to change the mapping to flat keywords.

How do I easily refresh the metadata to reflect this change especially if there are a lot of keywords that may be affected by this.  Again I'm not changing the hierarchical keywords, I'm just changing which leaves get mapped to the flat keywords. 



Differently:

Stepping outside the thesaurus for a second, can you easily mark a metadata field as changed without merging the contents of the fields as currently occurs if you have multiple images selected and you activate the pencil to mark the fields as "edited".  This is really what I am after; the thesaurus is just a side issue.


DigPeter

Quote from: Erik on May 16, 2014, 10:43:34 PM
THat's not quite what I was asking:

Hierarchical Keywords:

I have What.Object.Knife
I want to keep What.Object.Knife. 

Regular Keywords (and XMP Subject):

I have Object and Knife (separate keywords)
I changed the thesaurus so that Object is excluded (not removed).  i.e. I don't want to change the hierarchical keywords, I just want to change the mapping to flat keywords.

How do I easily refresh the metadata to reflect this change especially if there are a lot of keywords that may be affected by this.  Again I'm not changing the hierarchical keywords, I'm just changing which leaves get mapped to the flat keywords. 

As I read, you want to retain only "knife" as a flat keyword.  You seem to be on the right lines by excluding "What" & "Object" in Thesaurus.  Have you also checked "Lookup keywords via thesaurus" in Metadata preferences?  I wonder however, doing this retrospectively,whether you might have the same problem as discussed in my thread What is really in XMP-dc-subject?, to which you have just kindly contributed.

I am not sure what you mean by the last quoted sentence.

Erik

Quote from: DigPeter on May 16, 2014, 11:33:13 PM
Quote from: Erik on May 16, 2014, 10:43:34 PM
THat's not quite what I was asking:

Hierarchical Keywords:

I have What.Object.Knife
I want to keep What.Object.Knife. 

Regular Keywords (and XMP Subject):

I have Object and Knife (separate keywords)
I changed the thesaurus so that Object is excluded (not removed).  i.e. I don't want to change the hierarchical keywords, I just want to change the mapping to flat keywords.

How do I easily refresh the metadata to reflect this change especially if there are a lot of keywords that may be affected by this.  Again I'm not changing the hierarchical keywords, I'm just changing which leaves get mapped to the flat keywords. 

As I read, you want to retain only "knife" as a flat keyword.  You seem to be on the right lines by excluding "What" & "Object" in Thesaurus.  Have you also checked "Lookup keywords via thesaurus" in Metadata preferences?  I wonder however, doing this retrospectively,whether you might have the same problem as discussed in my thread What is really in XMP-dc-subject?, to which you have just kindly contributed.

I am not sure what you mean by the last quoted sentence.


My question at the end, and problem, relates to after I have my hierarchical keywords and I want to change the mapping to flat keywords.  I think similar to your example, I have a lot of keywords that were written to the LR Hierarchy in IM3.6 that I regularly bring into test DB's in IM5.  At ingestion into IM, most of the hierarchy is converted to flat keywords and wasn't necessarily mapped using a thesaurus resulting in many flat keywords that I'd rather have excluded.

If I change the thesaurus to exclude certain portions of the keyword hierarchy, how can I refresh the actual metadata to recognize the new exclusions.  I'm not changing the hierarchy, and as a result I'm not changing the hierarchical keywords.  But, I am changing the mapping and thus I need to refresh the keywords so that the mapping can be updated and the excluded keywords removed from the flat ones.

Unfortunately, there is no quick swift way of doing this.  Clicking the pencil in the metadata panel for keywords works, but only for one image at a time.  For multiple images, my only solution has been to 1. add a dummy keyword (same) to each file 2. process the metadata write-backs, 3. remove the dummy keyword and 4. process the meta-data write-back.

That process updates the flat keywords to reflect the thesaurus, but it is a bit tedious.  It would be nice to be able to just blanket update the keywords to reflect modifications to the keyword mapping in the instance keyword leaves are marked to be excluded (or not excluded if they were).  I will likely try to file a feature request, but I was hoping that I might just be overlooking something.  I tried some of the various rescan options for metadata but they are more for what's in the files already and not to refresh the files to sync with the DB itself.


Ferdinand

This is an interesting question.  I could see myself in the same situation.

1. My natural reaction to this from my V3.6 days is to write a script, and my categories to keywords script does something like this.  You could probably use it, but it would be some work to do so, or you could write a new one.  (My script needs a little updating, so if you're going to use it then let me update it first, but I think there's a better option.)

2. But scripting for manipulating metadata is so old-fashioned in V5.  We're supposed to use metadata templates.  I *think* you could create one to do this, although it may be fairly advanced.  I haven't tried.

3. I have a hunch that the easiest way would be so select the files and delete the flat keywords.  Just find XMP:Subject somewhere in the metadata panel and clear it and do a writeback.  Then do a SHFT-CTRL-F5 and reload the metadata and that will trigger IMatch to want to write out the flat keywords, and do a writeback if that's not enabled by default.  This assumes that Metadata2 preferences and the thesaurus are setup correctly.

I haven't tried this myself, so I suggest you make duplicates of two or three files and put them in a temp folder and test this approach on duplicates.

Mario

Quote from: Erik on May 16, 2014, 11:51:01 PM
That process updates the flat keywords to reflect the thesaurus, but it is a bit tedious.  It would be nice to be able to just blanket update the keywords to reflect modifications to the keyword mapping in the instance keyword leaves are marked to be excluded (or not excluded if they were).  I will likely try to file a feature request, but I was hoping that I might just be overlooking something.  I tried some of the various rescan options for metadata but they are more for what's in the files already and not to refresh the files to sync with the DB itself.

I suggest you add a feature request.

Some command that allows a use to redo the keyword mapping from hierarchical to flat, applying the now current rules and thesaurus settings. I have this already on my list (it's not that hard to do and part of a kinda 'Keyword Tinker' feature) but some encouragement and protocol in the feature request board is always helpful.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

Correction: I tried #3 and it won't work.  The Subject (& Keywords) field is locked in the metadata panel under the usual options. 

So I used the ExifTool Command processor to clear the keywords and then did a forced rescan and a writeback and it seemed to work.
-overwrite_original_in_place
-m
-iptc:keywords=
-xmp:subject=
{Files}

But please TEST on duplicates.

DigPeter

Quote from: Mario on May 17, 2014, 01:54:21 PM
Quote from: Erik on May 16, 2014, 11:51:01 PM
That process updates the flat keywords to reflect the thesaurus, but it is a bit tedious.  It would be nice to be able to just blanket update the keywords to reflect modifications to the keyword mapping in the instance keyword leaves are marked to be excluded (or not excluded if they were).  I will likely try to file a feature request, but I was hoping that I might just be overlooking something.  I tried some of the various rescan options for metadata but they are more for what's in the files already and not to refresh the files to sync with the DB itself.

I suggest you add a feature request.

Some command that allows a use to redo the keyword mapping from hierarchical to flat, applying the now current rules and thesaurus settings. I have this already on my list (it's not that hard to do and part of a kinda 'Keyword Tinker' feature) but some encouragement and protocol in the feature request board is always helpful.
Mario - would this also take care of the problem in the tread "What is really in XMP-dc-subject?" ( https://www.photools.com/community/index.php?topic=2334.0 )?

Mario

Quote from: DigPeter on May 17, 2014, 03:48:19 PM
Mario - would this also take care of the problem in the tread "What is really in XMP-dc-subject?" ( https://www.photools.com/community/index.php?topic=2334.0 )?

This depends.
IMatch maps hierarchical to flat keywords when you change the hierarchical keywords, using the thesaurus and MD settings enabled at that time. I'm not sure what the reason for the difference in keywords where in the other thread. I explained the potential causes.

The suggested feature would he helpful if a user changes his mind and thesaurus and wants IMatch to go out and map all hierarchical keywords again to flat keywords, using the now changed settings in the thesaurus. If such is often necessary depends on your workflow.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

Quote from: Mario on May 17, 2014, 03:57:34 PM
Quote from: DigPeter on May 17, 2014, 03:48:19 PM
Mario - would this also take care of the problem in the tread "What is really in XMP-dc-subject?" ( https://www.photools.com/community/index.php?topic=2334.0 )?
IMatch maps hierarchical to flat keywords when you change the hierarchical keywords, using the thesaurus and MD settings enabled at that time. I'm not sure what the reason for the difference in keywords where in the other thread. I explained the potential causes.

I made a contribution in the other thread.  If you use the "Exclude" option, so that not all hierarchical nodes are in flat keywords, and you use LR to develop a RAW to (say) a JPG, then the exported JPG has all the flat keywords, even though the RAW didn't have them.  You can see these additional flat keywords - the ones that were excluded from the RAW - in ExifToolGUI, but IMatch doesn't show them.  Not even in the metadata panel.  And not even a forced refresh will show them.

You can follow this exact workflow and you will see this behaviour.  Just give a RAW with a hierarchical keyword, with the top one or two levels excluded, to LR to process and then compare the keywords in the developed JPG in IMatch and ExifToolGui.

DigPeter

Quote from: Mario on May 17, 2014, 03:57:34 PM
This depends.
IMatch maps hierarchical to flat keywords when you change the hierarchical keywords, using the thesaurus and MD settings enabled at that time. I'm not sure what the reason for the difference in keywords where in the other thread. I explained the potential causes.
I replied to your last post on that thread with the information you asked for. There I say that the problem seemed to correct itself in the particular file we discussed.  Also Eric and Ferdinand have contributed.  The latter has a similar problem.  It might be associated with LR intervening in an arbitrary way.  Perhaps a rescan option to remap keywords from the hierarchical KWs of selected files would do the trick? 

QuoteThe suggested feature would he helpful if a user changes his mind and thesaurus and wants IMatch to go out and map all hierarchical keywords again to flat keywords, using the now changed settings in the thesaurus. If such is often necessary depends on your workflow.

I do not see that I will need to change my thesaurus very often, but if I do, this addition would be welcome.

Mario

Have you tried selecting multiple files and then switching the keyword panel to "modified" by clicking on the pen icon in front of the input box? When you then press save IMatch should run the same logic it does when you actually edit keywords, including the mapping to flat keywords. I have not tried this due to lack of time.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Quote from: Mario on May 17, 2014, 04:30:01 PM
Have you tried selecting multiple files and then switching the keyword panel to "modified" by clicking on the pen icon in front of the input box? When you then press save IMatch should run the same logic it does when you actually edit keywords, including the mapping to flat keywords. I have not tried this due to lack of time.
This does not work for me.  The excluded KWs are still there.  When I click save (gree tick mark), the write back yellow pencil does not appear on the thumbnail.

Erik

Quote from: Mario on May 17, 2014, 04:30:01 PM
Have you tried selecting multiple files and then switching the keyword panel to "modified" by clicking on the pen icon in front of the input box? When you then press save IMatch should run the same logic it does when you actually edit keywords, including the mapping to flat keywords. I have not tried this due to lack of time.

I did try this option (or something similar using a metadata panel) but clicking the pen icon when multiple images are selected makes the Hier-KW the same for all selected icons AND then it remaps the flat keywords.  It's close but not quite.

Although I guess in the option you're talking about here is specifically with the keyword panel, and I honestly didn't even notice the pen icon there at the input.  And seeing the result, I'm guessing this is where the item you (Mario) started the new topic to discuss for the 158 build.  I'm guessing that would solve my problems, so I'll check it out closely at that point and then potentially file a feature request along the lines of the suggestion IF the 158 solultion doesn't work.

Thanks for all the feedback in the multiple threads. 

Mario

Quote from: DigPeter on May 17, 2014, 04:50:22 PM
Quote from: Mario on May 17, 2014, 04:30:01 PM
Have you tried selecting multiple files and then switching the keyword panel to "modified" by clicking on the pen icon in front of the input box? When you then press save IMatch should run the same logic it does when you actually edit keywords, including the mapping to flat keywords. I have not tried this due to lack of time.
This does not work for me.  The excluded KWs are still there.  When I click save (gree tick mark), the write back yellow pencil does not appear on the thumbnail.
You're right of course. IMatch is so big, I cannot longer remember every detail.
The pen indeed is used to push the keywords of the focused file to all other selected files, to make them identical.

I have added a separate command to the Keyword Panel (and a toolbar button) to re-run the keyword propagation from hierarchical to flat. This will be in 5.0.158.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter