Bug 336328

Summary: Tags Manager's Sync Export DB to metadata, mirrors XMP but it only appends IPTC keywords data
Product: [Applications] digikam Reporter: GPSanino <gpsanino>
Component: Tags-ManagerAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: caulier.gilles, freisim93, veaceslav.munteanu90
Priority: NOR    
Version: 4.0.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.3.0
Sentry Crash Report:
Attachments: image file with IPTC and XMP metadata to test on DK4.0.0

Description GPSanino 2014-06-16 19:02:16 UTC
This happened when attempting to sync the DB with the metadata of my files, deleting old tags and renaming others.

On DK 4.0.0, using Tags Manager's tool Sync Export "write tags from DB to Image", the result was:
1) DB and XMP metadata on files was perfectly mirrored .
2) Checking IPTC metadata on some files with menu/Image/Metadata/Edit all Metadata/IPTC/Keywords, I noticed that the "old" tags were not deleted and the new tags layout was appended just below.
3) The attempt of re-reading metadata from files to fill the DB back with the old tags to manually delete them as in DK3.5.0, failed. The "old" tags did not show up again on the DB.
4) Trying to do step "3" but copying some files to another box with DK4.0.0 (from OpenSuSE to Kubuntu), showed the same result. Old tags on IPTC were there and were not added to DB after attempting to re-read metadata using the tool under menu/Image, nor as Album, nor with the Maintenance tool, nor Tag Manager's sync export "Read tags from image".

On boxes with DK3.5.0, the same folders were read by DK, and the new as old tags were added to the DB as expected. The "re-read metadata form files" also works fine.
To eliminate the old tags, I have used the called "tedious method".

All seems to me that in DK 4.0.0 "re-read metadata from files" is not taking into account IPTC info, and the writing DB to files' metadata is mirroring correctly the XMP section but only appending on the IPTC section.

BTW: sync export on "Tag Manager" is confusing since the tool include both direction from and to DB, it should be only "syn" instead of "export".

Reproducible: Always

Steps to Reproduce:
1.try re-read metadata from files (IPTC) using DK4.0.0
2.check if on the DB the tags in IPTC were added to it.
3.try to "sync export" by using "write tags from database to image" having files with previous IPTC tags, after adding new tags and disabling others.
4. check menu /image/metadata/edit all metadata/ IPTC keywords, if the IPTC info is the same as XMP or had just appended that info into the previously existing data.
Actual Results:  
- XMP metadata is synced properly with Database (mirrored) but the IPTC section keep its old info while the new info is just added below (appended).

- Additionally, the re-read metadata to files tool, only considers XMP metadata. The IPTC is not added to Database.

Expected Results:  
Both XMP as well as IPTC image metadata should be mirrored with database.

Tested on 32bit and 64 bits architectures, of OpenSuSE 13.1, Kubuntu-trusty and LinuxMint16.
Using DK 4.0.0 v/s DK 3.5.0, both with default settings regarding metadata; without having any  side car function enabled but ensuring that the "write this info to metadata" is active for tags,
captions, rates and templates. Some box only with DK4.0.0 other with DK3.5.0 and attempts on DK3.5.0 upgraded into 4.0.0, all had the same results attributed only to Digikam's versions.
Comment 1 GPSanino 2014-06-16 19:08:43 UTC
Created attachment 87221 [details]
image file with IPTC and XMP metadata to test on DK4.0.0

this file is for testing purposes only.
Comment 2 GPSanino 2014-06-16 19:12:37 UTC
Just try to read the metadata from the attached file into database using DK 4.0.0.

It has more info on the IPTC than XMP, but the database will only collect metadata from XMP and not IPTC sections.

Also, changes (rename/delete/adds) on the tags from DB, when saved into the image's metadata will only mirror DB and XMP Metadata, while on IPTC changes are only appended.
Comment 3 caulier.gilles 2014-06-16 20:27:11 UTC
yes, by preference order, metadat in DB are filed by XMP and after IPTC if XMP is not available.

Why? Because IPTC has serious limitation that XMP don't have. Typically Metadata Working Groug recommend to synchronize XMP with IPTC for the best compatibility.

I recommend to revise your workflow if your initial metadata DAM do not respect this rules.

Gilles Caulier
Comment 4 GPSanino 2014-06-16 21:12:54 UTC
Gilles, if I understand properly, this means that IPTC is _*ignored*_ if
there is something XMP on the file's metadata.
So, I should be ok after cleaning the IPTC metadata with DK 3.5.0;...  
because I have no clue about how to synchronize XMP with IPTC.

My surprise here is because I do not recall have used XMP before. I have
not enabled to write on XMP side cars neither on my DK settings. Then, I
do not know how metadata showed up in XMP on my files.
I guess that happened during the sync export with Tag Manager with DK4.0.0.
I am glad that DK 3.5.0 still reads the IPTC section so I can try delete
its obsolete content. However, this fix seems only temporary since I may
have again the same problem (not mirrored IPTC/XMP content) next time I
re-arrange the tags tree and save to metadata.

I wonder how in DK4.0.0 we will be able to clean IPTC data as we used to
do in DK3.5.0. From your explanation I am not sure to understand if this
will be treated as a bug or this is just the new way things are. Maybe I
should see this inconsistency as fine since now I have XMP on my files.
This is important for me because I have connected Digikam4.db file with
LibreOffice.base for further queries, data analysis, etc. Now I know I
have to change the used fields to retrieve data to only XMP fields and
not IPTC. You saved me a lot of problems by telling me this.

Thanks a lot Gilles
gps

On 06/16/2014 04:27 PM, Gilles Caulier wrote:
> https://bugs.kde.org/show_bug.cgi?id=336328
>
> Gilles Caulier <caulier.gilles@gmail.com> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |caulier.gilles@gmail.com
>
> --- Comment #3 from Gilles Caulier <caulier.gilles@gmail.com> ---
> yes, by preference order, metadat in DB are filed by XMP and after IPTC if XMP
> is not available.
>
> Why? Because IPTC has serious limitation that XMP don't have. Typically
> Metadata Working Groug recommend to synchronize XMP with IPTC for the best
> compatibility.
>
> I recommend to revise your workflow if your initial metadata DAM do not respect
> this rules.
>
> Gilles Caulier
>
Comment 5 Veaceslav Munteanu 2014-08-08 09:14:07 UTC
Fixed in 4.2.0