Task #9451

Taxonomy normalize task breaks with terms with the same name in different cultures

Added by José Raddaoui Marín over 6 years ago. Updated about 2 years ago.

Status:VerifiedStart date:02/02/2016
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:CLI tools
Target version:Release 2.3.0
Google Code Legacy ID: Tested version:2.0.0, 2.0.1, 2.1, 2.1.1, 2.1.2, 2.2, 2.3
Sponsored:No Requires documentation:

Description

If a term has the same name in more than one culture, it's interpreted as a duplication in the task. Then after "moving" the object-term relations to itself, the task tries to delete it causing an error:

$ php symfony taxonomy:normalize "Physical object type" 
Normalizing for 'en' culture...
Normalizing terms with name 'Contenedor'...
Changing object term relations to term 145 to 145.
Deleting term ID 145.

  Unable to execute DELETE statement. [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key 
constraint fails (`atom_dogwood`.`relation`, CONSTRAINT `relation_FK_4` FOREIGN KEY (`type_id`) REFERENCES `term` (`id`))] 

The culture option that can be sent to the task (defaults to 'en') is used to fetch the taxonomy, but not the terms, so terms with the same name in different cultures will also be considered duplicates and deleted.
Expected behaviour:

The culture should be used to fetch the terms too. So only duplicates with the same name in the selected culture should be deleted


Related issues

Related to Access to Memory (AtoM) - Bug #10698: Taxonomy normalize task is not merging terms correctly Verified 12/20/2016

History

#2 Updated by José Raddaoui Marín over 6 years ago

Also, the terms may be used in a lot of different places and the task only updates the 'object_term_relation' rows before deleting the term. I think we should update all places where the term can be in use, but that will be a bigger task.

#3 Updated by Dan Gillean over 6 years ago

  • Requires documentation set to Yes

I think we should clarify the behavior in the task description in the documentation after this is done. Adding a note to myself to update the docs (here: https://www.accesstomemory.org/docs/2.3/admin-manual/maintenance/cli-tools/#taxonomy-normalization)

#4 Updated by José Raddaoui Marín over 6 years ago

  • Status changed from New to Code Review
  • Assignee changed from José Raddaoui Marín to Nick Wilkinson
  • Tested version 2.0.0, 2.0.1, 2.1, 2.1.1, 2.1.2 added

Ready for code review in PR 278

#5 Updated by Nick Wilkinson over 6 years ago

  • Assignee changed from Nick Wilkinson to Jesús García Crespo

Hi Jesus, can you take a look at this for Code Review?

#6 Updated by Jesús García Crespo over 6 years ago

  • Status changed from Code Review to Feedback
  • Assignee changed from Jesús García Crespo to José Raddaoui Marín

LGTM

#7 Updated by José Raddaoui Marín over 6 years ago

  • Status changed from Feedback to QA/Review
  • Assignee changed from José Raddaoui Marín to Dan Gillean

Merged in qa/2.3.x

#8 Updated by Dan Gillean over 6 years ago

  • Status changed from QA/Review to Verified

Works.

One small thing I noticed. I tried to normalize in french for the "Accession acquisition type" taxonomy - in the FR interface, it's called "Type d'entrée". I tried it a bunch of times with different capitalization, but kept getting an error message that no such taxonomy name existed in French. Eventually I removed the accent, and it worked. Do we sanitize all the names or something?

#9 Updated by Dan Gillean over 5 years ago

  • Related to Bug #10698: Taxonomy normalize task is not merging terms correctly added

#10 Updated by Dan Gillean about 2 years ago

  • Assignee deleted (Dan Gillean)
  • Requires documentation deleted (Yes)

Also available in: Atom PDF