Automatically assigning a category

Started by DDBenson, August 29, 2019, 05:35:53 PM

Previous topic - Next topic


...Two pots of coffee this morning and STILL can't get my head around a solution to accomplish what I am trying to do! :-)

I use a hierarchal system for assigning WHO categories starting with ancestors down to present generation of family members. Using myself as an example, it looks something like this:

Benson Line|
-> William Benson| [my ggggrandfather]
   -> Solomon Benson| [my gggrandfather]
      -> William Benson| [my ggrandfather]
         -> Glenn Benson| [my grandfather]
            -> Darrel Benson| [my father]
               -> Dale Benson [me]

I use a metadata template that copies the category at the leaf level to Keywords into a file ("Dale Benson" in this example). When I upload files to Flickr to share with family, these keywords remain embedded and are especially helpful for viewers looking at very old photos.

I would like to also have the top level ("Benson Line" in this example) embedded as a Keyword in each file. That is to say, I would like both the person's name and their family line to get embedded in the file. I could create "Family Line" categories and then manually assign the appropriate one, but it would be MUCH easier and faster and more accurate to have it done automatically. Can someone point me in the right direction?

Thanks very much.


I assume you are aware of the special @Keywords Category and all the keywording functionality (from the Keyword Panel to the Thesaurus, group levels for excluding keywords etc...) integrated in IMatch...?

You already have a Metadata Template which manually converts categories into keywords.

I assume you are using a variable to specify the categories you want to copy?
If so, have you tried the following:

For example, the variable {File.Categories.Direct|level:1} would produce "Benson Line". (One level below 0 (WHO)). If Benson Line is under @All, use {File.Categories.Direct|level:root} instead.

And {File.Categories.Direct|level:leaf} produces "Dale Benson". (Bottom level).

This is from the help topic List of File Variables
-- Mario
IMatch Developer
Forum Administrator  -  Contact & Support - Follow me on 𝕏 - Like on Facebook


Thanks very much, Mario, for the speedy reply.
Yes, I had just now arrived at this same solution (third pot of coffee doing the trick! :-)). I am producing the desired results in all cases of family members. However, I have other WHO categories that do not have the same number of levels from the root. The example I gave in earlier post was actually WHO| Dale Benson Family| Father's Father| Benson Line|... The "Benson Line" is actually level 4. But another 'tree' for "Friends", for example, is WHO| Friends|... [or WHO| Business Associates|...], whereby using level 4 returns an inappropriate result. So I am now trying to find way to restrict to just certain 'trees'.
Another pot of coffee....


If you want the bottom level, the leaf filter does the trick. It works independent from the number of levels.
The same is true for root.

If you need to copy together different categories from different levels from different sections in your category ... well, not even IMatch can do everything.
You may need to use some category filters to limit your variable to certain sections in your tree, and then use leaf/root/level as needed.
I linked to the corresponding section in the IMatch help in my first reply.
-- Mario
IMatch Developer
Forum Administrator  -  Contact & Support - Follow me on 𝕏 - Like on Facebook


Using a filter I was able to apply to just the section of the trees that I wanted. Beautiful!
Problem now is that on files with more than one person pictured, the 'Family Line' is outputting multiple times. [for example photo of me and my dad returns Benson Line, Benson Line]
I haven't found anything in the help files yet, but is there a way to limit, or combine, multiple occurrences into just a single occurrence?

Alternatively, if I were to create WHAT categories for Family Line, is there a way to have the correct one automatically selected depending upon which WHO category was selected?


The Categories variables return all categories to which an image is assigned. If an image is assigned to multiple WHO categories, each category will become part of your output. There is no folding on levels or anything.
What you are trying to do is in fact really complex.

QuoteAlternatively, if I were to create WHAT categories for Family Line, is there a way to have the correct one automatically selected depending upon which WHO category was selected?

I don't even understand what yo mean by that.

Would a specialized genealogy software not be better suited for what you are trying to achieve?
They use graphs to represent families, not hierarchical categories. Different thing. Different technology.

IMatch is a DAM and it can do a lot.
But you seem to have a really unique use case (creating keywords from multiple spots of hierarchical keywords, on different levels, with folding, dupe removal, whatnot).
That's nothing a general DAM can do.
I most workflows you would just copy the fully-qualified keywords into your file and the receiving application decides what to display and how.
Did you ask Flickr how they handle standard XMP hierarchical keywords and how you can filter the output they present?
I'm sure they have many options implemented for this in their software/site. Large company, big audience, lots of resources etc.

A custom IMatch app would be able to do what you want, because it would know how to use your category hierarchy to produce the keywords you want.
If you can program or you know somebody who can, this would probably take a day or two.
-- Mario
IMatch Developer
Forum Administrator  -  Contact & Support - Follow me on 𝕏 - Like on Facebook


Mario, thanks very much for your input on this. Really appreciated.

Quote from: Mario on August 29, 2019, 09:55:10 PM
I don't even understand what yo mean by that.

  ;D I should have quit after three pots of coffee.  :o

I didn't want this to get complicated. What I'm trying to do is simply imbed a keyword that indicates which Family Lines are represented in the photo. For example, in a picture containing me, my dad, my mom, and my mom's mother, I would want just two 'family line' categories selected - Benson Line, and Jenson Line (my mom's line). The reason I want that is so that other people can search for pictures from a specific family line. I'm the 'genealogy guy' in our family and I'm sharing many hundreds of photos with them on Flickr. It's easy for me to find files in iMatch; but it is very difficult for others looking at an online album that includes so many pictures. By imbedding names and family lines, it makes it easier for them to find stuff.
I COULD just create a hierarchical category called Family Lines with levels below it for the various family lines (eg Benson Line, Jenson Line, etc.) and then just manually select the appropriate one(s). In fact, that is what I started out to do. But I thought an automatic way of doing it might be better.

I'm currently reading up on Data Driven Categories to see if that might provide a solution.


I indicated that I'm sharing hundreds of photos. I should have said thousands of photos. These photos date all the way back into the 1800's so many of the people I'm sharing them with likely don't even recognize the people pictured. So being able to see which 'family line' is represented is very useful.


For what it's worth, I use a genealogy software program to keep my family tree organized, and store links in it to my family history photos. As Mario has suggested, genealogy programs are better suited to keeping track of the very complicated relationships in a family tree than is a photo-oriented data management program. I don't use FamilySearch Family Tree, but its authors have documented their data model, which is quite complex:

Good luck whichever way you go!



Thank you very much for your input, John.
I have been using Legacy Family Tree software for many years to effectively manage my family history information. I have online trees at both and Family Search (mostly to find the occasional lead to previously unknown 'cousins'). But I find it too cumbersome to upload large numbers of photos to these sites, and, I don't like the level of control forfeited once uploaded.
The reason I finally settled on Flickr to share my files is that it is the only photo-sharing site I've found that doesn't automatically strip out all my metadata when the files are uploaded to their site. When viewing a photo at Flickr, a list of the keywords contained within are listed below the picture. This list of keywords provides helpful information about the picture, of course, but it offers even more. When a keyword is clicked, the viewer is presented with a new set of photos that also contain that same keyword. So you can see why having a 'Family Line' keyword might be handy for a site visitor when looking through a stack of thousands of old photos.
My original inquiry was not about how to better organize my files. I pretty much have that under control to my satisfaction. [Family members might even say I'm a bit anal in that regard!  :)] I was simply looking for a way to automatically select a category.


I have thought about this for a while.

And then I made a change to the Metadata Template processing in case of repeatable tags (like keywords) as follows:

If the variable expression produces duplicate values, they are not longer added to the keywords. For example, if the source variable produces


only the keywords Pea and Orange are added now.

In your case, when you use filters, the "Benson Line" keyword now appears only once in the output. This should solve your problem nicely, without breaking anything and also for the benefit of other users.

This mechanism is already in place when you add keywords in the 'normal' way (Keyword Panel, @Keywords, ...) but it was not enforced yet for MD Templates. But I don't see a use case to allow duplicate values for repeatable tags in MD templates. If there is really a case for this (users will tell me) it can always be done via the MD Panel.

-- Mario
IMatch Developer
Forum Administrator  -  Contact & Support - Follow me on 𝕏 - Like on Facebook


Thanks very much, Mario. Sounds like the perfect solution. I'll check it out as soon as I am able.