sul-dlss / dor-services-app

A Rails application exposing Digital Object Registry functions as a RESTful HTTP API
https://sul-dlss.github.io/dor-services-app/
Other
3 stars 2 forks source link

Temporal range error #1722

Closed justinlittman closed 3 years ago

justinlittman commented 3 years ago
druid:pf870fy6521

Error: undefined method `[]' for nil:NilClass

Expected XML:
<?xml version="1.0"?>
<mods xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.loc.gov/mods/v3" version="3.5" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
      <titleInfo>
        <title>Artwork</title>
      </titleInfo>
      <name type="personal" usage="primary" authority="naf" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n84804458">
        <namePart>Johnstone, Keith</namePart>
        <role>
          <roleTerm type="code" authority="marcrelator" authorityURI="http://id.loc.gov/vocabulary/relators" valueURI="http://id.loc.gov/vocabulary/relators/art">art</roleTerm>
          <roleTerm type="text" authority="marcrelator" authorityURI="http://id.loc.gov/vocabulary/relators" valueURI="http://id.loc.gov/vocabulary/relators/art">Artist</roleTerm>
        </role>
      </name>
      <typeOfResource>text</typeOfResource>
      <genre authority="aat" authorityURI="http://vocab.getty.edu/aat" valueURI="http://vocab.getty.edu/aat/300033973">drawings</genre>
      <language>
        <languageTerm authority="iso639-2b" authorityURI="http://id.loc.gov/vocabulary/iso639-2" valueURI="http://id.loc.gov/vocabulary/iso639-2/eng" type="code">eng</languageTerm>
        <languageTerm authority="iso639-2b" authorityURI="http://id.loc.gov/vocabulary/iso639-2" valueURI="http://id.loc.gov/vocabulary/iso639-2/eng" type="text">English</languageTerm>
      </language>
      <physicalDescription>
        <extent>1 photograph</extent>
        <reformattingQuality>access</reformattingQuality>
        <digitalOrigin>reformatted digital</digitalOrigin>
        <internetMediaType>image/jpeg</internetMediaType>
      </physicalDescription>
      <subject authority="lcsh" authorityURI="http://id.loc.gov/authorities/subjects" valueURI="http://id.loc.gov/authorities/subjects/sh2002009897">authority="" authorityURI="" valueURI=""&gt;Improvisation (Acting)</subject>
    </mods>

Backtrace:
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/subject.rb:221:in `temporal_range'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/subject.rb:55:in `build_subject'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/subject.rb:33:in `block in build'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/subject.rb:33:in `map'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/subject.rb:33:in `build'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/subject.rb:22:in `build'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/descriptive_builder.rb:43:in `block in build'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/descriptive_builder.rb:42:in `each'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/descriptive_builder.rb:42:in `build'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive/descriptive_builder.rb:27:in `build'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive.rb:24:in `props'
/Users/jlittman/data/sdr/dor-services-app/app/services/cocina/from_fedora/descriptive.rb:14:in `props'
bin/validate-cocina-roundtrip:33:in `cocina_props'
bin/validate-cocina-roundtrip:83:in `validate_druid'
bin/validate-cocina-roundtrip:126:in `block in <main>'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:507:in `call_with_index'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:477:in `process_incoming_jobs'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:459:in `block in worker'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:450:in `fork'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:450:in `worker'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:441:in `block in create_workers'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:440:in `each'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:440:in `each_with_index'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:440:in `create_workers'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:380:in `work_in_processes'
/Users/jlittman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/parallel-1.20.1/lib/parallel.rb:283:in `map'
bin/validate-cocina-roundtrip:125:in `<main>'
mjgiarlo commented 3 years ago
Druid: druid:pf870fy6521

Differences 1
Original node:
<subject authority="lcsh" authorityURI="http://id.loc.gov/authorities/subjects/" valueURI="http://id.loc.gov/authorities/subjects/sh2002009897">Improvisation (Acting)</subject>
Best guess roundtripped node:
<subject authority="lcsh">
  <topic authority="lcsh" authorityURI="http://id.loc.gov/authorities/subjects/" valueURI="http://id.loc.gov/authorities/subjects/sh2002009897"/>
</subject>
Difference:
-<subject authority="lcsh" authorityURI="http://id.loc.gov/authorities/subjects/" valueURI="http://id.loc.gov/authorities/subjects/sh2002009897">Improvisation (Acting)</subject>
+<subject authority="lcsh">
+  <topic authority="lcsh" authorityURI="http://id.loc.gov/authorities/subjects/" valueURI="http://id.loc.gov/authorities/subjects/sh2002009897"/>
+</subject>
mjgiarlo commented 3 years ago
 "subject": [
    {
      "source": {
        "code": "lcsh",
        "uri": "http://id.loc.gov/authorities/subjects/"
      },
      "uri": "http://id.loc.gov/authorities/subjects/sh2002009897"
    }
  ],
mjgiarlo commented 3 years ago

I believe this was a data error, which I've remediated. Can no longer reproduce.

The original subject node had authority="" authorityURI="" valueURI=""&gt;Improvisation (Acting) as a value, which I cleaned up, and then broke this single subject w/ a text value into a subject/topic block. It now round-trips OK.