ExifTool Forum

General => Metadata => Topic started by: blue-j on March 10, 2022, 11:15:17 PM

Title: Multi-value vs Duplicatable Fields
Post by: blue-j on March 10, 2022, 11:15:17 PM
Some metadata fields permit multiple values in them, comma- or semi-colon-separated usually.  Others allow the duplication of fields as separate records.

How to know which is which?  Is the type distinction documented in ExifTool?

- J

Title: Re: Multi-value vs Duplicatable Fields
Post by: Phil Harvey on March 11, 2022, 08:01:33 AM
The ExifTool tag name documentation indicates List-type tags, if that's what you mean.

But technically, List-type tags may be stored in various ways in different types of metadata.

- Phil
Title: Re: Multi-value vs Duplicatable Fields
Post by: StarGeek on March 11, 2022, 11:43:46 AM
Quote from: blue-j on March 10, 2022, 11:15:17 PM
Some metadata fields permit multiple values in them, comma- or semi-colon-separated usually.

To expand a bit more, in the case of list type tags such as Keywords or Subject, they are only displayed as comma separated.  This is pretty much standard for most programs.  But they are stored separate.  For example, the raw xmp of the Subject tag shows that "One" is completely separate from "Two"
<rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:subject>
   <rdf:Bag>
    <rdf:li>One</rdf:li>
    <rdf:li>Two</rdf:li>
   </rdf:Bag>
  </dc:subject>
</rdf:Description>
</rdf:RDF>


Offhand, the only tags I can think of that are comma/semicolon separated are the XPKeywords (semicolon separated) and one of the PDF tags gets written as comma separated by Adobe (can't remember which).  In both these cases, exiftool treats them as string tags and leaves it up to you to do the bookkeeping.
Title: Re: Multi-value vs Duplicatable Fields
Post by: blue-j on March 11, 2022, 12:59:09 PM
Thanks, fellas!  What about fields that can be duplicated records? For example, say, image regions in IPTC Extension?  Artwork or Object, Location Shown, etc.  The schema permits more than one set of values for those.

- J
Title: Re: Multi-value vs Duplicatable Fields
Post by: StarGeek on March 12, 2022, 11:22:25 AM
The tag names page (https://exiftool.org/TagNames/) documents how the various types of tags are marked in the sub-pages.  You can also mouse over the entries on the writable column to get a tool tip if on desk top.

For the more complicated tags (artwork, locations, etc), see the Structured Information page (https://exiftool.org/struct.html). I tend to think of structured tags as if they were index cards with various pieces of data on them.  Or you could think of it as a single record in a database or row in a spreadsheet.

If you take a structure extracted with the -struct option (https://exiftool.org/exiftool_pod.html#struct---struct) and break it down, it becomes a bit easier to make since of.  In this post (https://exiftool.org/forum/index.php?topic=11988.msg64724#msg64724), I show how a RegionInfo (MWG regions) is set up.  The braces { } are use to indicate KEY:VALUE pairs and the brackets [ ] are arrays, usually of more structures, like the RegionList in that example.

Title: Re: Multi-value vs Duplicatable Fields
Post by: blue-j on March 13, 2022, 12:54:57 AM
Mind blown!!!  Merci merci merci!

- J
Title: Re: Multi-value vs Duplicatable Fields
Post by: StarGeek on March 13, 2022, 11:47:13 AM
Forgot to add this.  This is how the XMP-iptcExt:LocationShown structure is set up in Adobe Bridge.  I'd assume it would be similar for Lightroom.

(https://i.imgur.com/xfg61Qy.png)
If you click the folded corner icon in the "Location Shown" row, it will add another set of "Location" tags where you can enter data.  And you can remove a set with the trash icon.

In exiftool, you can see the full structure with the -struct option or view the data with the flattened tags
C:\>exiftool -G1 -a -s -struct -LocationShown y:\!temp\Test4.jpg
[XMP-iptcExt]   LocationShown                   : [{City=New York City,ProvinceState=New York},{City=Los Angeles,ProvinceState=California}]

C:\>exiftool -G1 -a -s -LocationShown* y:\!temp\Test4.jpg
[XMP-iptcExt]   LocationShownCity               : New York City, Los Angeles
[XMP-iptcExt]   LocationShownProvinceState      : New York, California


But you have to be careful with the flattened tags, as you won't seen missing data.  For example, here I've inserted "Chicago" in the middle without a state.  If you try to match City and State through the flattened tags, you'll end up with "Chicago, California".
C:\>exiftool -P -overwrite_original -LocationShown="[{City=New York City,ProvinceState=New York},{City=Chicago},{City=Los Angeles,ProvinceState=California}]" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -LocationShown* y:\!temp\Test4.jpg
[XMP-iptcExt]   LocationShownCity               : New York City, Chicago, Los Angeles
[XMP-iptcExt]   LocationShownProvinceState      : New York, California


Side note, I'm adding all of this so I can't link this thread if a similar question comes up later.