qurator-spk / mods4pandas

Extract the MODS/ALTO metadata of a bunch of METS/ALTO files into pandas DataFrames for data analysis
Apache License 2.0
11 stars 0 forks source link

More than one instance: <mods:shelfLocator> #7

Closed mikegerber closed 2 years ago

mikegerber commented 2 years ago
/home/mike/devel/modstool-github/qurator/modstool/modstool.py:504: UserWarning: Exception in /srv/digisam_mets/PPN1683730747.xml:
More than one instance: <mods:shelfLocator xmlns:mods="http://www.loc.gov/mods/v3" xmlns:mets="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Wb 1920-1</mods:shelfLocator>
<mods:shelfLocator xmlns:mods="http://www.loc.gov/mods/v3" xmlns:mets="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Wb 1920-2</mods:shelfLocator>
  warnings.warn('Exception in {}:\n{}'.format(mets_file, e))
Traceback (most recent call last):
  File "/home/mike/devel/modstool-github/qurator/modstool/modstool.py", line 488, in process
    d = flatten(mods_to_dict(mods, raise_errors=True))
  File "/home/mike/devel/modstool-github/qurator/modstool/modstool.py", line 221, in mods_to_dict
    value['location'] = TagGroup(tag, group) \
  File "/home/mike/devel/modstool-github/qurator/modstool/modstool.py", line 69, in descend
    return _to_dict(self.is_singleton().group[0], raise_errors)
  File "/home/mike/devel/modstool-github/qurator/modstool/modstool.py", line 201, in _to_dict
    return mods_to_dict(root, raise_errors)
  File "/home/mike/devel/modstool-github/qurator/modstool/modstool.py", line 234, in mods_to_dict
    value['shelfLocator'] = TagGroup(tag, group) \
  File "/home/mike/devel/modstool-github/qurator/modstool/modstool.py", line 36, in is_singleton
    raise ValueError('More than one instance: {}'.format(self))
ValueError: More than one instance: <mods:shelfLocator xmlns:mods="http://www.loc.gov/mods/v3" xmlns:mets="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Wb 1920-1</mods:shelfLocator>
mikegerber commented 2 years ago
  1. According to DFG MODS Anwendungsprofil, this is not allowed, so it indeed warrants an error
  2. Source file also look wrong, so I forwarded the problem
mikegerber commented 2 years ago

The error should go to the warnings CSV, tho.