Skip to main content
ExLibris
  • Subscribe by RSS
  • ExLibris Dev

    Working with Merge Rules

    Translatable
    To work with merge rules, you must have the following role:
    • Catalog Administrator
    The MD Editor enables catalogers to create merge rules and apply them to MARC 21 records, or apply merge rules that have already been created. The syntax to be used for the rules is described in Merge Rules - Syntax and Examples.
    When merging two records, the primary record is the record that will contain all of the merged information. The secondary record is the record that contains information that will be merged into the primary record.
    Merge rules either remove lines in the primary record or copy lines from the secondary record to the primary record. Merge rules do not affect the secondary record, which may remain after the merge (although it is typically deleted).
    There are several possible scenarios for merging records. The primary record in each of these scenarios is as follows:
    Primary Record for Merging
    Scenario Primary Record
    Importing records using a profile

    (see Importing Records Using Profiles)
    The existing record in Alma
    Importing records from OCLC Connexion

    (see Importing Records from OCLC Connexion)
    The existing record in Alma
    Merging two already existing records

    (see Merging Bibliographic Records)
    The record on the left (opened first)
    Copy cataloging using an external resource

    (see Searching External Resources)
    The external resource
    Because the primary records for importing profiles and copy cataloging are essentially the opposite, a merge rule written for an import profile cannot work for copy cataloging (and vice versa). You require two sets of merge rules—one for import profiles and another for copy cataloging. An example of each type of rule can be found in Examples of Rules for Import Profiles and Copy Cataloging.
    The following are the basic merge rules. Each basic rule can be applied unconditionally or may be subject to a condition on the primary record. The order in which the rules are applied is important.
    Basic Merge Rules
    Merge Rule Example Description
    remove remove MARC.”035” Remove all lines with this field from the primary record
    add add MARC.”035” Add all lines with this field from the secondary record to the primary record.
    replace replace MARC.”035” Remove all lines with this field from the primary record and then add all lines with this field from the secondary record to the primary record.

    A replace produces exactly the same result as a remove followed by an add.
    To create a merge rule:
    1. On the MD Editor page (Resource Management > Cataloging > Open Metadata Editor), click the Rules tab. The Merge Rules folder is displayed.
      Rules Tab
    2. Select File > New > Merge rules and enter your merge rule properties in the Normalization Rule Properties dialog box.
      Merge Rule Properties
    3. Click Save. The rules editor opens.
    4. Enter your rule details.
      1. Select Edit > Add Rule > Merge Snippet custom rule. This provides an initial template for entering your merge rule.
        Merge Snippet Custom Rule
      2. Enter the specific information for your merge rule. For information on the syntax to be used, see Merge Rules - Syntax and Examples.
    5. Click Save. The saved merge rules display in the Rules tab.
      Saved Merge Rules


      The saved merge rules can be edited, deleted, and duplicated (to create new merge rules).
      Saved Merge Rule Options
    Unlike normalization rules, merge rules cannot be previewed.

    Merge Rules - Syntax and Examples

    The merge rules follow a specific syntax. See the examples below.

    Examples of Rules for Import Profiles and Copy Cataloging

    Below are examples of merge rules that can be used in a scenario such as the following: You have a record in Alma containing basic metadata, most of which you want to replace with metadata from the incoming record. However, for the following fields, you want to keep the local record metadata: 001, 019, 035, 59X, 9XX.
    You would use a merge rule such as the following for import profiles:
    rule "Replace all fields except local data and match keys"
    when
    merge
    then
    replace MARC.XXX excluding "001,019,035,59X,9XX"
    end
    You would use a merge rule such as the following for copy cataloging:
    rule "Replace all fields except local data and match keys"
    when
    merge
    then
    replace MARC."001"
    replace MARC."035"
    replace MARC."019"
    replace MARC."59"X
    replace MARC."9"XX
    end

    Rule Syntax

    Conditions and actions apply to record elements, such as the MARC record, fields (one or more), indicators, subfields (one or more), and field/subfield contents.
    Conditions apply to the primary record elements. To apply an action to a record element, the element must match the syntax in the table below.
    Merge Rule Syntax
    Expression Meaning
    remove MARC."{prefix}"X Removes the fields prefixed by {prefix}.

    For example, the following removes all fields between 920 and 929:

    remove MARC."92"X
    remove MARC."{prefix}"XX Removes the fields prefixed by {prefix}.

    For example, the following removes all fields between 900 and 999:

    remove MARC."9"XX
    remove MARC."{tag}" Removes the field specified in the {tag}.

    For example, the following removes the 950 field:

    remove MARC."950"
    remove MARC."{prefix}"X excluding "{list}" Removes the fields prefixed by {prefix}, excluding the specified list of fields.

    For example, the following removes all fields between 990 and 999, except 990 and 991:

    remove MARC."99"X excluding "990,991"
    remove MARC."{prefix}"XX excluding "{list}" Removes the fields prefixed by{prefix}, excluding the specified list of fields.

    For example, the following removes all fields between 900 and 999, except 950 and 951:

    remove MARC."9"XX excluding "950,951"
    replace MARC."{tag}" if exists Replaces the content of the field specified in the {tag} only if the field exists. If the field does not exist, it is not added.

    For example, the following replaces the 950 field, if the field exists:

    replace MARC."950" if exists
    replace MARC."{tag}" Replaces the content of the field specified in the {tag}. If the field does not exist, it is added.

    For example, the following replaces the 950 field:

    replace MARC."950"
    replace MARC."{prefix}"X if exists Replaces the content of the fields prefixed by {prefix} if these fields exist. If these fields do not exist, they are not added.

    For example, the following replaces all fields between 920 and 929, if these fields exist:

    replace MARC."92"X if exists
    replace MARC."{prefix}"X Replaces the content of the fields prefixed by {prefix}. If these fields do not exist, they are added.

    For example, the following replaces all fields between 920 and 929:

    replace MARC."92"X
    replace MARC."{prefix}"XX if exists Replaces the content of the fields prefixed by {prefix} if these fields exist. If these fields do not exist, they are not added.

    For example, the following replaces all fields between 900 and 999, if these fields exist:

    replace MARC."9"XX if exists
    replace MARC."{prefix}"XX Replaces the content of the fields prefixed by {prefix}. If these fields do not exist, they are added.

    For example, the following replaces all fields between 900 and 999:

    replace MARC."9"XX
    replace MARC."{prefix}"X excluding "{list}" Replaces the content of the fields prefixed by {prefix}, excluding the specified fields.

    For example, the following replaces the content of all fields between 990 and 999, except that of 990 and 991. Note that if the fields do not exist, they are created:

    replace MARC."99"X excluding "990,991"
    replace MARC."{prefix}"XX excluding "{list}" Replaces the content of the fields prefixed by {prefix}, excluding the specified fields.

    For example, the following replaces the content of all fields between 900 and 999, except that of 950 and 951. Note that if the fields do not exist, they are created:

    replace MARC."9"XX excluding "950,951"
    replace MARC.XXX excluding "{list}" Replaces the content of all MARC fields, excluding the specified fields.

    For example, the following replaces the content of all fields in the primary record with that of the secondary record, except for the specified fields. Note that if the fields do not exist, they are created:

    replace MARC.XXX excluding "100,245,9XX,5XX"
    replace MARC."{prefix}"X excluding MARC."{exclTag}"("{exclInd1}","{exclInd2}") Replaces the content of fields prefixed by {prefix}, excluding the specified fields and indicators.

    For example, the following replaces the content of all fields between 990 and 999, except for MARC field 995(0,1). Note that MARC field 995(1,1) is replaced.

    If the fields do not exist, they are created:

    replace MARC."99"X excluding MARC."995"("0","1")
    replace MARC."{prefix}"XX excluding MARC."{exclTag}"("{exclInd1}","{exclInd2}") Replaces the content of fields prefixed by {prefix}, excluding the specified fields and indicators.

    For example, the following replaces the content of all fields between 900 and 999, except for MARC field 995(0,1). Note that MARC field 995(1,1) is replaced.

    If the fields do not exist, they are created:

    replace MARC."9"XX excluding MARC."995"("0","1")
    replace MARC."{tag}" excluding MARC."{exclTag}"("{exclInd1}","{exclInd2}") Replaces the field specified in the {tag}, excluding the specified fields and indicators.

    For example, the following replaces the 995 field, except for 995(0,1). Note that MARC field 995(1,1) is replaced.

    If the field does not exist, it is created:

    replace MARC."995" excluding MARC."995"("0","1")
    replace MARC.XXX excluding MARC."{exclTag}"("{exclInd1}","{exclInd2}") Replaces the content of all MARC fields, excluding the specified fields and indicators.

    For example, the following replaces the content of all fields in the primary record with that of the secondary record, except for 995(0,1). Note that MARC field 995(1,1) is replaced.

    If the field does not exist, it is created:

    replace MARC.XXX excluding MARC."995"("0","1")
    replace MARC."{tag}" when MARC."{condtag}"."{condsf}" does not contain "{condstring}" excluding MARC."{exclTag}"("{exclInd1}","{exclInd2}") Replaces the field specified in the {tag} when the stipulated field/subfield does not contain the specified string, except in the case of the stipulated field and indicators.

    For example, the following replaces the 995 field when 995a does not contain the text “history.” 995(0,1) is not replaced, but 995(1,1) is replaced.

    If the field does not exist, it is created:

    replace MARC."995" when MARC."995"."a" does not contain "history" excluding MARC."995"("0","1")
    replace MARC.control."{ctrl}" Replaces the specified MARC control field.

    For example, the following replaces the content of the MARC 008 control field in the primary record with that of the secondary record.

    If the field does not exist, it is created:

    replace MARC.control."008"
    replace MARC.control.position."LDR.{starting position,length}"
    New for May!
    Replaces a specific position within the control field. This is accomplished by specifying the position start and length.
    For example, the following replaces what is specified in the control field starting in position 8 and for a length of 2 positions.
    replace MARC.control.position."LDR.{8,2}"
    add MARC."{tag}" Adds the content of the field specified in the {tag}.

    For example, the following adds the content of the 950 field:

    add MARC."950"
    add MARC."{tag}"("{ind1}","{ind2}") Adds the content of the field specified in the {tag}, as well as the stipulated indicators.

    For example, the following adds the content of the 950 field, with indicators 0 and 1:

    add MARC."950"("0","1")
    add MARC."{tag}" if does not exists Adds the content of the field specified in the {tag} if this field does not already exist.

    For example, the following adds the 950 field if this field does not already exist:

    add MARC."950" if does not exists
    add MARC."{prefix}"X Adds the content of the fields prefixed by {prefix}.

    For example, the following adds the content of all fields between 920 and 929:

    add MARC."92"X
    add MARC."{prefix}"XX Adds the content of the fields prefixed by {prefix}.

    For example, the following adds the content of all fields between 900 and 999:

    add MARC."9"XX
    add MARC."{prefix}"X excluding "{list}" Adds the content of the fields prefixed by {prefix}, excluding the specified fields and subfields.

    For example, the following adds the content of all fields between 990 and 999, except that of 990 and 991:

    add MARC."99"X excluding "990,991"
    add MARC."{prefix}"XX excluding "{list}" Adds the content of the fields prefixed by {prefix}, excluding the specified fields and subfields.

    For example, the following adds the content of all fields between 900 and 999, except that of 950 and 951:

    add MARC."9"XX excluding "950,951"
    add MARC."{tag}" when MARC."{condtag}"."{condsf}" contains "{condstring}" Adds the field specified in the {tag} when the stipulated field/subfield contains the specified string.

    For example, the following adds the 950 tag only if the 250.a field contains the text "history."

    add MARC."950" when MARC."250"."a" contains "history"
    • Was this article helpful?