lcnetdev / marc2bibframe2

Convert MARC records to BIBFRAME2 RDF
http://www.loc.gov/bibframe/
Creative Commons Zero v1.0 Universal
89 stars 35 forks source link

Invalid use of rdf:resource attribute when converting 850 field #4

Closed osma closed 7 years ago

osma commented 7 years ago

I noticed problems converting this rather minimal MARC record:

<?xml version="1.0" encoding="UTF-8"?>
<marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim">
  <marc:record>
    <marc:leader>     cam a2202161 i 4500</marc:leader>
    <marc:controlfield tag="001">000242026</marc:controlfield>
    <marc:controlfield tag="005">20170118044851.0</marc:controlfield>
    <marc:controlfield tag="008">020123s2001^^^^fi^|||||||||||000|||fin|^</marc:controlfield>
    <marc:datafield tag="040" ind1=" " ind2=" ">
      <marc:subfield code="a">FI-NL</marc:subfield>
    </marc:datafield>
    <marc:datafield tag="041" ind1="0" ind2=" ">
      <marc:subfield code="a">fin</marc:subfield>
      <marc:subfield code="b">eng</marc:subfield>
    </marc:datafield>
    <marc:datafield tag="042" ind1=" " ind2=" ">
      <marc:subfield code="a">finb</marc:subfield>
    </marc:datafield>
    <marc:datafield tag="100" ind1="1" ind2=" ">
      <marc:subfield code="a">Koski, Leena</marc:subfield>
    </marc:datafield>
    <marc:datafield tag="245" ind1="1" ind2="0">
      <marc:subfield code="a">Hyvän lapsen ja kasvattamisen ideaalit :</marc:subfield>
      <marc:subfield code="b">tutkimus aapisten ja lukukirjojen moraalisen kosmologian muutoksista itsenäisyyden aikana /</marc:subfield>
      <marc:subfield code="c">Leena Koski.</marc:subfield>
    </marc:datafield>
    <marc:datafield tag="260" ind1=" " ind2=" ">
      <marc:subfield code="a">[Turku] :</marc:subfield>
      <marc:subfield code="b">Suomen kasvatustieteellinen seura,</marc:subfield>
      <marc:subfield code="c">2001</marc:subfield>
      <marc:subfield code="f">(Painosalama)</marc:subfield>
    </marc:datafield>
    <marc:datafield tag="850" ind1=" " ind2=" ">
      <marc:subfield code="a">FI-Misos</marc:subfield>
    </marc:datafield>
  </marc:record>
</marc:collection>

The RDF resulting from the conversion contains this snippet that represents the information from the 850 field:

    <bf:hasItem>
      <bf:Item rdf:about="http://example.org/000242026#Item850-11">
        <bf:heldBy>
          <bf:Agent rdf:resource="http://id.loc.gov/vocabulary/organizations/FI-Misos"/>
        </bf:heldBy>
        <bf:itemOf rdf:resource="http://example.org/000242026#Instance"/>
      </bf:Item>
    </bf:hasItem>

When parsing the RDF using riot from the Apache Jena project, I get this error:

10:55:24 ERROR riot                 :: [line: 140, col: 89] {E201} rdf:resource not allowed as attribute here.

Similarly, when parsing the RDF using rapper from the Redland toolkit, I get this error:

rapper: Error - URI http://example.org/:140 - RDF term resource is forbidden as a property attribute.

The problem is the rdf:resource attribute on the bf:Agent element, it should be rdf:about instead.

osma commented 7 years ago

Thanks for the quick fix @kirkhess! I will close this issue since your commit message didn't do it. (I think fixes #4 or similar would have worked)

kirkhess commented 7 years ago

Thanks, although I only I pushed this to the development branch, I've been trying to try to get TravisCI to work first on development before I patch master.

The tests are pretty simple once you get xspec installed - basically xpath statements - I modified the test case for 850.

-Kirk

On Thu, Mar 16, 2017 at 12:09 PM, Osma Suominen notifications@github.com wrote:

Thanks for the quick fix @kirkhess https://github.com/kirkhess! I will close this issue since your commit message didn't do it. (I think fixes #4 or similar would have worked)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lcnetdev/marc2bibframe2/issues/4#issuecomment-287107288, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWqkrpM4oqDlhyT57UevH3zM66iC4gXks5rmV65gaJpZM4MfASy .