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

    Working with Merge Rules

    Translatable
    To work with merge rules, you must have the following role:
    • Catalog Administrator
    Merge rules provide instructions on how two records are to be merged. When merging two records, the primary record is the record that will contain all of the merged information. The secondary record is the record whose information will be merged into the primary record. Merge rules either remove information in the primary record or copy information 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.
    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. Also, see Merge Rules in the Training section for more information.

    Primary Records

    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 The existing record in Alma
    Importing records from OCLC Connexion The existing record in Alma
    Merging two already existing records The record in the left pane of the MDE (opened first)
    Copy cataloging using an external resource The external resource
    Since the primary records for importing profiles and copy cataloging (as in Searching External Resources) 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.

    Selecting merge rule in import profile.png

    When you want to use a merge rule in Alma, the rule description, rather than its name, is what appears in the Merge Method dropdown and  in the Choose Merge Routine dropdown (under Record Actions > Merge Records & Combine Inventory).

    Basic Merge Rules

    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."505"

    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, except that when using the "if exists" clause, if the secondary record does not have the indicated field, the field is not removed in the primary record. So, for example:
    replace MARC."505"
    always removes 505 from the primary record. If 505 exists in the secondary record, then the primary record now contains this 505. If 505 does not exist in the secondary record, the primary record contains no 505.
    replace MARC."505" if exists
    removes 505 from the primary record, only if 505 exists in the secondary record. If 505 exists in the secondary record, then the primary record now contains this 505. If 505 does not exist in the secondary record, the primary record retains its original 505.
    This logic is only true when you specify a field such as MARC."505" in the Replace action. If you use the Replace action formats below, Alma treats the Replace rule as if "if exists" is written. So, for example, if you have a 260 field in the Alma primary record, a 264 field in the incoming secondary record, and you are using replace MARC.XXX, Alma keeps the 260 field and adds the 264 during merge processing (as if the "if exists" is written).
    For more information see the Merge Rule Syntax table.

    Creating a Merge Rule

    Use the procedure described in this section to create a merge rule.
    For Network Zone consortia members, users can control whether to save new rules locally or in a network institution. To make this selection, open the Records or Templates area, and go to New > Placement Options. Note that this selection is per user.
    To create a merge rule:
    1. On the MD Editor page (Resources > Cataloging > Open Metadata Editor), select the Rules tab. The Merge Rules folder opens.
    2. Select New > Merge and enter your merge rule properties in the Merge Rule Properties dialog box.
      Merge rule dialog.png
    3. Indicate whether to create the rule as Private or Shared. This determines in which folder the indication rule is saved. You may want to save the rule to the Private folder and test it first, before moving it to the Shared folder (by changing the Properties). Private merge rules do not appear in the Merge Method dropdown, when you want to subsequently use a merge rule in Alma.
      Note that the Community folder has merge rules that you can copy to create your own rules.
    4. Select Save in the dialog. The MD Editor editing pane opens. 
    5. Enter your rule details.
    6. Select Save. The saved merge rules appear under the Rules tab. The saved merge rules can be edited, deleted, duplicated (to create new merge rules), and contributed to the Community Zone for sharing (see Contributing to the Community Zone - Normalization, Merge, and Indication Rules for more information). You also have the option to change the properties for saved merge rules.
    • Unlike normalization rules, merge rules cannot be previewed.

    Merge Rules Syntax and Examples

    The merge rules follow a specific syntax. See the examples below.
    While it is permissible to include multiple Boolean Operators in the rules, when a large number of Boolean operators are selected, slower performance is likely to result. Thus, each rule should include no more than 200 Boolean operators. 

    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 primary record in Alma containing basic metadata, most of which you want to replace with metadata from the secondary record. However, for the following fields, you want to keep the primary record metadata: 001, 019, 035, 59X, 9XX.
    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
    Use a merge rule such as the following for copy cataloging (see Configuring External Search Resources):
    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
    Note that in both of the above examples, when a field does not exist in the secondary record, the primary record's field is not removed. If you prefer that the primary record's fields are always removed, use remove and add rules instead of replace rules. For details, see Replace in Working with Merge Rules table. 

    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
    add MARC."{tag}" Add 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}") Add 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}"("{ind1}","{ind2}") if does not exist
    Add the field specified in the {tag} only if the field and indicators are not already present in the primary record. If the primary record does not have the field and the secondary record has two fields with the same tag and indicators, both fields are added.
    For example, the primary record does not change in the following merge scenario because the tag and indicators are already present in the primary record:
    Syntax: add MARC."600"("0","0") if does not exists
    Primary record: 600 00 $a history
    Secondary record: 600 00 $a history of Israel
    add MARC."{TAG}" excluding {ind1} "{comma separated values}" excluding {ind2} "{comma separated values}" excluding subfield ("{subfield}","{subfield value}")
    Add all unique values of the field specified in the {tag}, except for the ones with a specific value in the first indicator, a specific value in the second indicator, or a specific value in one of the subfields. All conditions have to be fulfilled in order to exclude a field. There is an implicit AND between each of them. The three conditions are not mandatory. Only one or two might exist.
    For example, there are no unique 655 field values from secondary record #1 below to add; and there are unique 655 field values from secondary record #2 below to added. Note that the syntax in the example below only uses two conditions.
    Syntax: add MARC."655" excluding second indicator "7" excluding subfield ("2","local")
    Secondary record #1: 655_7 $a Art stories. $2 local
    Secondary record #2: 655_7 $a Irish stories. $2 fast
    add MARC."{tag}" if does not exists Add 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 Add 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 Add 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}" Add 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}" Add 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}" Add 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"
    remove MARC."{prefix}"X Remove the fields prefixed by {prefix}.
    For example, the following removes all fields between 920 and 929:
    remove MARC."92"X
    remove MARC."{prefix}"XX Remove the fields prefixed by {prefix}.
    For example, the following removes all fields between 900 and 999:
    remove MARC."9"XX
    remove MARC."{tag}" Remove the field specified in the {tag}.
    For example, the following removes the 950 field:
    remove MARC."950"

    remove MARC."{TAG}" excluding "{excluded field}"("{ind1}","{ind2}")

    Remove the field specified in the {tag}, excluding the specified list of fields and indicators.

    For example, the following removes the 650 fields, except those of field 650 with first indicator 1, first indicator 0 and second indicator 1, second indicator 2, or no indicators, respectively:

    remove MARC."650" excluding "650"("1"," ") 

    remove MARC."650" excluding "650"("0","1")

    remove MARC."650" excluding "650"(" ","2")

    remove MARC."650" excluding "650"(" "," ")

    remove MARC."{TAG}" if not exists subfield "{comma separated values}"
    Remove the field specified in the {tag} from the primary record if the subfields specified (one or more) in {comma separated values} do not exist. If more than one subfield is specified, all of the subfields should exist/not exist to fulfill the condition.
    For example, the following 700 field in the primary record is removed because subfield 5 does not exist.
    Syntax: remove MARC."700" if not exists subfield "5"
    Primary record #1: 700 1_ $a Burgess, Anne.
    remove MARC."{TAG}" if exists subfield "{comma separated values}"
    Remove the field specified in the {tag} from the primary record if the subfields specified (one or more) in {comma separated values} do exist. If more than one subfield is specified, all of the subfields should exist/not exist to fulfill the condition.
    For example, the following 700 field in the primary record is removed because subfield 5 does exist.
    Syntax: remove MARC."700" if exists subfield "5"
    Primary record: 700 1_ $a Jefferson, Thomas, $d 1743-1826, $e former owner. $ 5MH
    remove MARC."{prefix}"X excluding "{list}" Remove 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}" Remove 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"
    The following removes all fields except 001, 084, 773, and 980-999.
    remove MARC."XXX" excluding "001,084,773,98X,99X"
    remove MARC."{prefix}"XX excluding "{excluded field}"("{ind1}","{ind2}") Remove the fields prefixed by{prefix}, excluding the specified list of fields and indicators.
    For example, the following removes the 6XX fields, except those of field 650 with first indicator 1, first indicator 0 and second indicator 1, second indicator 2, or no indicators, respectively:
    remove MARC."6"XX excluding "650"("1"," ")
    remove MARC."6"XX excluding "650"("0","1")
    remove MARC."6"XX excluding "650"(" ","2")
    remove MARC."6"XX excluding "650"(" "," ")
    replace MARC."{tag}" if exists Replace the content of the field specified in the {tag} only if the field exists in the secondary record. If the field does not exist in the secondary record, the field of the primary record remains.
    For example, the following replaces the 950 field in the primary record, if the field exists in the secondary record
    replace MARC."950" if exists
    replace MARC."{tag}" Replace the content of the primary record's field specified in the {tag}. If the field does not exist in the secondary record, the primary record will contains no{tag} field.
    For example, the following replaces the 950 field in the primary record:
    replace MARC."950"
    replace MARC."{prefix}"X if exists Replace the content of the fields prefixed by {prefix} if these fields exist in the secondary record. If these fields do not exist in the secondary record, the {prefix} fields of the primary record remain.
    For example, the following replaces all fields between 920 and 929 in the primary record, if these fields exist in the secondary record:
    replace MARC."92"X if exists
    replace MARC."{prefix}"X Replace the content of the primary record's fields prefixed by {prefix}. If these fields do not exist in the secondary record, the primary record will contain no {prefix} fields.
    For example, the following replaces all fields between 920 and 929 in the primary record:
    replace MARC."92"X
    replace MARC."{prefix}"XX if exists Replace the content of the primary record's fields prefixed by {prefix} if these fields exist in the secondary record. If these fields do not exist in the secondary record, the {prefix} fields of the primary record remain.
    For example, the following replaces all fields between 900 and 999 in the primary record, if these fields exist in the secondary record:
    replace MARC."9"XX if exists
    replace MARC."{prefix}"XX Replace the content of the primary record's fields prefixed by {prefix}. If these fields do not exist in the secondary record, the primary record will contain no {prefix} fields.
    For example, the following replaces all fields between 900 and 999 in the primary record:
    replace MARC."9"XX
    replace MARC."{prefix}"X excluding "{list}" Replace the content of the primary record's fields prefixed by {prefix}, excluding the specified fields.
    For example, the following replaces the content of all fields between 990 and 999 in the primary record, except that of 990 and 991. Note that if the fields do not exist in the secondary record, they are created in the primary record:
    replace MARC."99"X excluding "990,991"
    replace MARC."{prefix}"XX excluding "{list}" Replace the content of the primary record's fields prefixed by {prefix}, excluding the specified fields.
    For example, the following replaces the content of all fields between 900 and 999 in the primary record, except that of 950 and 951. Note that if the fields do not exist in the secondary record, they are created in the primary record:
    replace MARC."9"XX excluding "950,951"
    replace MARC.XXX excluding "{list}" Replace the content of all primary record's 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 in the secondary record, they are created in the primary record:
    replace MARC.XXX excluding "100,245,9XX,5XX"
    replace MARC."{prefix}"X excluding MARC."{exclTag}"("{ind1}","{ind2}") Replace the content of primary record's fields prefixed by {prefix}, excluding the specified fields and indicators.
    For example, the following replaces the content of all fields between 990 and 999 of the primary record, except for MARC field 995(0,1) with that of the secondary record. Note that MARC field 995(1,1) is replaced.
    If the fields do not exist in the secondary record, they are created in the primary record:
    replace MARC."99"X excluding MARC."995"("0","1")
    replace MARC."{prefix}"XX excluding MARC."{exclTag}"("{ind1}","{ind2}") Replace the content of primary record's fields prefixed by {prefix}, excluding the specified fields and indicators.
    For example, the following replaces the content of all fields between 900 and 999 of the primary record, except for MARC field 995(0,1) with that of the secondary record. Note that MARC field 995(1,1) is replaced.
    If the field does not exist in the secondary record, it is created in the primary record:
    replace MARC."9"XX excluding MARC."995"("0","1")
    replace MARC."{tag}" excluding MARC."{exclTag}"("{ind1}","{ind2}") Replace the primary record's field specified in the {tag}, excluding the specified fields and indicators.
    For example, the following replaces the 995 field of the primary record, except for 995(0,1) with that of the secondary record. Note that MARC field 995(1,1) is replaced.
    If the field does not exist in the secondary record, it is created in the primary record:
    replace MARC."995" excluding MARC."995"("0","1")
    replace MARC."{tag}" when MARC."{condtag}"."{condsf}" contains "{text}" excluding MARC."{exclTag}"("{ind1}","{ind2}") Replace the content of the primary record's field that contains the specified string with the secondary record that contains the specified string. If the secondary record does not have a field with the specified string, the primary record’s fields that contains the specified string is removed.

    Example:

    replace MARC."035" when MARC."035"."a" contains "OCoLC" excluding MARC."035"("9","9")

    replace MARC.XXX excluding MARC."{exclTag}"("{ind1}","{ind2}") Replace the content of all primary record's 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 in the secondary record, it is created in the primary record:
    replace MARC.XXX excluding MARC."995"("0","1")
    replace MARC.control."{ctrl}" Replace the specified primary record's 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}" Replace a specific position within the control field of the primary record. This is accomplished by specifying the position start and length.
    For example, the following replaces what is specified in the control field of the primary record starting in position 8 and for a length of 2 positions with that of the secondary record.
    replace MARC.control.position."LDR.{8,2}"
    • Was this article helpful?