Variables and Metadata Template

Started by DigPeter, October 28, 2013, 06:24:45 PM

Previous topic - Next topic

DigPeter

A large number of my images are of botanical subjects.  The scientific name is written to XMP DC title, to hierarchical keywords (KW) and by background processing to @keywords.  To ensure data integrity and consistency of terminology, the starting point is Thesaurus where all hierarchical scientific names of interest are held.   The format of the scientific name is "Taxa Flowering Plants||i]Family name[/i]|Species name" - e.g. Taxa Flowering Plants|Asteraceae|Bellis perennis.  The hierarchical KW is assigned to "XMP LR\hierarchical subject" by checking the leaf box in Thesaurus (e.g. Bellis perennis).  Background processing then writes this (and other KWs) to @Keywords, where it is displayed in the same hierarchical format. 

I now want to write the leaf, Bellis perennis, into the image's title in XMP DC title.  I set up a Metadata Template to do this, as advised in an earlier thread. It worked at first, but it does not do so now. The template is shown in the attachment.  The data to be filled includes two tags, one for Flowering Plants, the other for Ferns.

Can someone please advise.

[attachment deleted by admin]

Mario

Please attach an export of your Categories and export your Metadata Templates to a file and attach them as well.
This makes it easier for me and others to look into this because we don't need to type everything from hand and copy it from your screen shot. Thanks.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Quote from: Mario on October 29, 2013, 10:29:28 AM
Please attach an export of your Categories and export your Metadata Templates to a file and attach them as well.
Mario, please see attached zip file. 

The zip file contains:
- Cats Istria.imcsx   This does not appear to show any of the @keywords categories, so I copied them to @Keywords.txt.

- @Keywords.txt - all the categories in the database.

- Istria40393.jpg - A sample image to which I was trying to assign the title from the leaf of the category "Taxa Flowering Plants|Lamiaceae|Clinopodium menthifolium"

- Assigned cats.jpg - the categories assigned to the image.

- Met temps.immdt - the templates export file.

- imatch_log20131029.txt - the log of the session where I attempted to assign the title form the template.

I am keen to get this right because this template is an important part of my work flow.



-

[attachment deleted by admin]

DigPeter

I would be most grateful if someone could kindly help with this problem

Thanks.

DigPeter

@Mario

I have done some further testing and wonder whether the problem lies with assigning categories.  This did work originally, but not for me with build 122.  I tried the sample templates and these are OK, but none of them use categories.  The sample template which assigns title from file name works, so it is not to do with the title variable.

I have tried a number of templates using categories as in the following assignment variables:

{File.Categories.Direct|filter:^Taxa Flowering Plants;level:leaf}
{File.Categories.Direct|filter:^Taxa Ferns;level:leaf}
{File.Categories.Direct|filter:^Natural History;level:leaf}
{File.Categories.Direct|filter:^Taxa Flowering Plants;level:1}
{File.Categories.Direct|level:leaf}

None of these work.  Have we a bug?

Mario

1. Don't use .Direct. Direct excludes data-driven categories and @Keywords.

2. You start your expression with ^ which means that the category name must begin with Taxa Flowering Plants. This cannot be correct because the category name is (using your sample image) is:

@Keywords|Taxa Flowering Plants|Lamiaceae|Clinopodium menthifolium

So, try

{File.Categories|filter:Taxa Flowering Plants;level:leaf}

(No Direct, no ^ at the beginning}
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Thanks Mario.  That does not work either, but I used the following expression, which does work:

{File.Categories|filter:Taxa Flowering Plants;level:3}   

So there would appear to a problem with 'leaf'.  My expresssion will work because the structure of the categories in the "Taxa Flowering Plants" group is standard.  I would need 'leaf' howeveer for other groups, where the structure has 2 or 3 levels, though I could of course, at some effort, standardise them.

Mario

{File.Categories|filter:Taxa Flowering Plants;level:leaf}

is exactly the expression I used for my test, and your sample file. I used the Var Toy App:





[attachment deleted by admin]
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

That is interesting. Your expression works in the Var Toy App for me, but "Clinopodium menthifolium" is not assigned to Title with your expression, while it is with the '..level:3' expression.

Mario

Do you run your template when IMatch ingests the files?

Since you access a data-driven category, I'm not sure that this will work reliable. For performance reasons, data-driven category creation may be delayed until the import is done, so the category "may not be there yet" when your file import runs...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Quote from: Mario on October 31, 2013, 06:29:52 PM
Do you run your template when IMatch ingests the files?
No - in this workflow the images are ingested first and initially have no metadata.  IM5 is first port of call for new images.  After ingestion, I assign keywords from Thesaurus, as seen in the above attachments.  These are then automatically written to the database as @Keyword categories.  I then fill in title and description in the metadata panel.  For botanical images, I want to use the Metadata template to write the species name to Title.

QuoteSince you access a data-driven category, I'm not sure that this will work reliable. For performance reasons, data-driven category creation may be delayed until the import is done, so the category "may not be there yet" when your file import runs...
I use the template after background processing has finished.

Jerry

I've run into this same problem.

The expression
{File.Categories|filter:^People;level:leaf}

works just fine in the App panel, and other places which uses expressions such as the File Window Tip, providing the desired result such as "Jerry"

However the very same expression in the metadata template does not work.

Trying to assign to Composite\Keywords (and tried several other tags also such as XMP::Lightroom\HierarchialSubject)
{File.Categories|filter:^People;level:leaf}

this just spits out the expression as the tag entry:   
{File.Categories|filter:^Rating; level:leaf}   

(yes exactly the same but curiously adds a space after the semicolon, which I guess suggests that the expression viewed as invalid and thus the line as two entries separated by a semicolon)

The help file mentions that level is not compatible with filter, but then it explains that you can use level as part of the filter command providing the example of
{File.Categories.Direct|filter:^Persons;level:leaf}

Again, this works fine for me in the app panel and elsewhere, but not in the metadata.

Not a huge deal, but would be nice to use the metadata template feature to plug in the leaf values of select categories into tags instead of having to write a little script to do it.

Thanks, Jerry


DigPeter

#12
Quote from: Jerry on January 02, 2014, 06:54:36 AM
I've run into this same problem.
Not a huge deal, but would be nice to use the metadata template feature to plug in the leaf values of select categories into tags instead of having to write a little script to do it.
Jerry,  This now works for me with this expression:  {File.Categories|filter:Taxa Flowering Plants;level:leaf}

But the problem of the options not performing to spec remains.  See: https://www.photools.com/community/index.php?topic=1260.msg9004#msg9004

Edit
Woops - just revisited this and find it does not now work (v132)  but it did with v128!


Mario

#14
Works here.

This is what I did:

I imported the JPEG file you attached to your initial report. This brings the keywords into the database and reproduces the category structure.

I tested the variable {File.Categories|filter:Taxa Flowering Plants;level:leaf} again in the App panel. It gives me Clinopodium menthifolium for the file Istria40393.jpg.

I then created a new metadata template with these settings:



I checked the JPEG file, it has no title. I then applied the TEST metadata template to the file. The title was set correctly to Clinopodium menthifolium.



Do I miss something or do something wrong?
This test shows that the tag is correctly parsed and inserted.

You wrote that you tried to set the data into a composite keyword or dc:Subject. This won't work because the data is already there!
IMatch works in the UI only with hierarchical keywords. And these hierarchical keywords are copied automatically into dc:subject and IPTC/Composite keywords.
If you update keywords from a metadata template, update hierarchicalSubject only.

But, the @Keyword category is filled from the hierarchical keywords in the file. And you access the keyword category via the above variable. So there is no need to write keywords again from the variable, they already exist or they would not be in @Keywords and thus not in the variable...





[attachment deleted by admin]
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Quote from: Mario on January 04, 2014, 06:57:58 PM
You wrote that you tried to set the data into a composite keyword or dc:Subject. This won't work because the data is already there!
IMatch works in the UI only with hierarchical keywords. And these hierarchical keywords are copied automatically into dc:subject and IPTC/Composite keywords.
If you update keywords from a metadata template, update hierarchicalSubject only.

But, the @Keyword category is filled from the hierarchical keywords in the file. And you access the keyword category via the above variable. So there is no need to write keywords again from the variable, they already exist or they would not be in @Keywords and thus not in the variable...
@Mario
Sorry - I do not think I said that I was trying to write to dc:subject by means of a template.  I did say that I wrote hierarchical KWs intially from the thesaurus.  Then for my botanical images I want to write the hierarchical KW's leaf to dc\title by means of the template.  it is this last step that is not working, despite using expressons which produce the correct reult in Var Toy app.

Mario

QuoteI want to write the hierarchical KW's leaf to dc\title by means of the template.

But this was working all the time, even in my initial reply to your post at the time. Only when repeatable tags were used as the target (e.g. keywords), variables were not parsed correctly in the template (but in the VarToy app and elsewhere). As long as the variable is correct and finds data to return, MD templates will work for the Title tag, or other non-repeatable tags. I cannot find any problem in that area in the current 132 build.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Quote from: Mario on January 05, 2014, 06:21:12 PM
QuoteI want to write the hierarchical KW's leaf to dc\title by means of the template.

But this was working all the time, even in my initial reply to your post at the time. Only when repeatable tags were used as the target (e.g. keywords), variables were not parsed correctly in the template (but in the VarToy app and elsewhere). As long as the variable is correct and finds data to return, MD templates will work for the Title tag, or other non-repeatable tags. I cannot find any problem in that area in the current 132 build.
Hmmm - I do not understand Only when repeatable tags were used as the target (e.g. keywords).   I assume that this does not apply to what I am trying to do, as you say it is working for you. If you cannot repeat my and Jerry's problem, there is not much can be done.

What perplexes me is that I can write {File.Categories|filter:Taxa Flowering Plants;level:leaf} to Headline, but not to dc::title, but I can write other @keywords categories to dc::title (e.g. {File.Categories|filter:Natural History;level:leaf})

Mario

Can't repro that. I used hierarchicalKeywords, Title and Headline in my tests, in one template. Only hierarchicalKeywords failed to update because the variable was not parsed correctly because of the ; in the function. All other tags worked straight away.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DigPeter

Quote from: Mario on January 05, 2014, 07:14:09 PM
Can't repro that. I used hierarchicalKeywords, Title and Headline in my tests, in one template. Only hierarchicalKeywords failed to update because the variable was not parsed correctly because of the ; in the function. All other tags worked straight away.
Sorry Mario - I do not understand this.  I am not trying to update Hierarchical Keywords - only Title.  Could you please explain about the ; ?  To what function does this refer?

Mario

If variables with formatting functions where used to fill repeatable tags, the ; in the variable name confused the metadata template. I explained that in one of my replies today to this or the other thread about metadata templates.

Non repeatable tags like title or headline always worked correctly. At least here. I cannot reproduce what you are describing. I use the original file attached by you above. As I wrote, if you now use a different keyword structure and different variables in your template, I would need a sample so I can try here. You can paste the expression you use in your template here, and attach a small file with the keywords you use with that file in your database.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook