sul-dlss / cocina-models

Cocina repository data model (implemented in Ruby)
https://sul-dlss.github.io/cocina-models/
3 stars 0 forks source link

RWO URI dropped from subject when mapping from Cocina to MODS #541

Closed arcadiafalcone closed 1 year ago

arcadiafalcone commented 1 year ago

See https://purl.stanford.edu/bh354nc2071.mods

Desired output for MODS:

<subject>
  <name type="personal">
    <namePart>Kleinschmidt, Angeline</namePart>
    <nameIdentifier type="wikidata">https://www.wikidata.org/wiki/Q99810910</nameIdentifier>
  </name>
</subject>
lwrubel commented 1 year ago

@arcadiafalcone I understand that in this batch of records, the identifier.uri should be used for the nameIdentifier value and identifier.source.code becomes the type attribute. Is it required to have a identifier.source.code when a identifier.uri is used or is the type attribute optional? I'm looking back at #538 where it says "One of source.code, source.value, or source.uri should be required if there is identifier.value or identifier.code, but not required for identifier.uri."?

Are there other scenarios that we should transform here? I don't think we're expecting to see identifier.code for example; we're looking for identifier.value only at the moment.

ndushay commented 1 year ago

It might be good to do a comparison between the current name-identifier mapping code and the subject-name-identifier mapping code and see how they are the same and how they are different ... and decide what is desired.

For developers, the best way to express what is desired is in specs. Let us know how we can help.

ndushay commented 1 year ago

Given that so far this has only happened in one collection, and that collection has been addressed, I would say this is

whew!

arcadiafalcone commented 1 year ago

This project, and specifically the use of Wikidata URIs in this project, is the subject of a paper two SUL staff are writing. The paper doesn't have a hard deadline, but it would be good to get this done (at least to the point of the URI appearing in the MODS) sooner rather than later. I think the minimum logic to handle this use case is "if no identifier.value, use identifier.uri instead."

ndushay commented 1 year ago

@arcadiafalcone what we need to proceed here is some specs from you ... because the subject-name-identifier code is not the same as the contributor-name-identifier code, and it's unclear to us what exactly we need to change.

arcadiafalcone commented 1 year ago

There's an existing spec for it at https://github.com/sul-dlss/cocina-models/blob/06c90b69dc3183b643b236f948d658cb0966167e/spec/cocina/models/mapping/descriptive/mods/subject_name_spec.rb#L1370 which is not working in the Cocina>MODS direction. If there's another spec you need, let me know.

mjgiarlo commented 1 year ago

@arcadiafalcone @ndushay Hmmm, I may be misunderstanding. That spec looks like it's set up and not skipped, and when I run it, I see:

$ rspec spec/cocina/models/mapping/descriptive/mods/subject_name_spec.rb:1370
MODS subject name <--> cocina mappings
  Name subject with RWO identifier
    behaves like MODS cocina mapping
      when mapping from MODS (to cocina)
        mods snippet(s) produce valid MODS
        cocina hash produces valid cocina Description
        MODS maps to expected cocina
        notifier receives warning and/or error messages as specified
      when mapping to MODS (from cocina)
        cocina Description maps to expected MODS
        cocina Description maps to normalized MODS
      when mapping from roundtrip MODS (to cocina)
        roundtrip MODS maps to expected cocina
        roundtrip cocina maps to roundtrip MODS
        roundtrip cocina maps to normalized roundtrip MODS

Finished in 0.07003 seconds (files took 1.82 seconds to load)
9 examples, 0 failures

Is the data in the spec wrong or not rigged up correctly?

mjgiarlo commented 1 year ago

@arcadiafalcone I looked at this last month and had a question ☝🏻

mjgiarlo commented 1 year ago

I think we should close this until it's clear what needs fixing. Feel free to re-open then!