IPTC and dealing with duplicate xmpIDs

Started by BarryIptcStan, June 12, 2025, 01:23:30 AM

Previous topic - Next topic

BarryIptcStan

In the IPTC spec, it appears that there are some duplicate `xmpID` => structure name mappings. For example:

Code (yaml) Select
  Entity:
    identifiers:
      XMPid: xmp:Identifier
      etTag: Identifier
      #
      # ...snip...
      #
  EntityWRole:
    identifiers:
      XMPid: xmp:Identifier
      etTag: Identifier

I'm writing a metadata parser + editing library similar to Exiv2 + ExifTool - but, because of the duplicates here, my Rust compiler is pissed! >:(

Code (rust) Select
warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1369:13
     |
1367 |             "xmp:Identifier" => Some(IptcKey::EntityIdentifiers),
     |             ---------------- matches all the relevant values
1368 |             "Iptc4xmpExt:Name" => Some(IptcKey::EntityName),
1369 |             "xmp:Identifier" => Some(IptcKey::EntityWRoleIdentifiers),
     |             ^^^^^^^^^^^^^^^^ no value can reach this
     |
     = note: `#[warn(unreachable_patterns)]` on by default

warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1370:13
     |
1368 |             "Iptc4xmpExt:Name" => Some(IptcKey::EntityName),
     |             ------------------ matches all the relevant values
1369 |             "xmp:Identifier" => Some(IptcKey::EntityWRoleIdentifiers),
1370 |             "Iptc4xmpExt:Name" => Some(IptcKey::EntityWRoleName),
     |             ^^^^^^^^^^^^^^^^^^ no value can reach this

warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1374:13
     |
1368 |             "Iptc4xmpExt:Name" => Some(IptcKey::EntityName),
     |             ------------------ matches all the relevant values
...
1374 |             "Iptc4xmpExt:Name" => Some(IptcKey::ImageRegionName),
     |             ^^^^^^^^^^^^^^^^^^ no value can reach this

warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1396:13
     |
1365 |             "Iptc4xmpExt:RightsExprEncType" => Some(IptcKey::EmbdEncRi...
     |             ------------------------------- matches all the relevant values
...
1396 |             "Iptc4xmpExt:RightsExprEncType" => Some(IptcKey::LinkedEnc...
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this

warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1397:13
     |
1366 |             "Iptc4xmpExt:RightsExprLangId" => Some(IptcKey::EmbdEncRig...
     |             ------------------------------ matches all the relevant values
...
1397 |             "Iptc4xmpExt:RightsExprLangId" => Some(IptcKey::LinkedEncR...
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this

warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1426:13
     |
1424 |             "Iptc4xmpExt:rbX" => Some(IptcKey::RegionBoundaryRbX),
     |             ----------------- matches all the relevant values
1425 |             "Iptc4xmpExt:rbY" => Some(IptcKey::RegionBoundaryRbY),
1426 |             "Iptc4xmpExt:rbX" => Some(IptcKey::RegionBoundaryPointRbX),
     |             ^^^^^^^^^^^^^^^^^ no value can reach this

warning: unreachable pattern
    --> /Users/barrett/Documents/projects/raves-project/raves_metadata/target/debug/build/raves_iptc_names-3d353ebca3108562/out/iptc_keys.rs:1427:13
     |
1425 |             "Iptc4xmpExt:rbY" => Some(IptcKey::RegionBoundaryRbY),
     |             ----------------- matches all the relevant values
1426 |             "Iptc4xmpExt:rbX" => Some(IptcKey::RegionBoundaryPointRbX),
1427 |             "Iptc4xmpExt:rbY" => Some(IptcKey::RegionBoundaryPointRbY),
     |             ^^^^^^^^^^^^^^^^^ no value can reach this

I'd really like to have an `iptc_key_from_xmp_id` method, but this is kinda getting in the way. Have any of y'all parsed IPTC in XMP with your projects?

If so, what would you do?

  • Should I just give up and accept the duplicates?
  • Or maybe it's a mistake in the specification?

It just feels off to me. I'd really appreciate your perspectives! ;D :-*
my suffering is progressing

StarGeek

Quote from: BarryIptcStan on June 12, 2025, 01:23:30 AM
  • Should I just give up and accept the duplicates?
  • Or maybe it's a mistake in the specification?

I can't really help with the yaml doc, it's all above me.

They are referring to two similar, but different structures. One is
12.4 Entity or Concept structure. The other is 12.5 Entity or Concept with role structure.

They both have an Identifier and Name tag, but Entity or Concept with role structure also includes a Role tag.

The thing to understand is that structure definitions are not real tags. They are the definitions that other tags use to create their structured data.

The Entity or Concept structure is used with the following tags
ContainerFormat
EventExt
(Called ShownEvent by exiftool)
ImageRegionCtype
ImageRegionRole
MetadataAuthority
MetadataLastEditor
PersonHeard
SupplyChainSource
VideoShotType


The Entity or Concept with Role structure is used with the following tags
Contributor
Creator
PlanningRef


So the entry of XMPid: xmp:Identifier actually refers to any of these

ContainerFormatIdentifier
EventExtIdentifier
ImageRegionRCtypeIdentifier
ImageRegionRoleIdentifier
MetadataAuthorityIdentifier
MetadataLastEditorIdentifier
PersonHeardIdentifier
SupplyChainSourceIdentifier
VideoShotTypeIdentifier

and

ContributorIdentifier
CreatorIdentifier
PlanningRefIdentifier
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

BarryIptcStan

Ahhhh, I see what you mean! Each variant of `ipmd_top` can optionally have a `datatype` and `dataformat`, where `datatype` references a type defined in `ipmd_struct`.

So, I need to create some structs for each tagged union variant to reference. I'll get to work on that!

Thank you so much for the assistance! ;D
my suffering is progressing