Tag is not saved to xmp sidecar and also not to the image file

Elle Stone ellestone at ninedegreesbelow.com
Sat Oct 21 21:46:02 BST 2017

On 10/21/2017 02:19 PM, Elle Stone wrote:
> On 10/21/2017 12:23 PM, Elle Stone wrote:
>> 1. Rearrange the tag tree . . .
>> 2. Successfully saving the tagslist to a sidecar file or to the image 
>> file . . .
>> 3. Be able to close and open digiKam and see the same tag tree that 
>> was displayed before closing digiKam?
> Perhaps this terminal output from moving a portion of the tag tree might 
> be relevant:
> digikam.general: Delete Shortcut assigned to tag  56
> digikam.dbengine: Failure executing query:
>   "UPDATE Tags SET pid=? WHERE id=?;"
> Error messages: "Unable to fetch row" "UNIQUE constraint failed: 
> TagsTree.id, TagsTree.pid" 19 1
> Bound values:  (QVariant(int, 81), QVariant(int, 56))

In case anyone else tries to rearrange tags and tag hierarchies that 
somehow were split, start digiKam from the command line and monitor for 
the above lines. If you see "UNIQUE constraint failed" then whatever 
rearranging that you just did, didn't actually get done.

The solution seems to be to rename the affected tags (perhaps append "2" 
or "a" or whatever), on all levels of the misplaced tag tree. And then 
only move the lowest level tags, if necessary to a newly created tag 
that can later be reconsolidated with an existing tag.

If the tag hierarchies were split "cleanly" - no overlap of subtags - 
then I think it's possible to move an entire tag "branch" at once.

It's important to disable all writing to the image files and sidecar 
files before rearranging, same as back in 2012: 

When finally writing everything back to the image and sidecar files, I 
only allowed digiKam to write the "tagslist" metadata. This is a very 
nice feature that wasn't available back in 2012.

By default digiKam writes a lot of tags for compatibility with other 
programs, and the first time I tried to write the newly rearranged tags 
to the image files, and then closed and reopened digiKam, digiKam pulled 
a lot of extra non-hierarchical tags that it just wrote, right into the 
database as "new tags", making a worse mess than what I started with. 
Fortunately I had a backup of the image files . . .

Before doing anything, I used exiftool to remove *all* tags-related 
metadata from the image files, except for the "tagslist" xmp metadata

It should not be such hard work to rearrange tag hierarchies.


More information about the Digikam-users mailing list