hbz / lobid-resources

Transformation, web frontend, and API for the hbz catalog as LOD
http://lobid.org/resources
Eclipse Public License 2.0
8 stars 7 forks source link

Alma index: incorrect data in hasItem/currentLocation #1171

Closed hagbeck closed 3 years ago

hagbeck commented 3 years ago

990217478660206441 (HT019246898):

990001412590206441 (HT000161712):

In the second case the expected value for library is in the second hasItem. It seem the values are displaced.

TobiasNx commented 3 years ago

@dr0i I need these as testfile, can you help?

dr0i commented 3 years ago

@TobiasNx pushed them into https://github.com/hbz/lobid-resources/tree/1171-incorrectCurrectLocation.

TobiasNx commented 3 years ago

Thanks, okay it seems that here are different things playing together:

Because of this e.g. HT019246898 which has multiple ITM, but not all have subfields c, w or x. Then w (value W0001 of another ) was saved and passed to the next x (of the UDE item).

This can also be a reason for the missing number of items, see: #1168

I added reset and sameEntity to the internal collectors which would correct the mentioned error of @hagbeck but I still need to flush all ITMs not only those that have subfields c, w or x. So when the source entity is closed.

E.g. HT019246898 has ITM's like this, that are missing subfield c and x:

<datafield tag="ITM" ind1=" " ind2=" ">
    <subfield code="H">2275458510006447</subfield>
    <subfield code="x">91</subfield>
    <subfield code="f">BOOK</subfield>
    <subfield code="v">91</subfield>
    <subfield code="p">42</subfield>
    <subfield code="X">System</subfield>
    <subfield code="U">2018-03-26 10:59:00</subfield>
    <subfield code="Y">2020-12-03 10:15:16</subfield>
    <subfield code="h">false</subfield>
    <subfield code="n">WTA2690+12</subfield>
    <subfield code="M">49HBZ_WUP</subfield>
    <subfield code="s">1</subfield>
    <subfield code="d">#</subfield>
    <subfield code="V">import</subfield>
    <subfield code="b">W00268176</subfield>
    <subfield code="a">2375458450006447</subfield>
    <subfield code="t">8</subfield>
    <subfield code="R">Maintenance count: 001</subfield>
    <subfield code="S">M2018-1738</subfield>
    <subfield code="B">G2018/323</subfield>
    <subfield code="D">20180326</subfield>
    <subfield code="W">2020-11-19 11:41:21</subfield>
    <subfield code="u">W0001</subfield>
    <subfield code="w">W0001</subfield>
  </datafield>
TobiasNx commented 3 years ago

Following seems to be a structural problem of entity-transformation:

If we want to create an array with different objects, here ITM and want to flush them. Swiss-Bib documentation says that entity is reseted if flushed, but without sameEntity ="true" the entity is flushed in one single object.

    <!-- ITM -->
    <entity name="" flushWith="H52  .a|HOL  .a|GST  .a|GTI  .a|GTK  .a" >
      <combine name="id" value="https://lobid.org/item/${i}"  reset="true">
        <data name="i" source="ITM  .a"/>
      </combine>
      <entity name="type[]" reset="true">
        <data name="" source="ITM  .a">
          <constant value="Item"/>
        </data>
      </entity>
      <data name="label" source="ITM  .a">
        <constant value="lobid Bestandsressource"/>
      </data>
      <entity name="heldBy" reset="true">
        <data name="id" source="ITM  .a">
          <regexp match=".*(\d{4})$" format="${1}"/>
          <lookup in="alma-institution-code-to-isil" />
          <compose prefix="http://lobid.org/organisations/" postfix="#!"/>
        </data>
        <data name="label" source="ITM  .a">
          <constant value="lobid Organisation"/>
        </data>
      </entity>
      <data name="callNumber" source="ITM  .c" />
      <combine name="currentLocation" value="${a} / ${b}" reset="true">
        <data name="a" source="ITM  .w"/>
        <data name="b" source="ITM  .x"/>
      </combine>      
    </entity>

this results in:

""hasItem" : [ {
    "id" : "https://lobid.org/item/2375458490006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 91",
    "id" : "https://lobid.org/item/2375458470006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 91",
    "id" : "https://lobid.org/item/2375458480006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 91",
    "id" : "https://lobid.org/item/2375458460006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 91",
    "id" : "https://lobid.org/item/2375458530006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 21",
    "id" : "https://lobid.org/item/2375458520006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 21",
    "id" : "https://lobid.org/item/2375458550006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 20",
    "id" : "https://lobid.org/item/2375458500006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 91",
    "id" : "https://lobid.org/item/2375458400006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },
    "currentLocation" : "W0001 / 91",
    "id" : "https://lobid.org/item/2375458410006447",
    "type" : [ "Item" ],
    "label" : "lobid Bestandsressource",
    "heldBy" : {
      "id" : "http://lobid.org/organisations/DE-468#!",
      "label" : "lobid Organisation"
    },"
 ........

It seems that there is no reset processed.

If sameEntity="true" is also included there is no output.

I have a feeling that the reset is not working at the level of a complex entity.

https://swissbib.gitlab.io/metamorph-doku/collectors/ausgabesteuerung/

dr0i commented 3 years ago

Deployed. Closing.