Bug 325331

Summary: MySQL : when adding a new face, tag is created with a new _Digikam_root_ tag in database
Product: [Applications] digikam Reporter: e.longuemare
Component: Database-MysqlAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: 3.5.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 7.0.0

Description e.longuemare 2013-09-26 14:27:51 UTC
When adding a new face tag with tagging face tool (create ...), tag is created with a new _Digikam_root_tag in mysql database.

Moving this tag from hierarchy from _Digikam_root_tag to good hierarchy (Personnes (Faces in english ?) in french) make it disapear from Digikam interface (tag hierarchy and face hierarchy).

This should be reproduce every time from digikam 3.3 (kubuntu backport), digikam 3.4 build from tarball, digikam 3.5 build from git with mysql database.


Reproducible: Always

Steps to Reproduce:
1.start digikam and go to face recognition
2.select a picture in unknow tags (inconnus in french)
3. enter a new tag with create tag (buttons on picture)
4. digikam crash (view bug 325209 and 323361
5 restart digikam : the created tag appear with _Digikam_root_tag in hierarchy (tag list)
6 move tag (drag and drop) to (Faces/Personnes)
7 stop digikam
8 restart digikam

Actual Results:  
The tag is no more in tag list, face recognition tags hierarchy, picture is no more in unknown from face recognition tags hierarchy

The new tags are well created in recognition.db and still there after all previous stage.

Expected Results:  
New face tag is created on mysql database in good hierarchy 

view bug 283323, 230602, 315269 - that's apply to face tag now, and was solved for other tags with not reading and writing metadata to pictures, only mysql for tags storage

What hasn't be modified for face tags with mysql ?
Comment 1 e.longuemare 2013-09-26 14:46:10 UTC
A solution is to create new tag in tag list before going to face recognation. 
Create new tag(s) with name of faces to tag in tag list (left tab).
Then go to face recognation and assign created tags.
Comment 2 e.longuemare 2013-09-26 15:21:03 UTC
Digikam mysql db before moving created tag and suppress "false" "_Digikam_root_tag_" :

SELECT * FROM Tags where id=219; #ID of root tag for faces
id,pid,name,icon,iconkde,lft,rgt
'219', '0', 'Personnes', '0', NULL, '226', '265'

SELECT * FROM Tags where pid=219 order by id;
id,pid,name,icon,iconkde,lft,rgt
21,219,eric,0,NULL,852,853
36,219,charlotte,0,NULL,736,737
38,219,christelle,0,NULL,732,733
39,219,gonzague,0,NULL,730,731
46,219,chloe,0,NULL,716,717
48,219,anais,0,NULL,712,713
50,219,allan,0,NULL,708,709
52,219,simba,0,NULL,704,705
53,219,joel,0,NULL,702,703
54,219,viviane,0,NULL,700,701

SELECT * FROM Tags where name="IanGold" order by id;
id,pid,name,icon,iconkde,lft,rgt
'700', '699', 'IanGold', '0', NULL, '7', '8'

SELECT * FROM Tags where pid=699 order by id;
id,pid,name,icon,iconkde,lft,rgt
'700', '699', 'IanGold', '0', NULL, '7', '8'

SELECT * FROM Tags where id="699"
id,pid,name,icon,iconkde,lft,rgt
'699', '0', '_Digikam_root_tag_', '0', NULL, '6', '9'

SELECT * FROM Tags where name="_digikam_root_tag_" order by id;
id,pid,name,icon,iconkde,lft,rgt
'0', '-1', '_Digikam_root_tag_', '0', NULL, '5', '962'
'699', '0', '_Digikam_root_tag_', '0', NULL, '6', '9'

There is 2 _Digikam_root_tag. The new tag parent is the second "Digikam_root_tag".

Now move tag to good parent, Personne (Faces in english), suppress bad "_digikam_root_tag", stop and start digikam, then query on name "IanGolds"

SELECT * FROM Tags where name like "Ian%";
3	17:10:02	SELECT * FROM Tags where name like "Ian%" order by id LIMIT 0, 1000	0 row(s) returned

It has disapeared from mysql and digikam, nor face picture is no more in face recognation.

In recognition.db (sqlite), the tag "IanGold" is still there :
"id", "attribute", "value"
"1", "fullName", "chloe"
"1", "name", "chloe"
"1", "uuid", "{3b6d168a-ea42-4407-8b10-6fedd8fc6f67}"
"2", "fullName", "fredb"
"2", "name", "fredb"
"2", "uuid", "{c9c862e8-9c34-437b-afb5-76c021ec6fc7}"
"3", "fullName", "francoisd"
"3", "name", "francoisd"
"3", "uuid", "{b8725e4c-978c-4b3a-9535-a19acc6ec408}"
"4", "fullName", "IanGold"
"4", "name", "IanGold"
"4", "uuid", "{3110f941-5181-4947-a0e4-9149c7861c2b}"

tags disapearing before too (fredb wich was created from tag face tool). The two other ones, francoisd and chloe where created in tag list (left tab) and attribute to face pictures so they are well created in recognation.db .
Comment 3 e.longuemare 2013-09-26 15:23:05 UTC
Second bad "Digikam_root_tag_" is well suppressed from mysql :
SELECT * FROM Tags where name="_digikam_root_tag_" order by id;
id,pid,name,icon,iconkde,lft,rgt
'0', '-1', '_Digikam_root_tag_', '0', NULL, '5', '958'
Comment 4 e.longuemare 2013-09-26 15:34:08 UTC
as seen here : Bug 325309
table OpenCVLBPHistograms, OpenCVLBPHRecognizer, OpenTLDData are empty.
Comment 5 e.longuemare 2013-09-26 17:26:21 UTC
> 4. digikam crash (view bug 325209 and 323361
read bug 325309 (not 209) and bug 323361
Comment 6 caulier.gilles 2014-09-01 21:15:13 UTC

*** This bug has been marked as a duplicate of bug 283323 ***
Comment 7 caulier.gilles 2019-12-23 15:02:11 UTC
Not reproducible with 7.0.0-beta1