Feature #13279

Add relationship type to authority record relations CSV import and export

Added by Peter Van Garderen 7 months ago. Updated 4 months ago.

Status:VerifiedStart date:04/29/2020
Priority:HighDue date:
Assignee:Mike Cantelon% Done:

100%

Category:CSV import
Target version:Release 2.6.0
Google Code Legacy ID: Tested version:2.6
Sponsored:Yes Requires documentation:No

Description

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.

Feature specification

    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") 

Subtasks

Bug #13306: Problem: the relations.csv file produced by csv:authority...VerifiedPeter Van Garderen

Bug #13329: Problem: remove the unused legacyId column from relations...VerifiedPeter Van Garderen

Bug #13305: Problem: the relations.csv file produced by csv:authority...VerifiedPeter Van Garderen

Bug #13304: Problem: csv:authority-relation-import will break if a re...VerifiedPeter Van Garderen

Bug #13303: Problem: csv:authority-relation-import discontinues after...VerifiedPeter Van Garderen

Bug #13327: Problem: the relations import CSV should start with the s...VerifiedPeter Van Garderen


Related issues

Related to Access to Memory (AtoM) - Feature #13277: Add multi-value alias names to the Authority record CSV i... Verified
Related to Access to Memory (AtoM) - Feature #6049: Add converse predicates to ISAAR relationships (automatic... Verified 11/04/2013

History

#1 Updated by Peter Van Garderen 7 months ago

  • Category set to CSV import

#2 Updated by Dan Gillean 7 months ago

  • Related to Feature #13277: Add multi-value alias names to the Authority record CSV import and export template added

#3 Updated by Dan Gillean 7 months ago

  • Description updated (diff)

#5 Updated by Dan Gillean 7 months ago

  • Related to Feature #6049: Add converse predicates to ISAAR relationships (automatic bidirectional linking) added

#6 Updated by Peter Van Garderen 6 months ago

  • Description updated (diff)

#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.

#10 Updated by Mike Cantelon 6 months ago

If we need to provide an automated way of importing relationship types probably supporting this via our SKOS import, if it's not already supported (doesn't look like it is for SKOS export but it might be for import), would be the way to go.

#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

See https://github.com/artefactual/atom/commit/507780ee74b276a0a38bf439b3c00ba888c91942

QA TESTING NOTES:
  • 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:
    1. is the associate of
    2. is the business partner of
    3. is the friend of
    4. is the client of
    5. is the provider of
    6. is the parent of
    7. is the child of
    8. is the sibling of
    9. is the cousin of
    10. is the grandparent of
    11. is the grandchild of
    12. is the spouse of
    13. controls
    14. is controlled by
    15. is owned by
    16. is the owner of
    17. is the subordinate of
    18. is the superior of
    19. is the predecessor of
    20. 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.

#13 Updated by Mike Cantelon 6 months ago

Sounds good!

I'll make these fixes (should only take a few hours, if that):

  • Make unknown relationship type simply skip the row with a warning
  • Make relationship matching case insensitive
  • Fix naming of export columns

#14 Updated by Peter Van Garderen 4 months ago

Fixed.

#15 Updated by Peter Van Garderen 4 months ago

  • Status changed from QA/Review to In progress
  • Assignee changed from Peter Van Garderen to Mike Cantelon

#17 Updated by Peter Van Garderen 4 months ago

php symfony csv:authority-export /path/to/file
php symfony csv:authority-relation-import --index /path/to/file

#18 Updated by Peter Van Garderen 4 months ago

  • Requires documentation changed from Yes to No

#19 Updated by Dan Gillean 4 months ago

  • Status changed from In progress to Verified

Also available in: Atom PDF