Skip to content

Interacting with Metadata

Jeremy Friesen edited this page Jan 16, 2023 · 6 revisions

Rules for Interacting with Metadata

CSV Importer

Summary

  • When the column header is present and the value is present, the metadata will be updated
  • When the column header is present and the value is empty, the metadata will be deleted
  • When the column header is not present, the metadata will not be changed

Note: You can configure the Bulkrax::ObjectFactory to remove blank values. See https://github.com/samvera-labs/bulkrax/pull/708 for more details. This is considered an experimental feature allows to move from the above assumptions towards different implementations.

Breakdown

  • If a non-numerated OR numerated column is imported with a value, that value will replace any existing values

  • If a non-numerated column is imported with an empty value, it will delete all values in that property

Example
id description
abc123

Scenarios

Updating multi-value property values at a specific index

User story: Given a property that has multiple values, I want to use a Bulkrax importer to update one of the values without deleting the others.

Summary: All of the property's values must be present in the CSV, even the ones that are not being update.

# Starting point
obj.description
=> ["first", "second", "third"]
What to do
description_1 description_2 description_3
first test third

This will change description_2 from "second" to "test" without changing description_1 or description_3.

# End result
obj.description
=> ["first", "test", "third"]
What not to do
description_2
test

This will delete the values for description_1 ("first") and description_3 ("third"), leaving only "test" remaining.

# End result
obj.description
=> ["test"]

Deleting Records

In order to delete a work during a round trip it must be explicitly noted for deletion on the CVS. On the CSV add a column header entitled “delete” and mark “TRUE” in the column for any work you wish to remove from the system. The work will be deleted after the document is reimported. Any value entered into the delete column will delete the work.

image