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 the capability of specifying 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 that contains information that 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 on the left (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.

    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."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, except that, in the case 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. Otherwise the primary record contains no 505.
    replace MARC."505" if exists
    removes 505 from the primary record only if it exists in the secondary record. If 505 exists in the secondary record, then the primary record now contains this 505. Otherwise the primary record retains its original 505.
    Note that this replace logic is only true when you specify a field in the replace action such as MARC."505". If you use the replace action formats below, Alma treats the replace rule as if the field is written. So, for example, if you have a 260 field in the Alma primary record, a 264 field is 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). See the Merge Rule Syntax table.
    • replace MARC.XXX excluding
    • replace MARC."8"XX
    • replace MARC."65"X

    Creating a Merge Rule

    Use the procedure described in this section to create a merge rule.
    To create a merge rule:
    1. On the MD Editor page (Resources > Cataloging > Open Metadata Editor), select the Rules tab. The Merge Rules folder appears.
      Rules_Tab_NewUI_02_TC.png
      Rules Tab
    2. Select File > New > Merge rules and enter your merge rule properties in the Normalization Rule Properties dialog box.
    3. Select 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.
      2. Enter the specific information for your merge rule. For information on the syntax to be used, see Merge Rules Syntax and Examples.
    5. 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.
      Saved_Merge_Rule_Options_NewUI_02_TC.png
      Saved Merge Rule Options
    • Unlike normalization rules, merge rules cannot be previewed.
    • The rule description, rather than its name, is what appears in Merge Method drop-down list when you want to subsequently use a merge rule in Alma.

    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.
    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 (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.

    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. 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}" Replace 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 Replace 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 Replace 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 Replace 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 Replace 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}" Replace 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}" Replace 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}" Replace 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}"("{ind1}","{ind2}") Replace 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}"("{ind1}","{ind2}") Replace 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}"("{ind1}","{ind2}") Replace 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}"("{ind1}","{ind2}") Replace 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.control."{ctrl}" Replace 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}" Replace 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}"
    • Was this article helpful?