Add relationship type to authority record relations CSV import and export
|Assignee:||Mike Cantelon||% Done:|
|Target version:||Release 2.6.0|
|Google Code Legacy ID:||Tested version:||2.6|
In Feature #6049 we added the ability to qualify actor-to-actor relationships with relationship type terms. These terms could be paired with a converse term to allow for automatic bi-directional linking - a "is the parent of" term could be made the converse term of "is the child of" for example, so if a relationship is added saying that Bob is the parent of Alice, then viewing Alice's authority record will show the converse relation - Alice is the child of Bob.
However, at the time, support for these relationship types was not added to the authority record CSV import and export.
This enhancement will add relevant columns to the CSV import template for relations, so this information can be captured in exports, as well as included in imports.
Given: The relationship type value has been added to the authority record relations CSV import and export templates When: I import or export new authority record relationships using CSV import Then: relationship type values for each relations record will be imported or exported And: each relationship type will include a value for the converse relationship (e.g. "is a parent of" will include the converse relation "is a child of")
#7 Updated by Mike Cantelon 6 months ago
I think handling the addition of relationship terms by the CSV would likely be too complicated and, if possible, we should require that they be added before an import is done (in the web UI terms and their converse can be defined... or they can be set to be reciprocal).
I ended up, in the PR for #13286, renaming the "sourceAuthorizedFormOfName" and "targetAuthorizedFormOfName" columns to "objectAuthorizedFormOfName" and another "subjectAuthorizedFormOfName" (given that "source" and "target" don't really make sense as column names). By defining an object and a subject this means that only one form of a relation type can be used in the "relationType" column (previously named "category").
Here's a list of applicable types, excluding reciprocal types, derived from an SQL query (maybe we should add an option to the authority relationship import task to display these relationship names):
mysql> select ti.name from relation r inner join term_i18n ti on r.object_id=ti.id where r.type_id=177 and ti.culture='en' and r.object_id != r.subject_id; +-----------------------+ | name | +-----------------------+ | is the superior of | | controls | | is the owner of | | is the predecessor of | | is the parent of | | is the grandparent of | | is the provider of | +-----------------------+
Here's, as an alternative, a list of relations going in the other direction.
mysql> select ti.name from relation r inner join term_i18n ti on r.subject_id=ti.id where r.type_id=177 and ti.culture='en' and r.object_id != r.subject_id; +-----------------------+ | name | +-----------------------+ | is the subordinate of | | is controlled by | | is owned by | | is the successor of | | is the child of | | is the grandchild of | | is the client of | +-----------------------+
#8 Updated by Mike Cantelon 6 months ago
Re: the above comment... we could dynamically create a list of allowed relation types (so any types added by the user get included), including both reciprocal types and ones with converse relation types, and display that in the command "long help" (
./symfony help csv:authority-relation-import).
#9 Updated by Mike Cantelon 6 months ago
Actually relation import currently works for relationship types like "is controlled by" if you simply reverse the placement of the authority names in the "objectAuthorizedFormOfName" and "subjectAuthorizedFormOfName" columns so it works as expected. In general "objectAuthorizedFormOfName" is __ of/by "subjectAuthorizedFormOfName" works.
#11 Updated by Peter Van Garderen 6 months ago
- Status changed from New to QA/Review
- Assignee changed from Mike Cantelon to Peter Van Garderen
- Tested version 2.6 added
- Works on Vagrant Ubuntu 18.04 Bionic
- Works for both CLI (csv:authority-relation-import) and GUI import
- If a relationship already exists, it won't be overwritten by the new imported relationship. The latter will be ignored.
- If a relationship type does not already exist in AtoM, the import job will break on that CSV row with the error "Unknown relationship type ...". The rows prior to it will be imported. The rows after it will be ignored.
- The import has been successfully tested for each relationship type currently implemented in AtoM by default:
- is the associate of
- is the business partner of
- is the friend of
- is the client of
- is the provider of
- is the parent of
- is the child of
- is the sibling of
- is the cousin of
- is the grandparent of
- is the grandchild of
- is the spouse of
- is controlled by
- is owned by
- is the owner of
- is the subordinate of
- is the superior of
- is the predecessor of
- is the successor of
- Works with newly created relationship types (e.g. "is haunted by/haunts")
- The import is case-sensitive, so "Is owned by" will fail but "is owned by" will work
- The CLI CSV export task includes a Relations CSV but this does not include the Relationship Type, only the Relationship Category. Also the column names in the export are still using the older "source" and "target" label prefixes.