How can I restrict the output of some categories to @Keywords

Started by DDBenson, November 17, 2014, 09:20:27 AM

Previous topic - Next topic

DDBenson

I use IMatch to a very large degree for organizing genealogy data. I have "Who" categories that include family 'lines' ("Father's Father", "Father's Mother", "Mother's Father", and "Mother's Mother for example) which appear near the top in the hierarchy. Beneath each of these extend downward all the known generations of my ancestors - parent to child to child to child, etc. all the way down to the newest generation. My dad's name appears within the "Father's Father" line as a child category to my grandfather's name and mine appears as a child to my dad's. My mother's name also appears as a child to my dad's, but with a "+" in front of it. I use the plus symbol to indicate a spouse, and it also serves to sort the spouse's name above the children. A partial clip of the tree might look like this:
Father's Father Line
.
.
.
MyGrandfather Glen
+MyGrandmother Bessie
MyFather'sSiblings
MyFatherDarrel
+MyMotherMarion
  MeDale
  MySiblings

My mom's name of course also appears in the "Mother's Father" line as a child to her father.
.
.
.
MyGrandfatherLeonard
+MyGrandmotherMarie
MyMother'sSiblings
MyMotherMarion

This is very useful and pleasing (to me) to have spouses appear both in the family they were born into and the family/families they married into. I can look at the category tree and see all the related persons properly grouped together, and I can very easily find related photos and documents. But I don't want to assign them to more than one "Who" category because this would take a lot of extra time and effort, and it would also result in multiple versions of the person's name as keywords. So in IM3 I set the category property in the category of my mom (for example) where she appears as a spouse (that is, the one with the "+" in front of it where it occurs as a child category to my dad) with an expression that directs to the other category of her name where it occurs as a child to her father. I also define it as a 'sealed' category. When I have completed assigning categories to a file I then run a script which copies the "Who" categories to IPTC Keywords. Done this way the person's name category appears as a keyword only once.

I am now moving to IM5 and can not figure out how to accomplish the same results. The closest I've come is by using a Metadata Template to fill the Lightroom Hierarchical Keywords tag with IM Category variables. This works okay in most cases. The exception is where, as described above, the person has additional "Who" entries as a spouse. Here the result is two @Keywords (or more, as the case may be) for the person's name. One of them is the one from the category created as a child to the person's father. This is the one I want to use. The other(s) are those from the categories with the "+" in front, created as a child to the person's spouse, and defined in the category property (in IM5) by Formula. These I do not want. Is there a way to restrict these from being created? Or is there some other way to accomplish the same end result (that is, just one "Who" category getting created as a @Keyword)?

Mario

The important thing to keep in mind when working with @Keywords:

Quote@Keyword just mirrors the hierarchical keywords stored in your files.

It's merely a convenience feature, allowing you to quickly see which files have which keywords, perform selections and even bulk operations on keywords. But, in general, IPTC/XMP keywords are dumb, and so @Keywords cannot be too smart either.

The luxury you get from using native IMatch categories (formulas, Alias categories etc.) is not available for @Keywords, at least not within the @Keywords hierarchy itself. You can use @Keywords categories in formulas elsewhere, and also alias them. But not the reverse.

This means if you want to project something like a genealogy tree into keywords, you will run into limitations. Maybe some that cannot be overcome. Some things not even IMatch can do. I'm sure other users who work with genealogy data have some ideas to share. I don't, unfortunately.

I toyed with the idea to implement a new View type for IMatch, something that allows users to really use genealogy trees or other structures which require n:m (one node can have multiple parent nodes). But a) there is never enough time and b) it was not requested. Maybe once or twice. I don't recall a single feature request for it.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DDBenson

I understand Mario, and I appreciate very much your usual quick response. :-) [How do you do it?!!]
Let me clarify, however, that my objective is not to preserve the genealogy tree structure during the creation of keywords but rather to only keep from imbedding multiple 'name' keywords for an individual. What is happening now in IM5 is that a photo of two persons (my mom and dad for example) ends up with three name keywords (e.g. "Darrel Benson", "Marion Benson", and "+Marion Benson"), which will result in confusion and undesired consequences when I share this photo with others (on Flickr for example). My reason for creating the second name category for my mom is as an organizational convenience to me so that she also appears in the genealogy tree logically with the rest of her family, and so that I can more easily see who the entire family was. Of course I can remember my own family members (well, currently anyway :-)) but it becomes much more of an issue when I am referencing people several generations back or for family members that are not as close to me.

Is there a way to control or affect (in category property, perhaps?) whether the category gets sent to @Keywords?


Mario

Categories don't get 'sent' to keywords. They are filled from the keywords in your files.
If you add a new keywords to a file in the Keyword Panel, a corresponding category will be created.
If you make changes directly in the @Keywords category hierarchy, this results in keywords being added to your files. The Keyword Panel is the preferred method to work with keywords.

I'm not sure that I get the problem with the duplicate names. Do you say that IMatch is adding the same keyword multiple times?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Richard

QuoteDo you say that IMatch is adding the same keyword multiple times?

Not really. Two categories for the same person but one is "Marion Benson" and the second is for "+Marion Benson".

I do have a numbering system that might help. It results in families being grouped in a family tree sort of order. However, when the category names are sent to Keywords, the numbers are included.

DDBenson

My IM5 database is one converted from the that which I've used for several years in IM3. Following the example I started with up thread, in IM3 the category "+Marion Benson" was defined in the category properties by inserting an Expression pointing to the category "Marion Benson". Any file that I assigned to the "Marion Benson" category now also showed up under the "+Marion Benson" category. Further, after running a script using Khodadad's All Purpose IPTC Writer which mapped the leaf of the "Who" categories to IPTC Keywords, only the "Marion Benson" category was mapped. That is to say, the OTHER one ("+Marion Benson") which used an expression to 'point' (?) to the first category, did not get mapped. The result was that the file only contained the keyword "Marion Benson". It did not contain the keyword "+Marion Benson".

I have now converted the database to IM5 and am trying to obtain the same result but seem to have a problem doing so. Rather than using a script to accomplish this, I have instead created a Metadata Template which fills the tag XMP::Lightroom\HierarchicalSubject with the data from category variable File.Categories filtered to the leaf of category "Who". But now, after assigning the "Marion Benson" category to a new photo, both "Marion Benson" and "+Marion Benson" appear as @Keywords assigned to it immediately upon running the new Metadata Template. The @Keyword "+Marion Benson" did not exist anywhere in the database prior to running the template.

In IM5 the category properties of category "+Marion Benson" indicate it now to have a "Formula" (instead of "Expression" in IM3) pointing to the other category "Marion Benson". As far as I can tell so far, my category list appears and behaves just as it did in IM3. I just can not figure out how to 'imbed' only the 'main' "Who" category leaf and not the 'alias'. [The terms 'imbed', 'main', and 'alias' are probably not used correctly here, but I hope you understand what I'm trying to convey.]

sinus

Quote from: Richard on November 17, 2014, 05:29:04 PM
QuoteDo you say that IMatch is adding the same keyword multiple times?

Not really. Two categories for the same person but one is "Marion Benson" and the second is for "+Marion Benson".

I do have a numbering system that might help. It results in families being grouped in a family tree sort of order. However, when the category names are sent to Keywords, the numbers are included.

Some years ago, when I read quite a lot about such family-trees, I have lerned, that a numbering-system is a good thing. So I create one and with such a (clever) numbering system, the families and relatives and so on will be ordered the correct way and I can also easy add new family members (children or new "parents" because of divorce and so on).
Best wishes from Switzerland! :-)
Markus

sinus

Quote from: DDBenson on November 17, 2014, 06:29:43 PM
My IM5 database is one converted from the that which I've used for several years in IM3. Following the example I started with up thread, in IM3 the category "+Marion Benson" was defined in the category properties by inserting an Expression pointing to the category "Marion Benson". Any file that I assigned to the "Marion Benson" category now also showed up under the "+Marion Benson" category.

Hm, that would be maybe the alias-category in IM5?
Sorry, I do not understand fully, what you finally want do.
But this must not be, that you do not good enough explane it, more possible the reason is my limitation of understanding English.
Best wishes from Switzerland! :-)
Markus

Ferdinand

Quote from: DDBenson on November 17, 2014, 06:29:43 PM
I have instead created a Metadata Template which fills the tag XMP::Lightroom\HierarchicalSubject with the data from category variable File.Categories filtered to the leaf of category "Who". But now, after assigning the "Marion Benson" category to a new photo, both "Marion Benson" and "+Marion Benson" appear as @Keywords assigned to it immediately upon running the new Metadata Template. The @Keyword "+Marion Benson" did not exist anywhere in the database prior to running the template.

You need some way to filter to filter out the "+Marion Benson" category from your metadata template.  Clearly you've discovered filters.  Normally you're filtering things in rather than out.  I'm not sure if you can filter things out using a regular expression, but you could try.  Mario - will this work?

DDBenson

I think I may have made the issue unnecessarily confusing by using my example with genealogy related categories when in fact that has nothing at all to do with it. So let's start over.

Let's say that I create two entirely new categories in IM3 called "TEST_A" and "TEST_B" in a "Who" category tree. I go into Properties for the category TEST_B and insert the Expression pointing to the category TEST_A. I now select a file and assign category TEST_A. Besides now appearing in the category TEST_A the file also appears in the category TEST_B. Next, I'll use a script to map the leaf of the "Who" categories to IPTC Keywords. When I run that script on the file the result is that a keyword TEST_A is now in the file. A keyword TEST_B is NOT in the file. I like this.

Now, let's move over to IM5 (where I am using a duplicate but completely separate database from the one used in IM3) and create two entirely new categories with the same names as above. And like above, I then go into the Properties for the category TEST_B and in the Formula field [there is no longer the "Expression" field] insert a link (maybe "link" is not the appropriate term?) which points to the category TEST_A. Like above the file now appears in both the TEST_A and TEST_B categories. Next, instead of using a script as was done in IM3 I now run a Metadata Template configured to fill the XMP::Lightroom\HierarchicalSubject tag with the data from category variable File.Categories filtered to the leaf of category "Who". The result is that BOTH "TEST_A" and "TEST_B" now appear as @Keywords in the file. I do not want this.

What can I do differently that results in only the one desired @Keyword (i.e. TEST_A) getting put into the file?

DDBenson

Oops... Ferdinand replied before I was finished composing the last post. Thank you, Ferdinand.
Yes, that makes sense to me (sort of).
Or maybe there could some day be a check box in Properties that could exclude the category from certain processes (like creating @Keyword)?

Mario

Quotethat could exclude the category from certain processes (like creating @Keyword)?

@Keyword categories do not create keywords! @Keywords is a data-driven category which is filled from the keywords in your files. You are looking at this from the wrong side.

When IMatch imports a file, it updates @Keywords to include all keywords contained in that file, and then assigns the file to these child categories. You cannot skip certain keywords, or prevent them from being included in @Keywords. This category hierarchy will always stay in synch with the keywords in your files.

The proper way to work with Keywords is the Keyword Panel.
But if you use the @Keywords category hierarchy directly, your changes will be mapped directly into 'real' keywords. You assign a file to the @Keyword category TEST_A => the keyword TEST_A will be added to the file. You remove a file from the TEST_A category => the TEST_A keyword will be removed from the file.

QuoteNext, instead of using a script as was done in IM3 I now run a Metadata Template configured to fill the XMP::Lightroom\HierarchicalSubject tag with the data from category variable File.Categories filtered to the leaf of category "Who". The result is that BOTH "TEST_A" and "TEST_B" now appear as @Keywords in the file. I do not want this.

When I understand you correctly, you are working actively against the automatic keyword handling with your Metadata Template. Instead of using the features provided, you manually copy parts of your category hierarchy (outside of @Keywords) into the hierarchicalKeywords tag. If you really need to do this. you can only use the filters and other methods provided by variables to strip out the categories you don't want to copy into keywords. Probably you need to re-arrange your category hierarchy to make it easer for the variable to filter out unwanted categories before copying them into keywords.

But frankly, you make your life unnecessarily hard by working against the system and by overriding the default keyword handling that way.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

DDBenson is trying to use a metadata template to write some IMatch categories into @keywords - what's wrong with that?

He is also wants to filter out certain categories so that they don't get written.  I.e.  He has a category branch "Who" that he wants to write to Keywords using a metadata template, but he wants to prevent certain categories in this category branch from being written. 

So the question is, can he filter out certain categories from being written using a category filter, rather than filtering them in?

sinus

Quote from: DDBenson on November 17, 2014, 11:57:17 PM

Now, let's move over to IM5 (where I am using a duplicate but completely separate database from the one used in IM3) and create two entirely new categories with the same names as above. And like above, I then go into the Properties for the category TEST_B and in the Formula field [there is no longer the "Expression" field] insert a link (maybe "link" is not the appropriate term?) which points to the category TEST_A. Like above the file now appears in both the TEST_A and TEST_B categories. Next, instead of using a script as was done in IM3 I now run a Metadata Template configured to fill the XMP::Lightroom\HierarchicalSubject tag with the data from category variable File.Categories filtered to the leaf of category "Who". The result is that BOTH "TEST_A" and "TEST_B" now appear as @Keywords in the file. I do not want this.

If I do this

familiy (cat)
benson (subcat)
also benson (subcat; formula (NOT alias) pointing to "benson"

If I then use the template, as you have pointed out, DDBenson, than you could try to use:

{File.Categories.Direct|level:1}

this gives me only this cat:

benson


(NOT also benson)

direct does not use cats, what are directly tagged, because "also benson" is a formula, it is not directly tagged.
With alias it works not.
Best wishes from Switzerland! :-)
Markus

DDBenson

YES!! Sinus and Ferdinand, thank you!

This is how I had it written previously, producing undesired result: {File.Categories|filter:^1Who;level:leaf}. Corrected now to this: {File.Categories.Direct|filter:^1Who;level:leaf}.

Apologies, Mario, for my apparently improper use of terms. I'll have to study more to gain better understanding of @Keywords vs. keywords. I have absolutely no background in programing and therefor everything I've done is simply by reading here and experimenting until desired results are obtained. Much of the time I do not fully understand HOW these results were obtained. :-)

sinus

Fine, that you could solve it! I hope, you have still a lot of fun (and success) with IMatch.  :D
Best wishes from Switzerland! :-)
Markus

Mario

Quote from: DDBenson on November 18, 2014, 05:04:26 PM
Apologies, Mario, for my apparently improper use of terms. I'll have to study more to gain better understanding of @Keywords vs. keywords. I have absolutely no background in programing and therefor everything I've done is simply by reading here and experimenting until desired results are obtained. Much of the time I do not fully understand HOW these results were obtained. :-)

Well, you are trying non-standard and rather advanced things. Instead of using the Keyword Panel and thesaurus to view and edit keywords, you are copying IMatch categories via  Metadata Template into keywords. This is definitely something that falls under advanced procedure and may require some tinkering to get it to work. Luckily you are using IMatch which at least gives you all the options.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

I'd still like to know if it's possible to filter out certain categories from being written via a metadata template when using a category filter, rather than filtering them in?

Mario

You can try everything that is offered by the corresponding variables in the App Panel.
I don't currently have the time to try things out to give you definite answers. I would have to look things up in the help, and then  try things out in the app panel. I don't have all this stuff in my head, sorry.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook