Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    How to setup complex data enrichments via import profiles with Drools

    Created By: Obv- alma
    Created on: 8/09/2018

    How to  setup complex data enrichments via import profiles with Drools

    Question:

    I want to enrich an existing record in Alma (primary record) with specific MARC data fields from records that are imported via import profiles, e.g. OAI (secondary record),  whenever the following two conditions apply:

    1. the field/information we are going to transfer does not already exist in the primary record
    2. the field in the secondary record contains information we want to transfer to the primary record

    Answer

    In general, we want to enrich an existing record in Alma (primary record) with specific MARC data fields from records that are imported via import profiles, e.g. OAI (secondary record),  whenever the following two conditions apply:

    1. the field/information we are going to transfer does not already exist in the primary record
    2. the field in the secondary record contains information we want to transfer to the primary record

    With the DROOLS syntax for merge rules this can be done with the following statement:

    add MARC."084" if does not exists

    But the DROOLS syntax for merge rules reaches its limit if we want to filter the fields (especially in the secondary record) depending on specific values, e. g.: add MARC 084 with $$2 rvk if MARC 084 with $$2 rvk does not already exist.

    Test 1: replace MARC."084" when MARC."084"."2" does not contain “rvk” excluding MARC."999"("0","0")

    • if MARC 084 with $$2 rvk already exists,  all MARC 084 fields in the secondary record are ignored
    • if MARC 084 with $$2 rvk does not exist in the primary record, all MARC 084 fields in the secondary record

    are added to the primary record

     

    Test 2: add MARC."084.2.rvk" if does not exists

    no syntax error (although not listed in the documentation), but no effect as well

     

    Approach:

    Import profiles allow the combination of merge rules and normalization rules (respectively normalization processes). This offers the possibility to normalize records before merging them with existing records. After the import of the records we added another normalization rule. Therefore we made use of the fact, that every record that is imported via import profiles is also subject to the default normalization process  "Marc21 Bib normalize on save". These three steps of data manipulation allow

    • to filter data fields in the secondary record
    • to  define conditions when these filtered fields are added to the primary record (or when they replace existing fields)

     

    See the following rules and processes, as they are used to enrich a record with RVK classification numbers (Regensburger Verbundklassifikation) from DNB, if MARC 084 with $$2 rvk does not already exist in the primary record:

    Note: Field 411 is only used as a temporary field; we chose this field because it's not part of the official MARC 21 scope.