Tech Blog

Alma Normalization Rule Examples

see also:
Working with normalization rules on the Ex Libris Knowledge Center and Normalization Rule Examples from Hanoch Roniger of Hebrew University.

  • Note 1:  If you do copy/paste here make sure the quotation marks transfer correctly.
  • Note 2: Some of the examples use “priority” and some use “salience”.  The “priority” and the “salience” work the same way.
  • When there is a priority or a salience the the higher priority or salience occurs first. 2 occurs before 1 and 10 occurs before 9

Remove duplicate 610, 630 and 650 fields

BeforeAfter
rule "remove duplicate 610 630 and 650 fields"
    when
        (TRUE)
    then
        correctDuplicateFields "610,630,650"
end

Copy 035 subfield a to 001 if 035 starts with (DE-605)

rule "Copy 035 subfield a to 001 if 035 starts with (DE-605)"
when
(TRUE)
then
removeControlField "001"
 copyField "035.a" to "YLK.a" if (exists "035.a.(DE-605)*")
 copyControlField "YLK.a" to "001"
 removeField "YLK"
end

Delete the period at the end of 690 subfield a when the text of 690 a is “Variable content”

rule "Remove the period at end of 690 a when text is Variable content "
        when
        true
         then
                      replaceContents "690.a.." with "" if (exists "690.a.Variable content.")
    end

Delete the 007 field if it begins with ‘c’

rule "remove 007 if it starts with c"
when
(TRUE)
then
removeControlField "007" if (existsControl "007.{0,1}.c")
end

Delete the 007 field if it begins with ‘c’ and there is also another 007 beginning with a different letter.

rule "remove 007 if it starts with c and there is another 007 beginning with a different letter"
when
(existsControl "007.{0,1}.a") OR  (existsControl "007.{0,1}.d") OR (existsControl "007.{0,1}.f") OR   (existsControl "007.{0,1}.g") OR (existsControl "007.{0,1}.h")  OR (existsControl "007.{0,1}.k") OR (existsControl "007.{0,1}.m") OR  (existsControl "007.{0,1}.o") OR (existsControl "007.{0,1}.q") OR   (existsControl "007.{0,1}.r") OR (existsControl "007.{0,1}.s")  OR (existsControl "007.{0,1}.t") OR   (existsControl "007.{0,1}.v") OR (existsControl "007.{0,1}.z")   
then
removeControlField "007" if (existsControl "007.{0,1}.c")
end

Deal with 955 and 954 when publishing to Rapid

(If both 955 and 954 exist then delete the 955.  If 955 exists and 954 does not exist then change the 955 to 954)

rule "if there is a 954 and a 955 then delete the 955"
when 
(exists "954.a.*" ) AND (exists "955.a.*" )
then
removeField "955"
end

rule "change 955 to 954 if there is a 955 and there is not a 954"
when 
(not exists "954.a.*" ) AND (exists "955.a.*" )
then
changeField "955" to "954" 
end

If 852 subfield z has text Workflow: Paper-to-PDF then delete 852 subfield z and add 907 subfield a with text Paper-to-PDF

rule "If 852 subfield z has text Workflow: Paper-to-PDF then delete 852 subfield z and add 907 subfield a with text Paper-to-PDF "
when
    (exists "852.z.*Workflow: Paper-to-PDF*")
then
    removeSubField "852.z" if (exists "852.z.*Workflow: Paper-to-PDF*")
    addField "907.a.Paper-to-PDF"
end

Move anything after the forward slash in 250 subfield a to 250 subfield b – option one

First change the “/” to ” separator_slash”

Then split subfield a into two subfield a occurrences and split it at text ” separator_slash”

Then change the second subfield a to subfield b

rule "change the slash in 250 a to text separator slash with space before separator" 
priority 3
when
(exists "250.a" ) and (not exists "250.b.*")
then
replaceContents "250.*./" with " separator_slash"
end


rule "split subfield a into two subfield a occurrences and split it where the text separator_slash appears" 
priority 2
when
(exists "250.a" ) and (not exists "250.b.*")
then
splitSubField "250.a.separator_slash"
end


rule "change duplicate subfield"
priority 1
when
(exists "250.a" ) and (not exists "250.b.*")
then
changeSubFieldExceptFirst "250.a" to "b"
end
BeforeAfter

Move anything after the forward slash in 250 subfield a to 250 subfield b – option two

Note that this rule “Move anything after the forward slash in 250 subfield a to 250 subfield b – option two” can be used in the metadata editor but not in a normalization process because it contains a dollar sign.

To run this in a  normalization process use “Move anything after the forward slash in 250 subfield a to 250 subfield b – option one

First change the / to /$_separator_$b

Then change /$_separator_$b to $$b by changing _separator_ to nothing.

rule "move anything after the forward slash in 250 subfield a to 250 subfield b" 
when 
(exists "250.a" ) 
then
replaceContents "250.*./" with "/$_separator_$b"
replaceContents "250.*._separator_" with ""
end
In:

250__ $$a 2nd ed./ edited by Antigonus Ish Socho

Out:

250__ $$a 2nd ed./ $$b edited by Antigonus Ish Socho

Remove the last comma in 500 subfield a and do not touch the other commas

(it uses a temporary string with the comma by attaching a suffix to the end and removing the comma and suffix, then removing all other cases of the temporary suffix)

rule "one replace comma at end of 500 a with nothing"
priority 10
    when
         (TRUE)
     then
            suffix "500.a" with "temporary_suffix_to_replace"
end
rule "two replace comma at end of 500 a with nothing"
priority 9
    when
         (TRUE)
     then
            replaceContents "500.a.,temporary_suffix_to_replace" with ""
end
rule "three replace comma at end of 500 a with nothing"
priority 8
    when
         (TRUE)
     then
            replaceContents "500.a.temporary_suffix_to_replace" with ""
end
In:
Out:

Add 202B right to left embedding unicode character to 245 subfield a if it is not already there

rule "add 202B right to left embedding unicode character to 245 subfield a if it is not already there"
when
    TRUE
then
    prefix "245.a" with "u202B" if (not exists "245.a.u202B*")
end
BeforeAfter

Change all 519 fields to 919 then delete duplicate 919 fields

rule "change field 519 to 919"
# the higher priority occurs first.  2 before 1
priority 10
when
(true) 
then
changeField "519" to "919" 
end

rule "remove duplicate 919 fields"
priority 9
when
(TRUE) 
then
correctDuplicateFields "919"
end
BeforeAfter

Fix punctuation in field 245

Note: This rule has three different cases depending on the presence of subfields a, b and c in the 245.

  • If a and b and c are present then subfield a gets a : (colon) at the end it does not already have one and subfield b gets a forward slash (/) at the end if it does not already have one
  • If only a and b are present then subfield a gets a : (colon) at the end if it does not already have one
  • If only a and c are present then subfield a gets a forward slash (/) at the end if it does not already have one

Example 1:

In:     

Out:  

Example 2:

In:    

Out: 

Example 3:

In:    

Out: 

rule "fix 245 when it has sub-fields a and b and c"
# example of what this will do:
# change this:
# 24500 |a Rethinking the French classroom |b new approaches to teaching contemporary French and francophone women |c edited by E. Nicole Meyer and Joyce Johnston.
# to this:
# 24500 |a Rethinking the French classroom : |b new approaches to teaching contemporary French and francophone women / |c edited by E. Nicole Meyer and Joyce Johnston.

when 
(exists "245.a.*" ) and (exists "245.b.*") and (exists "245.c.*") 
then
suffix "245.a" with " :" if (not exists "245.a.*:")
suffix "245.b" with " /" if (not exists "245.b.*/")
end

rule "fix 245 when it has sub-fields a and c"
# example of what this will do:
# change this: 
# 24500 |a French women and the Age of Enlightenment |c edited by Samia I. Spencer.
# to this: 
# 24500 |a French women and the Age of Enlightenment / |c edited by Samia I. Spencer.
when 
(exists "245.a.*" ) and (not exists "245.b.*") and (exists "245.c.*") 
then
suffix "245.a" with " /" if (not exists "245.a.*/")
end

rule "fix 245 when it has sub-fields a and b"
# example of what this will do:
# change this: 
# 24510 |a Daughters of 1968 |b redefining French feminism and the women's liberation movement
# to this: 
# 24510 |a Daughters of 1968 : |b redefining French feminism and the women's liberation movement
when 
(exists "245.a.*" ) and (exists "245.b.*") and (not exists "245.c.*") 
then
suffix "245.a" with " :" if (not exists "245.a.*:")
end

Add a period to the end of 500 subfield a if it is not already there

rule "Add a period to the end of field 500 subfield a if there is not already a period at the end" 
when 
(TRUE) 
then 
suffix "500.a" with "." if (not exists "500.a.*.") 
end

Copy the value of the 008 language code to 041 subfield a in a hard-coded manner

rule "copy 008 language code to 041 if 041 does not exist for French"
when
(existsControl "008.{35,3}.fre") AND (not exists "041.a.*" )
then
addField "041.a.fre" 
end

rule "copy 008 language code to 041 if 041 does not exist for German"
when
(existsControl "008.{35,3}.ger") AND (not exists "041.a.*" )
then
addField "041.a.ger"
end

rule "copy 008 language code to 041 if 041 does not exist for Latin"
when
(existsControl "008.{35,3}.lat") AND (not exists "041.a.*" )
then
addField "041.a.lat"
end

rule "copy 008 language code to 041 if 041 does not exist for Hebrew"
when
(existsControl "008.{35,3}.heb") AND (not exists "041.a.*" )
then
addField "041.a.heb" 
end

Copy the value of the 008 language code to 041 subfield a in a not hard-coded manner

rule "copy 008 language code to 041 if 041 does not exist"
when
# Make sure 009 does not already exist so it will not be overwritten
(not existsControl "009") AND (not exists "041.a")
then
# copy the 008 to 009
copyControlField "008" to "009"
# remove the characters before the language code
replaceControlContents "009.{0,35}" with " "
# remove the characters after the language code
replaceControlContents "009.{4,2}" with " "
# Now you have just the language code so copy it to 041 subfield a
copyField "009" to "041.a"
# remove the temporary field
removeControlField "009"
end

Copy the value of 008 pos. 7-10 year to the 260 or 264 subfield c in a not hard-coded manner

rule "If 009 does not exist then copy the 008 to 009 and make it only year"
salience 100
when
# Make sure 009 does not already exist so it will not be overwritten
  (not existsControl "009" AND not exists "260.c" AND not exists "264.c" )
then
# copy the 008 to 009
  copyControlField "008" to "009"
# remove the characters before the language code
  replaceControlContents "009.{0,7}" with " "
# remove the characters after the language code
  replaceControlContents "009.{5,29}" with " "
# Now you have just the language code in 009
end
#
rule "copy 009 date to 264 if 264 is in use"
salience 90
when 
(exists "264.a.*" )
then
copyField "009" to "264.c"
combineFields "264" excluding ""
end
#
rule "copy 009 date to 260 if 260 is in use"
salience 80
when 
(exists "260.a.*" ) and (not exists "264.a.*") 
then
copyField "009" to "260.c"
combineFields "260" excluding ""
end
#
rule "remove the temporary field"
salience 70
when 
TRUE
then
removeControlField "009"
end

Remove all 650 fields which have 2nd indicator 7

rule "remove 650 if 2nd indicator 7"
when
(TRUE)
then
removeField "650" if (exists "650.{*,7}")
end

Replace “HEB” with “heb” in 041 subfield a

rule "replace 041 a HEB with 041 a heb" 
when 
(TRUE) 
then 
replaceContents "041.a.HEB" with "heb" if (exists "041.{*,*}.a.HEB")
end

Remove all 650 fields which have 2nd indicator 0

rule "remove 650 if 2nd indicator 0"
when
(TRUE)
then
removeField "650" if (exists "650.{*,0}")
end

Remove all 6XX fields which do not have a 2nd indicator 0 or 7

rule "remove 6XX if 2nd indicator is not 7 or 0"
    when
    (TRUE)
    then
    removeField "600" if (exists "600.{*,1}.a.*")
    removeField "600" if (exists "600.{*,2}.a.*")
    removeField "600" if (exists "600.{*,3}.a.*")
    removeField "600" if (exists "600.{*,4}.a.*")
    removeField "600" if (exists "600.{*,5}.a.*")
    removeField "600" if (exists "600.{*,6}.a.*")
    removeField "600" if (exists "600.{*,8}.a.*")
    removeField "600" if (exists "600.{*,9}.a.*")
    removeField "600" if (exists "600.{*, }.a.*")
  
    removeField "610" if (exists "610.{*,1}.a.*")
    removeField "610" if (exists "610.{*,2}.a.*")
    removeField "610" if (exists "610.{*,3}.a.*")
    removeField "610" if (exists "610.{*,4}.a.*")
    removeField "610" if (exists "610.{*,5}.a.*")
    removeField "610" if (exists "610.{*,6}.a.*")
    removeField "610" if (exists "610.{*,8}.a.*")
    removeField "610" if (exists "610.{*,9}.a.*")
    removeField "610" if (exists "610.{*, }.a.*")
  
    removeField "611" if (exists "611.{*,1}.a.*")
    removeField "611" if (exists "611.{*,2}.a.*")
    removeField "611" if (exists "611.{*,3}.a.*")
    removeField "611" if (exists "611.{*,4}.a.*")
    removeField "611" if (exists "611.{*,5}.a.*")
    removeField "611" if (exists "611.{*,6}.a.*")
    removeField "611" if (exists "611.{*,8}.a.*")
    removeField "611" if (exists "611.{*,9}.a.*")
    removeField "611" if (exists "611.{*, }.a.*")
  
    removeField "630" if (exists "630.{*,1}.a.*")
    removeField "630" if (exists "630.{*,2}.a.*")
    removeField "630" if (exists "630.{*,3}.a.*")
    removeField "630" if (exists "630.{*,4}.a.*")
    removeField "630" if (exists "630.{*,5}.a.*")
    removeField "630" if (exists "630.{*,6}.a.*")
    removeField "630" if (exists "630.{*,8}.a.*")
    removeField "630" if (exists "630.{*,9}.a.*")
    removeField "630" if (exists "630.{*, }.a.*")
  
    removeField "647" if (exists "647.{*,1}.a.*")
    removeField "647" if (exists "647.{*,2}.a.*")
    removeField "647" if (exists "647.{*,3}.a.*")
    removeField "647" if (exists "647.{*,4}.a.*")
    removeField "647" if (exists "647.{*,5}.a.*")
    removeField "647" if (exists "647.{*,6}.a.*")
    removeField "647" if (exists "647.{*,8}.a.*")
    removeField "647" if (exists "647.{*,9}.a.*")
    removeField "647" if (exists "647.{*, }.a.*")
  
    removeField "648" if (exists "648.{*,1}.a.*")
    removeField "648" if (exists "648.{*,2}.a.*")
    removeField "648" if (exists "648.{*,3}.a.*")
    removeField "648" if (exists "648.{*,4}.a.*")
    removeField "648" if (exists "648.{*,5}.a.*")
    removeField "648" if (exists "648.{*,6}.a.*")
    removeField "648" if (exists "648.{*,8}.a.*")
    removeField "648" if (exists "648.{*,9}.a.*")
    removeField "648" if (exists "648.{*, }.a.*")

    removeField "650" if (exists "650.{*,1}.a.*")
    removeField "650" if (exists "650.{*,2}.a.*")
    removeField "650" if (exists "650.{*,3}.a.*")
    removeField "650" if (exists "650.{*,4}.a.*")
    removeField "650" if (exists "650.{*,5}.a.*")
    removeField "650" if (exists "650.{*,6}.a.*")
    removeField "650" if (exists "650.{*,8}.a.*")
    removeField "650" if (exists "650.{*,9}.a.*")
    removeField "650" if (exists "650.{*, }.a.*")
  
    removeField "651" if (exists "651.{*,1}.a.*")
    removeField "651" if (exists "651.{*,2}.a.*")
    removeField "651" if (exists "651.{*,3}.a.*")
    removeField "651" if (exists "651.{*,4}.a.*")
    removeField "651" if (exists "651.{*,5}.a.*")
    removeField "651" if (exists "651.{*,6}.a.*")
    removeField "651" if (exists "651.{*,8}.a.*")
    removeField "651" if (exists "651.{*,9}.a.*")
    removeField "651" if (exists "651.{*, }.a.*")
 
    removeField "653" if (exists "653.{*,1}.a.*")
    removeField "653" if (exists "653.{*,2}.a.*")
    removeField "653" if (exists "653.{*,3}.a.*")
    removeField "653" if (exists "653.{*,4}.a.*")
    removeField "653" if (exists "653.{*,5}.a.*")
    removeField "653" if (exists "653.{*,6}.a.*")
    removeField "653" if (exists "653.{*,8}.a.*")
    removeField "653" if (exists "653.{*,9}.a.*")
    removeField "653" if (exists "653.{*, }.a.*")
  
    removeField "654" if (exists "654.{*,1}.a.*")
    removeField "654" if (exists "654.{*,2}.a.*")
    removeField "654" if (exists "654.{*,3}.a.*")
    removeField "654" if (exists "654.{*,4}.a.*")
    removeField "654" if (exists "654.{*,5}.a.*")
    removeField "654" if (exists "654.{*,6}.a.*")
    removeField "654" if (exists "654.{*,8}.a.*")
    removeField "654" if (exists "654.{*,9}.a.*")
    removeField "654" if (exists "654.{*, }.a.*")
  
    removeField "655" if (exists "655.{*,1}.a.*")
    removeField "655" if (exists "655.{*,2}.a.*")
    removeField "655" if (exists "655.{*,3}.a.*")
    removeField "655" if (exists "655.{*,4}.a.*")
    removeField "655" if (exists "655.{*,5}.a.*")
    removeField "655" if (exists "655.{*,6}.a.*")
    removeField "655" if (exists "655.{*,8}.a.*")
    removeField "655" if (exists "655.{*,9}.a.*")
    removeField "655" if (exists "655.{*, }.a.*")
  
    removeField "656" if (exists "656.{*,1}.a.*")
    removeField "656" if (exists "656.{*,2}.a.*")
    removeField "656" if (exists "656.{*,3}.a.*")
    removeField "656" if (exists "656.{*,4}.a.*")
    removeField "656" if (exists "656.{*,5}.a.*")
    removeField "656" if (exists "656.{*,6}.a.*")
    removeField "656" if (exists "656.{*,8}.a.*")
    removeField "656" if (exists "656.{*,9}.a.*")
    removeField "656" if (exists "656.{*, }.a.*")
  
    removeField "657" if (exists "657.{*,1}.a.*")
    removeField "657" if (exists "657.{*,2}.a.*")
    removeField "657" if (exists "657.{*,3}.a.*")
    removeField "657" if (exists "657.{*,4}.a.*")
    removeField "657" if (exists "657.{*,5}.a.*")
    removeField "657" if (exists "657.{*,6}.a.*")
    removeField "657" if (exists "657.{*,8}.a.*")
    removeField "657" if (exists "657.{*,9}.a.*")
    removeField "657" if (exists "657.{*, }.a.*")
  
    removeField "658" if (exists "658.{*,1}.a.*")
    removeField "658" if (exists "658.{*,2}.a.*")
    removeField "658" if (exists "658.{*,3}.a.*")
    removeField "658" if (exists "658.{*,4}.a.*")
    removeField "658" if (exists "658.{*,5}.a.*")
    removeField "658" if (exists "658.{*,6}.a.*")
    removeField "658" if (exists "658.{*,8}.a.*")
    removeField "658" if (exists "658.{*,9}.a.*")
    removeField "658" if (exists "658.{*, }.a.*")
  
    removeField "662" if (exists "662.{*,1}.a.*")
    removeField "662" if (exists "662.{*,2}.a.*")
    removeField "662" if (exists "662.{*,3}.a.*")
    removeField "662" if (exists "662.{*,4}.a.*")
    removeField "662" if (exists "662.{*,5}.a.*")
    removeField "662" if (exists "662.{*,6}.a.*")
    removeField "662" if (exists "662.{*,8}.a.*")
    removeField "662" if (exists "662.{*,9}.a.*")
    removeField "662" if (exists "662.{*, }.a.*")

    end

Remove fields 863 to 868 if they do not have a subfield 8 with a value of 9

rule "delete 863 4 5 6 7 8 if it does not have subfield 8 9"
when
(TRUE)
then
removeField "863" if (not exists "866.8.9")
removeField "864" if (not exists "867.8.9")
removeField "865" if (not exists "868.8.9")
removeField "866" if (not exists "866.8.9")
removeField "867" if (not exists "867.8.9")
removeField "868" if (not exists "868.8.9")
end
BeforeAfter

Remove field 035 if it begins with (OCoLC)

rule "remove 035 field if it begins with (OCoLC)"
when
(TRUE)
then
removeField "035" if (exists "035.a.(OCoLC)*")
end

Change 008 pos 35-37 from “HUN” to “hun”

rule "Change 008 pos 35-37 to hun if it is HUN"
when
(existsControl "008.{35,3}.HUN")
then
replaceControlContents "008.{35,3}" with "hun"
end

 Remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield 2 afset

rule "remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield 2 afset"
when
(TRUE)
then
removeField "650" if (exists "650.{*,7}.2.afset")
end

Remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield 2 abc or def or ghi

rule "remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield abc or def or ghi"
when
(TRUE)
then
# split the task into 2 steps:  
# step one: mark the fields to remove using if conditions
# step two: delete the marked fields
#
    # mark all fields without $2 abc or def or ghi
    addSubField "6**.Z.mark" if (not exists "6**.2.abc|def|ghi")
    #
    # unmark fields that do not have second indicator 7
    removeSubField "6**.Z" if (not exists "6**.{*,7}")
    #
    # now only fields with second indicator 7 AND without $2 abc or def or ghi should be marked with $Z
    removeField "6**" if (exists "6**.Z")
end

Create link to Primo by contents of MMSID

rule "Put Primo link temporary fields in YLK"
priority 10
when
not exists "856.z.Link to Primo"
then
addField "YLK.{9,0}.a.https://exldeveu00.primo.exlibrisgroup.com/discovery/search?query=any,contains,"
addField "YLK.{9,1}.a.&tab=LibraryCatalog&search_scope=MyInstitution&vid=EXLDEV1_INST:Alma&lang=en&offset=0"
end


rule "Add system number to 859.u from 001 prefixed by nothing"
priority 9
when
not exists "856.z.Link to Primo"
then
addSystemNumber "859.u" from "001" prefixed by "nothing"
end


rule "prefix and suffix the 859u which now has the MMSID"
priority 8
when
not exists "856.z.Link to Primo"
then
prefixSubField "859.u" with "YLK.{9,0}.a"  if (not exists "859.u.*.*")
suffixSubField  "859.u" with "YLK.{9,1}.a" if (exists "859.u.*primo.exlibrisgroup.com*")
end



rule "Add subfield z to the 859"
priority 7
when
  not exists "856.z.Link to Primo"
then
   addSubField "859.z.Link to Primo" if (exists "859.u.https://exldeveu00.primo.exlibrisgroup.com*")
end

rule "Fix indicators"
priority 7
when
  TRUE
then
changeFirstIndicator "859" to "4" if (exists "859.z.Link to Primo")
changeSecondIndicator "859" to "0" if (exists "859.z.Link to Primo")
end 

rule "Copy the 859 to 856"
priority 6
when
TRUE
then
copyField "859" to "856"
end

rule "Remove the YLK and 859 temporary fields"
priority 5
when
TRUE
then
removeField "859"
removeField "YLK" if (exists "YLK.{9,0}.a.https://exldeveu00.primo.exlibrisgroup.com*")
removeField "YLK" if (exists "YLK.{9,1}.a.*&tab=LibraryCatalog*")
end

Replace a backslash with nothing in 245 subfield a

rule "replace a backslash with nothing (blank)"
when
(TRUE)
then
replaceContents "245.a." with ""
end

Add a field using the pipe OR condition

rule "Add field 901 if 900 exists with Architecture or Design in subfield a"
when
# ((exists "900.a.Design") OR (exists "900.a.Architecture"))
((exists "900.a.Design|Architecture") AND (not exists "901.a.248365-613"))
then
addField "901.{-,-}.a.248365-613"
end

Change text “Sex change” to “Gender transition” in field 650 when 2nd indicator is “0” and do it regardless of whether there is or is not a period at the end of the heading

rule "change 650 Sex change with and without a period at the end to Gender transition"
// updates 650 from "Sex change" to "Gender transition"
when 
TRUE
then 
replaceContents "650.a.Sex change" with "Gender transition" if(exists "650.{*,0}.a.Sex change")
replaceContents "650.a.Sex change" with "Gender transition" if(exists "650.{*,0}.a.Sex change.")
end

 

Change Swaziland to Eswatini in 610 650 and 651 only when 2nd indicator is 0

rule "Swaziland LCSH update"
when
(TRUE)
then
replaceContents "610.z.Swaziland" with "Eswatini" if(exists "610.{*,0}.z.Swaziland")
replaceContents "650.z.Swaziland" with "Eswatini" if(exists "650.{*,0}.z.Swaziland")
replaceContents "651.a.Swaziland" with "Eswatini" if(exists "651.{*,0}.a.Swaziland")
replaceContents "651.z.Swaziland" with "Eswatini" if(exists "651.{*,0}.z.Swaziland")
end

Add 520 subfield a with text “The Thomas J. Safransky Collection” if it does not already exist

rule "Add field 520"
when
not exists "520.{-,-}.a.The Thomas J. Safransky Collection"
then
addField "520.{-,-}.a.The Thomas J. Safransky Collection"
end

Add field 650 2nd indicator 0 and subfield a “Feminist theory” if  not already exist

rule "Add field 650 Feminist theory"
when
not exists "650.{*,*}.a.Feminist theory*"
then
addField "650.{-,0}.a.Feminist theory"
end

Add field 650 2nd indicator 7 subfield a “Feministin” and subfield 2 “GND” if  not already exist

rule "add 650_7 $$a Feministin $$2 GND"
when
(not exists "650.{-,7}.a.Feministin")
then
addField "650.{-,7}.a.Feministin"
addSubField "650.2.GND" if (exists "650.{-,7}.a.Feministin")
end

Add 880 subfield e with text “author” only if the 880 is linked to the 100

rule "Add subfield 880 e author only if the 880 is linked to a 100"
when
not exists "880.{1,-}.e.author"
then
addSubField "880.e.author" if ( exists "880.6.100*" )
end

Add RDA fields 336 337 and 338

rule "RDA Fields - 336"
salience 30
when
(not exists "336")
then
addField "336.a.text" //Change as appropriate
addSubField "336.b.txt"//Change as appropriate
addSubField "336.2.rdacontent" //Change as appropriate
end

rule "RDA Fields - 337"
salience 20
when
(not exists "337")
then
addField "337.a.unmediated" //Change as appropriate
addSubField "337.b.n"//Change as appropriate
addSubField "337.2.rdamedia" //Change as appropriate
end

rule "RDA Fields - 338"
salience 10
when
(not exists "338")
then
addField "338.a.volume" //Change as appropriate
addSubField "338.b.nc"//Change as appropriate
addSubField "338.2.rdacarrier" //Change as appropriate
end

Add RDA fields 336 337 and 338 for Electronic materials

rule "RDA Fields - 336 for electronic materials" 
salience 30 
when 
(not exists "336") 
then 
addField "336.a.text" 
addSubField "336.b.txt"  
addSubField "336.2.rdacontent"  
end

rule "RDA Fields - 337 for electronic materials" 
salience 20 
when 
(not exists "337") 
then 
addField "337.a.computer" 
addSubField "337.b.n" 
addSubField "337.2.rdamedia"  
end 

rule "RDA Fields - 338 for electronic materials" 
salience 10 
when 
(not exists "338") 
then 
addField "338.a.online resource" 
addSubField "338.b.nc" 
addSubField "338.2.rdacarrier"  
end 

Add a new 590 field and make it appear before existing 590 fields

rule "Change 590 to ABC"
salience 3
# by default the above 590 will be added to the end of the list of 5## fields
# below we make a "fictitious" change to the existing 590 fields to change them to another field called ABC
# then we add the new 590, then change the existing 590 fields back to 590. The when the original 590 fields are changed back to 590 they go to the end of the 5## fields.
when
not exists "590.{-,-}.a.Architecture Dept."
then
changeField "590" to "ABC"
end
rule "Add field 590 before other existing 590 fields"
salience 2
when
not exists "590.{-,-}.a.Architecture Dept."
then
addField "590.{-,-}.a.Architecture Dept."
end
rule "Change field ABC back to 590"
salience 1
when
not exists "590.{-,-}.a.Architecture Dept."
then
changeField "ABC" to "590"
end

Add field 561 and make it appear before existing 585

rule "Add 561 before existing 585"

   when
      (TRUE)
   then
          addField "561.a.On permanent loan from the collection of Professor A. Chen."

# by default the above 561 will be added to the end of the list of 5## fields
# below we make a "fictitious" change to 585 ("fictitious" because we change the field to what it already is)
# thus after the 561 gets added the 585 gets changed and goes to the end (which is after the 561)

         changeField "585" to "585"
end

Add a new field based on the existence of multiple subfields in another field

rule "If 650 has subfield a with Thomas and subfield b with Safransky then create 700 subfield a Safransky, Thomas"
when
((exists "650.a.Thomas") AND (exists "650.b.Safransky") AND (not exists "700.{1,-}.a.Safransky, Thomas"))
then
addField "700.{1,-}.a.Safransky, Thomas"
end

Move the text in parentheses of 020 subfield a to be in subfield q

rule "EXL - change (pbk) in 020 a to be in subfield q"
when
(TRUE)
then
addSubField "020.q.(pbk)" if (exists "020.a.*(pbk)")
replaceContents "020.a.(pbk)" with "" 
end

rule "EXL - change (paperback) in 020 a to be in subfield q"
when
(TRUE)
then
addSubField "020.q.(paperback)" if (exists "020.a.*(paperback)")
replaceContents "020.a.(paperback)" with "" 
end

rule "EXL - change (hbk) in 020 a to be in subfield q"
when
(TRUE)
then
addSubField "020.q.(hbk)" if (exists "020.a.*(hbk)")
replaceContents "020.a.(hbk)" with "" 
end

rule "EXL - change (hardback) in 020 a to be in subfield q"
when
(TRUE)
then
addSubField "020.q.(hardback)" if (exists "020.a.*(hardback)")
replaceContents "020.a.(hardback)" with ""
end

rule "EXL - change (electronic) in 020 a to be in subfield q"
when
(TRUE)
then
addSubField "020.q.(electronic)" if (exists "020.a.*(electronic)")
replaceContents "020.a.(electronic)" with ""
end

rule "EXL - change (electronic bk) in 020 a to be in subfield q"
when
(TRUE)
then
addSubField "020.q.(electronic bk)" if (exists "020.a.*(electronic bk)")
replaceContents "020.a.(electronic bk)" with ""
end

Change 008 position 23 to be o unconditionally

rule "Change 008 pos 23 to o"
when
(TRUE)
then
replaceControlContents "008.{23,1}" with "o"
end

Change LDR position 7 to be b unconditionally

rule "Change LDR pos 7 to b"
when
(TRUE)
then
replaceControlContents "LDR.{7,1}" with "b"
end

Change 440 to 490 and 830

rule "change 440 to 490 and 830"
# Background:
# - 440 was made obsolete in 2008 
# - all title series statements would be entered in the 490 field 
# - all title series added entries in the 830.
#
# Change 440 to 490 and 830 in accordance with LOC MARC standards
# Official standards at: http://www.loc.gov/marc/bibliographic/bd440.html
#
# Create the 490 field as follows:
# - Construct field 490 (Series Statement)
# - set 490 indicator 1 to 1
# - set 490 indicator 2 to blank
# - concatenate field 440 subfields $a, $n and $p and place the new string into 490 subfield $a
# (the above means to concatenate subfield n and p with a)
# - and copy the content of 440 subfields $v, $x, $6, and $8 into the same subfields in field 490. 
# - Any additional subfields in field 440 (not mentioned above) go to 830 (as described below)
#
# Create the 830 field as follows:
# - Construct field 830 (Series Added Entry - Uniform Title)
# - all 440 indicators and subfields convert to field 830 with same indicators and subfields.
# (this appears to mean "copy 440 to 80 as is")
priority 40
when
( exists "440.a" ) AND ( not exists "490.a" )
then
copyField "440" to "490"
changeFirstIndicator "490" to "1"
changeSecondIndicator "490" to " "
suffix "490.a" with " " if (exists "490.n")
suffixSubField "490.a" with "490.n" if (exists "490.n")
suffix "490.a" with " " if (exists "490.p")
suffixSubField "490.a" with "490.p" if (exists "490.p")
end

rule "remove from 490 all subfields except a v x 6 8"
priority 40
when 
( exists "490" )
then
removeSubField "490.w"
removeSubField "490.0"
end

rule "change 440 to 830"
priority 30
when
(( exists "440.a" ) AND ( not exists "830.a" ))
then
copyField "440" to "830"
end

rule "remove the 440"
priority 20
when
( exists "440.a" )
then
removeField "440"
end

rule "remove from 490 subfields n and p"
priority 10
# must remove also 490 n and p because we suffixed them above to a)
when
(TRUE)
then
removeSubField "490.n"
removeSubField "490.p"
end

Add field 906 as a local field of a member institution in a consortia

rule "Add field 996 and make it be a local extension"
when
( not exists "996.a.YILIS" )
then
addField "996.a.YILIS"
addSubField "996.b.YLK" if ( exists "996.a.YILIS" )
addSubField "996.c.Dimona" if ( exists "996.a.YILIS" )
addSubField "996.9.local" if ( exists "996.a.YILIS" )
end

Prefix a subfield with text of another field or subfield and hardcoded text

rule "Combine 906 subfield a with 907 subfield c into new field 910 subfield a if it does not already exist and put two dashes between the text of each former subfield"
when
 ( not exists "910.a" )
then
addField "910.a. -- " 
prefixSubField "910.a" with "906.a" if (exists "910.a")
suffixSubField "910.a" with "907.c" if (exists "910.a")
end

Add a field with a period in the middle and with a period at the end

rule "Add field 906 with text Architecture and period at end and also add field 907 with F.L.T."
salience 100
when
  TRUE
then
        addField "906.a.Architecture."
        addField "907.a.F.L.T."
end

Replace all periods with nothing in 245 subfield a

rule "remove period in 245 subfield a (replace it with nothing) period is specified by preceding it with four backslashes"
    when
         (TRUE)
     then
         replaceContents "245.a.." with ""
end

Replace a period with nothing in 245 subfield a if it is followed by a space then a forward slash

This:

245 $$a A Brief relation of the plague at Naples, in the year M.DC.LVI. / $$c Translated out of Italian into English.

Will change to:

245 $$a A Brief relation of the plague at Naples, in the year M.DC.LVI / $$c Translated out of Italian into English.

(note the period before the forward slash which gets removed at end of subfield a)

rule "remove period in 245 subfield a (replace it with nothing) if it is followed by a space then a forward slash"
    when
         (TRUE)
     then
         replaceContents "245.a.. /" with ""
end

Add a field with a pipe as a character as in P|pes

rule "Add 490 1st indicator 1 P|pes"
when
TRUE
then
        addField "490.{1,-}.a.P|pes in code"
end

Change 650_4 a Ferðamálafræði to 650_7 a Ferðamálafræði 2 ICEAUT

rule "remove field 650_4 with Ferðamálafræði"
  when
    (true)
  then
    removeField "650" if (exists "650.{-,4}.a.Ferðamálafræði")
end

rule "add field 650 with Ferðamálafræði"
  when
    (not exists "650.{-,7}.a.Ferðamálafræði")
  then
    addField "650.{-,7}.a.Ferðamálafræði"
    addSubField "650.2.ICEAUT"  if (exists "650.{-,7}.a.Ferðamálafræði")
end

Change field 955 to 655

rule "Move field 955 to 655"
when
(TRUE)
then
changeField "955" to "655"
end

Copy field 001 to 035 subfield a

rule "copy 001 Field to 035 Field"
when
(TRUE)
then
copyField "001" to "035.a"
end

Copy contents of 245 subfield c to 900 subfield a

rule "copy 245 subfield c to 900 subfield a"
when
TRUE
then
copyField "245.c" to "900.a"
end

Copy contents of 300 field to 901 with 1st indicator 1 and 2nd indicator 2

rule "copy 300 to 90112"
when
  TRUE
then
  copyField "300" to "901.{1,2}"
end

Copy contents of 245 ist indicator 1 2nd indicator 4 to 902 1st indicator 1 and 2nd indicator 4

rule "copy 24514 to 90214"
when
  TRUE
then
  copyField "245" to "902.{1,4}" if(exists "245.{1,4}")
end

Add field 901 subfield a “Architecture” conditionally

rule " Add field 901 with sub field a with text Architecture Dept. only if it is not already there and if 902 subfield b has 034-ARC" 
when ((exists "902.b.034-ARC") AND (not exists "901.a.Architecture Dept")) 
then 
addField "901.a.Architecture Dept" 
end

Change 035 subfield b to 035 subfield a

rule "Copy 035 subfield b to 035 subfield a"
when
(TRUE)
then
changeSubField "035.b" to "a"
end

Change 856 2nd indicator 1 to 0

rule "Change second indicator of field 856 to 0 if the value is 1"
when
(TRUE)
then
changeSecondIndicator "856" to "0" if (exists "856.{*,1}")
end

Change the first occurrence of 040 subfield d to a and do not change other ones

rule "change the first occurrence of 040 subfield d to a and do not change other ones"
when
(TRUE)
then
changeSubFieldOnlyFirst "040.d" to "a"
end

Change all occurrences of 040 subfield d to a except the first one

rule "change all occurrences of 040 subfield d to a except the first one"
when
(TRUE)
then
changeSubFieldExceptFirst "040.d" to "a"
end

Replace “Baker and Taylor” with “B and T” in 938 subfield a but only the first occurence

rule "Replace the first occurrence of Baker and Taylor in subfield a with B and T  Do not change other occurrences of other subfield a with Baker and Taylor”

    when
         (TRUE)
     then
            replaceContentsOnlyFirst "938.a.Baker and Taylor" with "B and T"
end

Replace “Baker and Taylor” with “B and T” in 938 subfield a for all occurences except the first one

rule "Replace all occurrences of Baker and Taylor in subfield a with B and T  except for the first occurrence”

    when
         (TRUE)
     then
            replaceContentsExceptFirst "938.a.Baker and Taylor" with "B and T"
end

Copy the MMSID in 001 and prefix it by what is in 003 in parentheses

rule "Add system number 035.a from 001 prefixed by 003"
when
(TRUE)
then
addSystemNumber "035.a" from "001" prefixed by "003"
end

Change control field 001 to 009

rule "Move field 001 to 009"
when
(not existsControl "009")
then
changeControlField "001" to "009"
end

Change (fix) 245 2nd indicator based on language of record and beginning text of 245

rule "Fix 2nd indicator for English"
when
(existsControl "008.{35,3}.eng")
then
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.The *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.An *")
changeSecondIndicator "245" to "2" if (exists "245.{*,*}.a.A *")
end

rule "Fix 2nd indicator for French"
when
(existsControl "008.{35,3}.fre")
then
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.La *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Le *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Les *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Un *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Une *")
changeSecondIndicator "245" to "2" if (exists "245.{*,*}.a.L'*")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Des *")
end

rule "Fix 2nd indicator for Spanish"
when
(existsControl "008.{35,3}.spa")
then
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.El *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Lo *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.La *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Las *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Los *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Uno *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Una *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Un *")
changeSecondIndicator "245" to "5" if (exists "245.{*,*}.a.Unos *")
changeSecondIndicator "245" to "5" if (exists "245.{*,*}.a.Unas *")
end

rule "Fix 2nd indicator for German"
when
(existsControl "008.{35,3}.ger")
then
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Das *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Der *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Din *")
changeSecondIndicator "245" to "5" if (exists "245.{*,*}.a.Dine *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Die *")
end

rule "Fix 2nd indicator for Italian"
when
(existsControl "008.{35,3}.ita")
then
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Gli *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Gl' *")
changeSecondIndicator "245" to "2" if (exists "245.{*,*}.a.I *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Il *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.La *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Le *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Lo *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.L' *")
end

rule "Fix 2nd indicator for Dutch"
when
(existsControl "008.{35,3}.dut")
then
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Een *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Het *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.De *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Des *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Der *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.'s *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.'t *")
changeSecondIndicator "245" to "5" if (exists "245.{*,*}.a.Eene *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.'n *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Ene *")
end

rule "Fix 2nd indicator for Portuguese"
when
(existsControl "008.{35,3}.por")
then
changeSecondIndicator "245" to "2" if (exists "245.{*,*}.a.O *")
changeSecondIndicator "245" to "2" if (exists "245.{*,*}.a.A *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Os *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.As *")
changeSecondIndicator "245" to "3" if (exists "245.{*,*}.a.Um *")
changeSecondIndicator "245" to "4" if (exists "245.{*,*}.a.Uma *")
end

Fix 130 1st indicator based on language of record and beginning text of 130

rule "Fix 1st indicator for English" 
when 
(existsControl "008.{35,3}.eng") 
then 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.The *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.An *") 
changeFirstIndicator "130" to "2" if (exists "130.{*,*}.a.A *") 
end 

rule "Fix 1st indicator for French" 
when 
(existsControl "008.{35,3}.fre") 
then 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.La *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Le *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Les *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Un *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Une *") 
changeFirstIndicator "130" to "2" if (exists "130.{*,*}.a.L'*") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Des *") 
end 

rule "Fix 1st indicator for Spanish" 
when 
(existsControl "008.{35,3}.spa") 
then 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.El *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Lo *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.La *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Las *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Los *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Uno *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Una *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Un *") 
changeFirstIndicator "130" to "5" if (exists "130.{*,*}.a.Unos *") 
changeFirstIndicator "130" to "5" if (exists "130.{*,*}.a.Unas *") 
end 

rule "Fix 1st indicator for German" 
when 
(existsControl "008.{35,3}.ger") 
then 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Das *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Der *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Din *") 
changeFirstIndicator "130" to "5" if (exists "130.{*,*}.a.Dine *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Die *") 
end 

rule "Fix 1st indicator for Italian" 
when 
(existsControl "008.{35,3}.ita") 
then 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Gli *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Gl' *") 
changeFirstIndicator "130" to "2" if (exists "130.{*,*}.a.I *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Il *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.La *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Le *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Lo *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.L' *") 
end 

rule "Fix 1st indicator for Dutch" 
when 
(existsControl "008.{35,3}.dut") 
then 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Een *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Het *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.De *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Des *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Der *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.'s *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.'t *") 
changeFirstIndicator "130" to "5" if (exists "130.{*,*}.a.Eene *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.'n *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Ene *") 
end 

rule "Fix 1st indicator for Portuguese" 
when 
(existsControl "008.{35,3}.por") 
then 
changeFirstIndicator "130" to "2" if (exists "130.{*,*}.a.O *") 
changeFirstIndicator "130" to "2" if (exists "130.{*,*}.a.A *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Os *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.As *") 
changeFirstIndicator "130" to "3" if (exists "130.{*,*}.a.Um *") 
changeFirstIndicator "130" to "4" if (exists "130.{*,*}.a.Uma *") 
end

Fix and populate 008 position 7-10 based on 260 or 264 subfield c

rule "populate 008 7-10 1970"
when
((exists "260.{*,*}.c.*1970*") OR (exists "264.{*,*}.c.*1970*"))
then
replaceControlContents "008.{7,4}" with "1970"
end

rule "populate 008 7-10 1971"
when
((exists "260.{*,*}.c.*1971*") OR (exists "264.{*,*}.c.*1971*"))
then
replaceControlContents "008.{7,4}" with "1971"
end

rule "populate 008 7-10 1972"
when
((exists "260.{*,*}.c.*1972*") OR (exists "264.{*,*}.c.*1972*"))
then
replaceControlContents "008.{7,4}" with "1972"
end

rule "populate 008 7-10 1973"
when
((exists "260.{*,*}.c.*1973*") OR (exists "264.{*,*}.c.*1973*"))
then
replaceControlContents "008.{7,4}" with "1973"
end

rule "populate 008 7-10 1974"
when
((exists "260.{*,*}.c.*1974*") OR (exists "264.{*,*}.c.*1974*"))
then
replaceControlContents "008.{7,4}" with "1974"
end

rule "populate 008 7-10 1975"
when
((exists "260.{*,*}.c.*1975*") OR (exists "264.{*,*}.c.*1975*"))
then
replaceControlContents "008.{7,4}" with "1975"
end

rule "populate 008 7-10 1976"
when
((exists "260.{*,*}.c.*1976*") OR (exists "264.{*,*}.c.*1976*"))
then
replaceControlContents "008.{7,4}" with "1976"
end

rule "populate 008 7-10 1977"
when
((exists "260.{*,*}.c.*1977*") OR (exists "264.{*,*}.c.*1977*"))
then
replaceControlContents "008.{7,4}" with "1977"
end

rule "populate 008 7-10 1978"
when
((exists "260.{*,*}.c.*1978*") OR (exists "264.{*,*}.c.*1978*"))
then
replaceControlContents "008.{7,4}" with "1978"
end

rule "populate 008 7-10 1979"
when
((exists "260.{*,*}.c.*1979*") OR (exists "264.{*,*}.c.*1979*"))
then
replaceControlContents "008.{7,4}" with "1979"
end

rule "populate 008 7-10 1980"
when
((exists "260.{*,*}.c.*1980*") OR (exists "264.{*,*}.c.*1980*"))
then
replaceControlContents "008.{7,4}" with "1980"
end

rule "populate 008 7-10 1981"
when
((exists "260.{*,*}.c.*1981*") OR (exists "264.{*,*}.c.*1981*"))
then
replaceControlContents "008.{7,4}" with "1981"
end

rule "populate 008 7-10 1982"
when
((exists "260.{*,*}.c.*1982*") OR (exists "264.{*,*}.c.*1982*"))
then
replaceControlContents "008.{7,4}" with "1982"
end

rule "populate 008 7-10 1983"
when
((exists "260.{*,*}.c.*1983*") OR (exists "264.{*,*}.c.*1983*"))
then
replaceControlContents "008.{7,4}" with "1983"
end

rule "populate 008 7-10 1984"
when
((exists "260.{*,*}.c.*1984*") OR (exists "264.{*,*}.c.*1984*"))
then
replaceControlContents "008.{7,4}" with "1984"
end

rule "populate 008 7-10 1985"
when
((exists "260.{*,*}.c.*1985*") OR (exists "264.{*,*}.c.*1985*"))
then
replaceControlContents "008.{7,4}" with "1985"
end

rule "populate 008 7-10 1986"
when
((exists "260.{*,*}.c.*1986*") OR (exists "264.{*,*}.c.*1986*"))
then
replaceControlContents "008.{7,4}" with "1986"
end

rule "populate 008 7-10 1987"
when
((exists "260.{*,*}.c.*1987*") OR (exists "264.{*,*}.c.*1987*"))
then
replaceControlContents "008.{7,4}" with "1987"
end

rule "populate 008 7-10 1988"
when
((exists "260.{*,*}.c.*1988*") OR (exists "264.{*,*}.c.*1988*"))
then
replaceControlContents "008.{7,4}" with "1988"
end

rule "populate 008 7-10 1989"
when
((exists "260.{*,*}.c.*1989*") OR (exists "264.{*,*}.c.*1989*"))
then
replaceControlContents "008.{7,4}" with "1989"
end

rule "populate 008 7-10 1990"
when
((exists "260.{*,*}.c.*1990*") OR (exists "264.{*,*}.c.*1990*"))
then
replaceControlContents "008.{7,4}" with "1990"
end

rule "populate 008 7-10 1991"
when
((exists "260.{*,*}.c.*1991*") OR (exists "264.{*,*}.c.*1991*"))
then
replaceControlContents "008.{7,4}" with "1991"
end

rule "populate 008 7-10 1992"
when
((exists "260.{*,*}.c.*1992*") OR (exists "264.{*,*}.c.*1992*"))
then
replaceControlContents "008.{7,4}" with "1992"
end

rule "populate 008 7-10 1993"
when
((exists "260.{*,*}.c.*1993*") OR (exists "264.{*,*}.c.*1993*"))
then
replaceControlContents "008.{7,4}" with "1993"
end

rule "populate 008 7-10 1994"
when
((exists "260.{*,*}.c.*1994*") OR (exists "264.{*,*}.c.*1994*"))
then
replaceControlContents "008.{7,4}" with "1994"
end

rule "populate 008 7-10 1995"
when
((exists "260.{*,*}.c.*1995*") OR (exists "264.{*,*}.c.*1995*"))
then
replaceControlContents "008.{7,4}" with "1995"
end

rule "populate 008 7-10 1996"
when
((exists "260.{*,*}.c.*1996*") OR (exists "264.{*,*}.c.*1996*"))
then
replaceControlContents "008.{7,4}" with "1996"
end

rule "populate 008 7-10 1997"
when
((exists "260.{*,*}.c.*1997*") OR (exists "264.{*,*}.c.*1997*"))
then
replaceControlContents "008.{7,4}" with "1997"
end

rule "populate 008 7-10 1998"
when
((exists "260.{*,*}.c.*1998*") OR (exists "264.{*,*}.c.*1998*"))
then
replaceControlContents "008.{7,4}" with "1998"
end

rule "populate 008 7-10 1999"
when
((exists "260.{*,*}.c.*1999*") OR (exists "264.{*,*}.c.*1999*"))
then
replaceControlContents "008.{7,4}" with "1999"
end

rule "populate 008 7-10 2000"
when
((exists "260.{*,*}.c.*2000*") OR (exists "264.{*,*}.c.*2000*"))
then
replaceControlContents "008.{7,4}" with "2000"
end

rule "populate 008 7-10 2001"
when
((exists "260.{*,*}.c.*2001*") OR (exists "264.{*,*}.c.*2001*"))
then
replaceControlContents "008.{7,4}" with "2001"
end

rule "populate 008 7-10 2002"
when
((exists "260.{*,*}.c.*2002*") OR (exists "264.{*,*}.c.*2002*"))
then
replaceControlContents "008.{7,4}" with "2002"
end

rule "populate 008 7-10 2003"
when
((exists "260.{*,*}.c.*2003*") OR (exists "264.{*,*}.c.*2003*"))
then
replaceControlContents "008.{7,4}" with "2003"
end

rule "populate 008 7-10 2004"
when
((exists "260.{*,*}.c.*2004*") OR (exists "264.{*,*}.c.*2004*"))
then
replaceControlContents "008.{7,4}" with "2004"
end

rule "populate 008 7-10 2005"
when
((exists "260.{*,*}.c.*2005*") OR (exists "264.{*,*}.c.*2005*"))
then
replaceControlContents "008.{7,4}" with "2005"
end

rule "populate 008 7-10 2006"
when
((exists "260.{*,*}.c.*2006*") OR (exists "264.{*,*}.c.*2006*"))
then
replaceControlContents "008.{7,4}" with "2006"
end

rule "populate 008 7-10 2007"
when
((exists "260.{*,*}.c.*2007*") OR (exists "264.{*,*}.c.*2007*"))
then
replaceControlContents "008.{7,4}" with "2007"
end

rule "populate 008 7-10 2008"
when
((exists "260.{*,*}.c.*2008*") OR (exists "264.{ , }.c.*2008*"))
then
replaceControlContents "008.{7,4}" with "2008"
end

rule "populate 008 7-10 2009"
when
((exists "260.{*,*}.c.*2009*") OR (exists "264.{*,*}.c.*2009*"))
then
replaceControlContents "008.{7,4}" with "2009"
end

rule "populate 008 7-10 2010"
when
((exists "260.{*,*}.c.*2010*") OR (exists "264.{*,*}.c.*2010*"))
then
replaceControlContents "008.{7,4}" with "2010"
end

rule "populate 008 7-10 2011"
when
((exists "260.{*,*}.c.*2011*") OR (exists "264.{*,*}.c.*2011*"))
then
replaceControlContents "008.{7,4}" with "2011"
end

rule "populate 008 7-10 2012"
when
((exists "260.{*,*}.c.*2012*") OR (exists "264.{*,*}.c.*2012*"))
then
replaceControlContents "008.{7,4}" with "2012"
end

rule "populate 008 7-10 2013"
when
((exists "260.{*,*}.c.*2013*") OR (exists "264.{*,*}.c.*2013*"))
then
replaceControlContents "008.{7,4}" with "2013"
end

rule "populate 008 7-10 2014"
when
((exists "260.{*,*}.c.*2014*") OR (exists "264.{*,*}.c.*2014*"))
then
replaceControlContents "008.{7,4}" with "2014"
end

rule "populate 008 7-10 2015"
when
((exists "260.{*,*}.c.*2015*") OR (exists "264.{*,*}.c.*2015*"))
then
replaceControlContents "008.{7,4}" with "2015"
end

rule "populate 008 7-10 2016"
when
((exists "260.{*,*}.c.*2016*") OR (exists "264.{*,*}.c.*2016*"))
then
replaceControlContents "008.{7,4}" with "2016"
end

rule "populate 008 7-10 2017"
when
((exists "260.{*,*}.c.*2017*") OR (exists "264.{*,*}.c.*2017*"))
then
replaceControlContents "008.{7,4}" with "2017"
end

rule "populate 008 7-10 2018"
when
((exists "260.{*,*}.c.*2018*") OR (exists "264.{*,*}.c.*2018*"))
then
replaceControlContents "008.{7,4}" with "2018"
end

rule "populate 008 7-10 2019"
when
((exists "260.{*,*}.c.*2019*") OR (exists "264.{*,*}.c.*2019*"))
then
replaceControlContents "008.{7,4}" with "2019"
end

rule "populate 008 7-10 2020"
 when 
((exists "260.{*,*}.c.*2020*") OR (exists "264.{*,*}.c.*2020*"))
 then 
replaceControlContents "008.{7,4}" with "2020"
 end 

rule "populate 008 7-10 2021" 
when 
((exists "260.{*,*}.c.*2021*") OR (exists "264.{*,*}.c.*2021*")) 
then 
replaceControlContents "008.{7,4}" with "2021" 
end 

rule "populate 008 7-10 2022" 
when 
((exists "260.{*,*}.c.*2022*") OR (exists "264.{*,*}.c.*2022*"))
 then 
replaceControlContents "008.{7,4}" with "2022" 
end 

rule "populate 008 7-10 2023" 
when 
((exists "260.{*,*}.c.*2023*") OR (exists "264.{*,*}.c.*2023*")) 
then 
replaceControlContents "008.{7,4}" with "2023" 
end

rule "populate 008 7-10 2024" 
when 
((exists "260.{*,*}.c.*2024*") OR (exists "264.{*,*}.c.*2024*")) 
then 
replaceControlContents "008.{7,4}" with "2024" 
end

Move anything after the colon in 245 subfield a to 245 subfield b

rule "move anything after the colon in 245 subfield a to 245 subfield b"
when
(exists "245.a" ) AND (not exists "245.a.Book review*")
then
replaceContents "245.a.:" with " :_separator_"
splitSubField "245.a._separator_"
changeSubFieldExceptFirst "245.a" to "b"
end

Separate (split) one 650 field into separate 650 fields when there are semicolon delimited values

This rule uses the splitSubField funtion

BeforeAfter
650__ $$a Tanya;Gate of Trust;The Tree of Life;Torah Or;The Ethical Will;Basi L’Gani;Hayom Yom;Likkutei Sichot;Sichos in English650__ $$a Tanya

650__ $$a Gate of Trust

650__ $$a The Tree of Life

650__ $$a Torah Or

650__ $$a The Ethical Will

650__ $$a Basi L’Gani

650__ $$a Hayom Yom

650__ $$a Likkutei Sichot

650__ $$a Sichos in English

rule "Separate (split) one 650 field into separate 650 fields when there are semicolon delimited values"
    when
        (TRUE)
    then
      # first change the 650 to temporary field TMP if it has a semicolon
     changeField "650" to "TMP" if (exists "650.a.*;*")
     # separate the TMP field into separate fields based on the semicolon between the values
      splitSubField "TMP.a.;" to "650.a"
      # remove the temporary field
      removeField "TMP"

    end

Remove all 9XX fields then add 900 using priority

rule "Remove all 9XX"
# the higher priority occurs first.  2 before 1
# must first remove all 9XX fields and then afterwards add the 9XX
priority 2
when
(TRUE)
then
removeField "9*"
end

rule "Add data field 900 with subfield a = copied from National Catalog if it does not exist"
priority 1
when
TRUE
then
addField "900.a.Copied from National Catalog"
end

Add 853 and 863 using salience

rule "add Hol 853"
#the highest salience occurs first.  100 before 99.  Like priority
salience 100
when
  (TRUE)
then
  addField "853.{2,0}.8.1"
  addSubField "853.a.v."
  addSubField "853.b.no."
  addSubField "853.u.9"
  addSubField "853.v.r"
  addSubField "853.i.(year)"
  addSubField "853.j.(month)"
  addSubField "853.w.m"
  addSubField "853.x.01"
#  addSubField "853.y.om06,07,08"
end

rule "add first Hol 863"
salience 90
when
  (TRUE)
then
  addField "863.{3,2}.8.1.1"
  addSubField "863.a.1-4"
  addSubField "863.i.1941-1943"
  addSubField "863.w.g"
end

rule "add second Hol 863"
salience 80
when
(TRUE)
then
addField "863.{3,2}.8.1.2"
addSubField "863.a.6-86" if ( exists "863.{3,2}.8.1.2" )
addSubField "863.i.1945-1987" if ( exists "863.{3,2}.8.1.2" )
end

Replace semicolon space with space – – space

rule "Replace semicolon space with space -- space"
when
(TRUE)
then
replaceContents "505.a."; "" with " -- "
end

Append text “(January 19, 1971)” to the end of the 590

rule "Suffix 590.a with (January 19, 1971) if not already there" 
when 
(TRUE) 
then suffix "590.a" with " (January 19, 1971)" if (not exists "590.a.*(January 19, 1971)") 
end

Move all contents in angled brackets of subfield h to subfield k

This will change

8520_ $$b ULINC $$c GEN $$h <Ref> GT3405 $$i .A23 2019

to

8520_ $$b ULINC $$c GEN $$k Ref $$h GT3405 $$i .A23 2019

 

rule "01 Move all contents in angled brackets of subfield h to subfield k"
    when
         (exists "852.h.<Vid>*")
     then
            replaceContents "852.h.<Vid>" with ""
            addSubField "852.k.Vid"
end

rule "02 Move all contents in angled brackets of subfield h to subfield k"
    when
         (exists "852.h.<Ref>*")
     then
            replaceContents "852.h.<Ref>" with ""
            addSubField "852.k.Ref"
end

rule "03 Move all contents in angled brackets of subfield h to subfield k"
    when
         (exists "852.h.<Oversize>*")
     then
            replaceContents "852.h.<Oversize>" with ""
            addSubField "852.k.Oversize"
end

Normalization rule for autopopulating 008 fields

Contribution from Hanoch Roniger of The Hebrew University of Jerusalem

See: Normalization rule for autopopulating 008 fields from Hanoch Roniger of The Hebrew University of Jerusalem

Normalization rule for combining 949 fields based on subfield 8 from Hanoch Roniger of The Hebrew University of Jerusalem

Contribution from Hanoch Roniger of The Hebrew University of Jerusalem

See: Normalization rule for combining 949 fields based on subfield 8 from Hanoch Roniger of The Hebrew University of Jerusalem

Remove Redundant spaces from 245 subfield a

rule "Replace 8 spaces with one space"
salience 100
when
(TRUE)
then
ReplaceContents "245.a.        " with " "
end
rule "Replace 7 spaces with one space"
salience 90
when
(TRUE)
then
ReplaceContents "245.a.       " with " "
end
rule "Replace 6 spaces with one space"
salience 80
when
(TRUE)
then
ReplaceContents "245.a.      " with " "
end
rule "Replace 5 spaces with one space"
salience 70
when
(TRUE)
then
ReplaceContents "245.a.     " with " "
end
rule "Replace 4 spaces with one space"
salience 60
when
(TRUE)
then
ReplaceContents "245.a.    " with " "
end
rule "Replace 3 spaces with one space"
salience 50
when
(TRUE)
then
ReplaceContents "245.a.   " with " "
end
rule "Replace 2 spaces with one space"
salience 40
when
(TRUE)
then
ReplaceContents "245.a.  " with " "
end

Remove all fields except for LDR 001 020 022 and 035. 

rule "remove all fields except LDR 001 020 022 and 035"
# This rule first copies the fields to temporary field alphabetic fields  then deletes all other fields except 001 then puts the alphabetic fields to what they were
when
(TRUE)
then
copyField "020" to "ABC"
copyField "022" to "DEF"
copyField "035" to "GHI"
removeControlField "002"
removeControlField "003"
removeControlField "004"
removeControlField "005"
removeControlField "006"
removeControlField "007"
removeControlField "008"
removeControlField "009"
removeField "0*"
removeField "1*"
removeField "2*"
removeField "3*"
removeField "4*"
removeField "5*"
removeField "6*"
removeField "7*"
removeField "8*"
removeField "9*"
copyField "ABC" to "020"
copyField "DEF" to "022"
copyField "GHI" to "035"
removeField "ABC"
removeField "DEF"
removeField "GHI"
end

Add field 900 with text Govt. Doc if 008 pos 21 = f

rule "Add field 900 with subfield a Govt. Doc if 008 has an f in pos 28"
when
existsControl "008.{28,1}.f"
then
addField "900.a.Govt. Doc" if (not exists "900.a.Govt. Doc") 
end

Add a 999 field with subfield a “Govt. Publication” or “Not a Govt. Publication” based on the contents of 008 position 21.

rule "Check 008 position 28 and if it is a Govt. Publication then add field 999 with text Govt. Publication in subfield a"
when
(existsControl "008.{28,1}.a") OR (existsControl "008.{28,1}.c") OR (existsControl "008.{28,1}.f") OR (existsControl "008.{28,1}.i") OR (existsControl "008.{28,1}.l") OR (existsControl "008.{28,1}.m") OR (existsControl "008.{28,1}.o") OR (existsControl "008.{28,1}.s") OR (existsControl "008.{28,1}.z") 
then
addField "999.a.Govt. Publication"
end

rule "Check 008 position 28 and if it is a Govt. Publication then add field 999 with text Not a Govt. Publication in subfield a"
when
(not existsControl "008.{28,1}.a") AND (not existsControl "008.{28,1}.c") AND (not existsControl "008.{28,1}.f") AND (not existsControl "008.{28,1}.i") AND (not existsControl "008.{28,1}.l") AND (not existsControl "008.{28,1}.m") AND (not existsControl "008.{28,1}.o") AND  (not existsControl "008.{28,1}.s") AND (not existsControl "008.{28,1}.z") 
then
addField "999.a.Not a Govt. Publication"
end

Combine 852 subfields h and i and put space between them

This rule will change for example this:

852 $$b SPMS $$c FG $$h 210.19 $$i Y957p

to this

852 $$b SPMS $$c FG $$h 210.19 Y957p

It uses a temporary text as a placeholder for the space, then changes the temorary text to a space, then removes the temporary text.

rule "add temporary field and subfield to later be a space"
priority 10
when
(true)
then
# assumes field 999 is not already in use if it is in use different field
addField "999.z.temporary_placeholder_to_later_be_space"
end

rule "copy 852.i to 852.h and remove 852.i"
priority 9
when
(exists "852.i")
then
prefixSubField "852.i" with "999.z"
suffixSubField "852.h" with "852.i"
removeSubField "852.i"
end

rule "change temporary text to space"
priority 8
when
(true)
then
ReplaceContents "852.h.temporary_placeholder_to_later_be_space" with " "
end

rule "remove the temporary field"
priority 7
when
(true)
then
removeField "999"
end

Replace the 852 subfield c with ENT if it is currently with value UNASSIGNED and there is a 852 subfield h

Input: $$b ULINC $$c UNASSIGNED $$h HD6054.3 $$i .S265 2013

Output: $$b ULINC $$c ENT $$h HD6054.3 $$i .S265 2013

rule "Make the 852 subfield c be ENT if it is now UNASSIGNED and there is an 852 subfield h"
when
     (TRUE)
 then
        replaceContents "852.c.UNASSIGNED" with "ENT" if (exists "852.{*,*}.h.*")
 end

Add a 090 field with subfield a “כ”ע” .  These are two Hebrew letters with a quotation mark between them.

rule "Add field 090 part 1"
salience 100
when
TRUE
then
addField "090.{-,-}.a.abcd"efgh"
end

rule "Add field 090 part 2"
salience 99
when
TRUE
then
replaceContents "090.a.abcd" with "כ"
replaceContents "090.a.efgh" with "ע"
end

Add a 590 field with subfield a “Sent to Hathi Trust” and subfield b “Sent from Alma University”.

rule "Add field 590"
salience 10
when
not exists "590.{-,-}.a.Sent to Hathi Trust"
then
        addField "590.{-,-}.a.Sent to Hathi Trust"
        addSubField "590.b.Sent from Alma University"  if ( exists "590.{-,-}.a.Sent to Hathi Trust" )
end

Replace an encoded ampersand with a real ampersand (replace &amp; with &)

  • Sometimes &amp; gets added to the record instead of & during import, depending on the source of the imported record.
  • Note that in Alma the &amp; will appear in the header of the metadata editor but not in the actual record (as in screenshot below)

Here is the rule (this works for field 245.  Add similar lines for addtional fields if neccassary) :

rule "replace encoded ampersand with real ampersand"
when
(TRUE)
then
replaceContents "245.a.&amp;" with "&" 
end
BeforeAfter

The following rules (from here to the end of the blog) are examples which use a regular expression. Use of regular expressions in Alma Normalization Rules is not currently fully supported, but some regular expressions can be used, shown in the examples below.

Use of regular expressions is not currently fully supported, but some regular expressions can be used, shown in the examples below.

Add subfield 9 with value “eng” to 650 field if 650 subfield a has English characters and add subfield 9 with value “heb” to 650 field if 650 subfield a has Hebrew characters.

rule "add script for 650 in English"
when
(TRUE)
then
addSubField "650.9.eng" if   (exists "650.a.*a*|*b*|*c*|*d*|*e*|*f*|*g*|*h*|*i*|*j*|*k*|*l*|*m*|*n*|*o*|*p*|*q*|*r*|*s*|*t*|*u*|*v*|*w*|*x*|*y*|*z*")  
end

rule "add script for 650 in Hebrew"
when
(TRUE)
then
addSubField "650.9.heb" if   (exists "650.a.*א*|*ב*|*ג*|*ד*|*ה*|*ו*|*ז*|*ח*|*ט*|*י*|*כ*|*ל*|*מ*|*נ*|*ס*|*ע*|*פ*|*צ*|*ק*|*ר*|*ש*|*ת*|*ן*|*ם*|*ך*|*ף*|*ץ*")  
end
Before After

Remove leading zeroes from 035 subfield a

This rule uses a regular expression.

BeforeAfter
rule "replace leading zeroes in 035"

    when
         (TRUE)
     then
            replaceContents "035.a.^0+(.*)" with "$1"
            replaceContents "035.a.)0" with ")"
            replaceContents "035.a.)0" with ")"
            replaceContents "035.a.)0" with ")"
            replaceContents "035.a.)0" with ")"
            replaceContents "035.a.)0" with ")"
end

Move anything in subfield h which is after a number and space and before a capital letter to subfield i

BeforeAfter

This rule uses a regular expression.

rule "move item info to subfield i"
    when
        (TRUE)
    then
        replaceContents "852.h. ((A|B|C|D|E|F|G|H|I|J|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z).*)$" with "__SEPARATOR__$1"
        splitSubField "852.h.__SEPARATOR__"
        changeSubFieldExceptFirst "852.h" to "i"
    end

Move anything in subfield h which is after a number and space and before a period to subfield i

This rule uses a regular expression.

BeforeAfter
rule "move item info to subfield i"
    when
        (TRUE)
    then
        replaceContents "852.h.." with "__PERIOD__"
        replaceContents "852.h. ((A|B|C|D|E|F|G|H|I|J|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|__PERIOD__).*)$" with "__SEPARATOR__$1"
        splitSubField "852.h.__SEPARATOR__"
        changeSubFieldExceptFirst "852.h" to "i"
        replaceContents "852.*.__PERIOD__" with "."
    end

Remove an asterisk when it appears at the end of the ISBN in 020 subfield a

BeforeAfter

Remove the last character of the 020 field

This rule uses a regular expression.

rule "replace asterisk at end of 020 a with nothing"
    when
         (TRUE)
     then
            replaceContents "020.a.(.*).$" with "$1" if (not exists "020.a.*0|*1|*2|*3|*4|*5|*6|*7|*8|*9|*X")
end

Add a space between a number and a capital letter in the 852 field subfield h

This rule uses a regular expression

A special thanks to Hanoch Roniger of Hebrew University for assistance with this normalization rule

Here is an example of what it does

rule "EXL - add a space between a number and a capital letter in 852 h"
when
(TRUE)
then
replaceContents "852.h.^(.*(1|2|3|4|5|6|7|8|9|0))(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z)" with "$1 $3"
end

Add a hyphen after the 4th digit in 022 subfield a if 022 subfield a contains 8 digits

This rule uses a regular expression

A special thanks to Hanoch Roniger of Hebrew University for assistance with this normalization rule

This for example :

022  $$a 09522344

Will become this:

022  $$a 0952-2344

But this will not change:

022 $$a 9789424969467

This:

022 $$a 97894249

Will become this:

022 $$a 9789-4249

rule "add hyphen after 4th character of 8 digit issn"
when
 (exists "022")
then
    suffix "022.a" with "__"
    replaceContents "022.a.^(.{4})(.{4})_.*" with "$1-$2"
    replaceContents "022.a.__" with ""
end
BeforeAfter

Copy everything before the comma in 100 subfield a to 913 subfield a

rule "copy field 100 a to 913 a if it has a comma"
priority 10
when
(exists "100.a.*,*")
then
 copyField "100.a" to "913.a" if (exists "100.a.*,*")
end

rule "in the 913 make two subfields for data before and after comma"
priority 9
when
(TRUE)
then
replaceContents "913.a.((,).*)$" with "__SEPARATOR__$1"
splitSubField "913.a.__SEPARATOR__"
end

rule "delete all 913 subfields a except the first"
priority 8
when
(TRUE)
then
changeSubFieldExceptFirst "913.a" to "Z"
removeSubField "913.Z" if (exists "913.Z.*,*")
end

Replace the first occurence of V space with R space in 852 subfield h

rule "replace the first occurrence of V space with R space in 852 subfield h"
when
    true
then
    replaceContents "852.h.^(V )(.*)" with "R $2"
end

Remove the quotes in the 773 subfield t when they are in middle of a Hebrew string but not when quotes are at beginning and end of Hebrew string. 

This rule uses a regular expression.

773__ $$t חצ”ב

Should change to

773__ $$t חצב

773__ $$t “המצב הנוכחי”

Should not change

rule "remove quotes in 773 t when in middle of a Hebrew string"
when
(exists "773")
then
    replaceContents "773.t.^(.*(א|ב|ג|ד|ה|ו|ז|ח|ט|י|ק|ל|מ|נ|ס|ע|פ|צ|ק|ר|ש|ת|ן|ך|ף|ץ))"(א|ב|ג|ד|ה|ו|ז|ח|ט|י|ק|ל|מ|נ|ס|ע|פ|צ|ק|ר|ש|ת|ן|ך|ף|ץ)" with "$1$3"

end

100 Replies to “Alma Normalization Rule Examples”

  1. Is there an equivalent article with examples for modifying Dublin Core records in Alma D? We would like to add dcterms:accessRights field to several hundred records so that we can display the Open Access indicator in Primo.

  2. Hi, Yoel. I need to know if it’s possible in NR syntax to express a condition at action level to decide if a subfield is empty.
    Thanks and kind regards,
    Hugo

  3. Hi Hugo. Are you asking “Can I make a condition that a subfield does not exist?” You say “empty” but that would mean it does not exist.
    Here is an example of 650 z not existing
    ….
    then suffix “650.a” with “Zimbabwe” if (not exists “650.z.*”)

  4. Hi Yoel, thanks for answering so fast. I mean tags that exist but are empty. In my case these are 245 (and others) labels that are duplicated and one of them is empty:

    LDR #####nas#a22#####7u#4500
    008 ######s2013####xx######o#####000#0#eng#d
    020 __ |a
    035 __ |a (OCoLC)
    040 __ |a
    041 0_ |a
    050 00 |a
    100 1_ |a |b |c |d
    100 __ |a Project Management Institute
    240 10 |a
    245 10 |a |b |c |h
    245 __ |a Project Manager Competency Development Framework – Third Edition
    246 11 |a |b
    250 __ |a |b
    260 __ |a |b |c
    260 __ |b Project Management Institute |c 04/07/2017
    300 __ |a
    490 0_ |a |v
    500 __ |a
    502 __ |a
    505 0_ |a
    650 _0 |a
    650 _0 |a
    651 _0 |a |x
    700 1_ |a |b |c |d
    710 1_ |a |b
    710 2_ |a |b
    711 2_ |a |n |c |d

    I need to delete this empty tags.
    Hugo

  5. Hello Hugo I suggest you use the syntax I provided with the “if not exists:
    ….
    then suffix “650.a” with “Zimbabwe” if (not exists “650.z.*”)

  6. Hi Daniela. You state “I would like help with a rule to add an endpoint (\\\\.) In the 1XX fields”.

    I am not quite sure exactly what you want. Is it to add a period at the end of the 1XX field?

    If so there is a rule above called “Add a field with a period in the middle and with a period at the end”.
    Does this achieve your desired goal?

  7. Hi Yoel,

    How can I correct invalid language codes: both fields 008 and 041 have capital letters as codes? For example: HEB or ENG.

    Thank you in advance,
    Anat

  8. Anat:
    Thank you for your message.
    You ask:
    “How can I correct invalid language codes: both fields 008 and 041 have capital letters as codes? For example: HEB or ENG.?”
    I respond:
    See “How to use normalization rules to change the text of invalid language codes in fields 008 and 041” at https://knowledge.exlibrisgroup.com/@api/deki/files/86260/How_to_use_normalization_rules_to_change_the_text_of_invalid_language_codes_in_fields_008_and_041.pptx

  9. Hello Yoel,

    Does the correctDuplicateFields action need to be in a separate rule?

    I was just testing a correction for our 650 fields and this (folowing your example):

    rule “Ajusta 650 para Autoridades”
    priority 2
    when
    TRUE
    then
    changeSecondIndicator “650” to “7”
    removeSubField “650.2”
    addSubField “650.2.UNESP”
    end

    rule “Deduplica 650”
    priority 1
    when
    TRUE
    then
    correctDuplicateFields “650”
    end

    Gave me the same result as this:

    rule “Ajusta 650 para Autoridades”
    priority 2
    when
    TRUE
    then
    changeSecondIndicator “650” to “7”
    removeSubField “650.2”
    addSubField “650.2.UNESP”
    correctDuplicateFields “650”
    end

    Thanks in advance,

    Oberdan

  10. Hello Oberdan
    As a “best practice” it is recommended to do as you did in your first example and separate the correctDuplicateFields “650”
    as a separate rule.
    In this way you are sure of the order in which this will occur (whereby you are using the priority function) and also it is easier to “debug” the entire rule when it consists of separate rules, rather than having all functions together.
    So in sum while both examples you give may to do the same thing, the first example is more “orderly” and easier to maintain.

  11. Hello Joel,
    I am wondering if you can give me an advice about a normalization rule for our Holdings.
    After to import a new catalogue in our Alma,
    We have the 852 in this way: 852 $$b SPMS $$c FG $$h 210.19 $$i Y957p
    We want to get the following: 852 $$b SPMS $$c FG $$h 210.19 Y957p
    I built a normalization rule:
    rule “copy 852.i to 852.h and remove 852.i”
    when
    (exists “852.i”)
    then
    prefixSubField “852.i” with ” ”  it cause troubles
    suffixSubField “852.h” with “852.i”
    RemoveSubField “852.i”

    But it not work when I add the line: prefixSubField “852.i” with ” “, we need to add a space before the 852.i content.
    How you can add a space like a prefix or suffix?
    Thanks in advance,
    Maribel Alvarado

  12. Hi Yoel,

    I am trying to add a period to the end of a subfield by using changeSubfield with the \\. but it doesn’t seem to be working. Does the \\. only work for addField?

    Thanks!

  13. Hi Alie:
    I added a new example specifically for this question. It is called “Add a period to the end of 500 subfield a if there is not already a period at the end”. Please see it above and try the syntax in this example. Thanks.

  14. Hi, Yoel:

    I am trying to write a rule that adds a local field (and all of its subfields). This is a field for recording the library, cataloger and the action taken on the record. There can be multiple of these fields in any given record, with different subfield values.

    When I preview the rule, it adds all the subfields I want in the new field to the existing fields as well! Which I don’t want. :\

    For example:

    BEFORE:
    962 $$a law $$b cdh $$c rev

    New field that I want to add:
    962 $$ a law $$b mmb $$c new

    AFTER (when I preview in MDE):
    962 $$a law $$b cdh $$c rev $$b mmb $cc new
    962 $$a law $$b mmb $$c new

    I cannot find an example of adding a field with multiple subfields in one line. When I add the subfields separately, the above is what happens.

    Thanks!

  15. Hello Melissa:
    First add it as a different field (not 962) which you do not use, then change it at the end to 962. That way you will not influence existing 962 fields.
    For example below I add the new field as YLK then at the end I change field YLK to 962:

    rule “add new field YLK to not change existing 962 fields”
    priority 99
    when
    (TRUE)
    then
    addField “YLK.{-,-}.a.law”
    addSubField “YLK.b.mmb”
    addSubField “YLK.c.new”
    end

    rule “change the YLK to 962”
    priority 98
    when
    (TRUE)
    then
    changeField “YLK” to “962”
    end

  16. Hi Yoel,

    I’m from University of Macau Library. The NR really helps a lot for our records. Now we are facing one difficulty to remove the “.” right before “/”.

    Example 1:
    Before:
    245 $$a A Brief relation of the plague at Naples, in the year M.DC.LVI. / $$c Translated out of Italian into English.
    After:
    245 $$a A Brief relation of the plague at Naples, in the year M.DC.LVI / $$c Translated out of Italian into English.

    Example 2:
    Before:
    245 $$a A Brief relation of the plague at Naples, in the year M.DC.LVI. $$h [electronic resource] : $$b Where died 10, some days 15, and one day 20000 at least, (some say 25000) and the next day but 500. : With observations, preservatives, and cures. / $$c Translated out of Italian into English.
    After:
    245 $$a A Brief relation of the plague at Naples, in the year M.DC.LVI. $$h [electronic resource] : $$b Where died 10, some days 15, and one day 20000 at least, (some say 25000) and the next day but 500. : With observations, preservatives, and cures / $$c Translated out of Italian into English.

    Can you please suggest on that. Thank you!

    Best regards,
    Linlin Geng
    University of Macau Library

    1. Dear Stephen Lei
      Please see example above called “Replace a period with nothing in 245 subfield a if it is followed by a space then a forward slash”

  17. Hi Yoel,

    I’m stuck with a problem. How can I conditionally remove fields that do or do not meet a certain criteria, when there are several of these fields?

    Example (imaginary):
    I have multiple 246 fields. I want to keep the ones with subfield $5 with a certain code, AND the ones without a $$5, but NOT the ones with $5 with a different code:

    246 33 $$a Field I want to keep $$5 NL-LeU
    246 33 $$a Field I also want to keep
    246 33 $$a Field I want to delete $$5 DLC

    How can I do this? The rules I make seem to evaluate all 246 fields in one go, so conditions I set are either always true or always false and thus remove all, or remove none.

    Thanks and regards,
    Martijn

    1. Hello. If you want to delete a certain field but only in certain cases then you can out a condition in the level of the field as opposed to the level of the rule.
      For example see the rule called “Remove field 035 if it begins with (OCoLC)” It has this line:
      removeField “035” if (exists “035.a.(OCoLC)*”)
      That means that there may be many 035 fields but only certain ones will be deleted (in this case only ones beginning with “(OCoLC)”

  18. Thanks for your reply.

    I must be missing something here, because that does not work. The condition does not evaluate every single marc-tag but evaluates them all at once. So my condition is always true, or always false.

    In my examples above, I want to remove only the MARC-field that has a $$5 that does NOT have “NL-LeU”. The field that has NO $$5 at all, has to remain also.

    I can’t know in advance what code is used in $$5, as there are thousands of institution codes that can appear there.

    Thanks,
    Martijn

  19. Hi Yoel,

    I’m from Harvard Library. I’m trying to create a norm rule that would flip the deprecated heading, “Sex change,” to “Gender transition”, but it is not working when I test it in the new MDE. My proposed norm rule is adapted from an existing norm rule that another staff member had written. But I’m also aware of the Alma “Swaziland LCSH update” example. My proposed rule is:

    rule “change 650 Sex change to Gender transition”

    // updates 650 from “Sex change” to “Gender transition”

    when
    exists “650.{*,0}.a.Sex change”

    then
    replaceContents “650.a.Sex change” with “Gender transition” if (exists “650.{*,0}.a.Sex change”)

    end

    The model for my rule is:

    rule “update qualifier in 651”

    // updates main hdg from “Debar Region (Macedonia)” “Debar Region (North Macedonia)”
    // geographic hdgs with free-floating terms (H362; e.g. Region) not updated by PTC (unless established as separate authority (e.g. sh 85015815 ))

    when
    exists “651.{*,0}.a.Debar Region (Macedonia)”

    then
    replaceContents “651.a.Macedonia” with “North Macedonia” if (exists “651.a.Debar Region*”)

    end

    I also have a couple of general questions:

    1. It doesn’t seem to matter (or does it?) whether one writes:

    when
    (True) [the Alma Swaziland example]

    or

    when
    exists “650.{*,0}.a.Sex change” [based on the local Debar example]

    To me (a non-programmer), both environments seem the same.

    2. It doesn’t seem to matter whether one uses indents or not (judging by the ExLibris examples, and if so, the number of spaces for the indents doesn’t seem to matter). Are indentations there just to make the code easier to read, or do they serve a functional purpose?

    3. The “if exists” statement can include the field indicators or not: if(exists “610.{*,0}.z.Swaziland”) vs. if (exists “651.a.Debar Region*”)

    4. For comments, you can preface them either by “//” or “#” or either?

    5. If and when my rule can be made to work, will it also work when the subject heading has subdivisions, or would a separate norm rule have to be created for each instance of a subdivision?

    e.g. Sex change–Case studies; Sex change–Chile, etc.

    Thank you for your help!
    Best,
    Craig Thomas

  20. p.s., I apologize; my formatting was lost after I had sent it. I can resubmit if it makes it easier for you to read. Craig Thomas

  21. Dear Craig:

    1. Please see working example which I added with title called “Change Sex change to Gender transition in 650 only when 2nd indicator is 0”
    2. In this specific rule after the initial “when” you can use “true” because there is a specific condition on the level of the replaceContents line. You do not need it on the level of the entire rule if you have it ion the level of the replaceContents
    3. Indents in the rule have no functional value, they just make the rule easier to read and understand
    4. Comments can be prefaced by either two forward slashes or a hash sign (// or #)
    5. The rule cited here in number 1 works whether there are or are not subdivisions. It will work for “650_0 $$a Sex change $$x history” and it will also work for “650_0 $$a Sex change”

    Thanks
    Yoel

  22. Hi Yoel,

    Thank you for vetting my example. And also for your answers to my question; they are very helpful to know. I’m wondering if I am still doing something incorrectly. I created the rule in the Shared file and input it exactly as you suggest. Bib is in the left pane; norm rule is in the right pane. But it doesn’t change the subject heading.

    Could it be a permissions issue? I’m not currently authorized to run batch jobs in Alma. Would that affect my ability to test a norm rule in the MDE on a single record?

    Thank you for your help!

    Craig

  23. Hi Yoel,
    Any hints on how to approach a norm rule that removes $8 with Holdings ID from holdings fields output by Alma general publishing while still retaining the instances of $8 for sequence number in caption/pattern fields 85X/86X. For example:

    =LDR 00288ny 22001213n 4500
    =001 222047986150003941
    =004 990085350100203941
    =008 0101104p\\\\8\\\2001uueng0020608
    =014 \\$a25290806$bOCoLC$8222047986150003941
    =852 8\$aMH-S$bGEN$hPERIODICAL$8222047986150003941
    =853 00$81$av.$bno.$i(year)$8222047986150003941
    =863 30$81.1$a8-$i1998-$8222047986150003941

    Thanks, Allison

  24. Dear Craig Thomas:
    Please see sample rule above called “Change Sex change with and without a period at the end to Gender transition in 650 only when 2nd indicator is 0”
    Thank you
    Yoel

  25. Hi Yoel,

    Can you provide me advice on changing the capitalization of titles in the MARC 222 and 245 field?

    222 CONTACT LENS JOURNAL
    222 Contact Lens Journal

    245 THE CONTACT LENS JOURNAL
    245 The Contact Lens Journal

    Regards,

    Sandra Morgan

  26. Hello Sandra:

    rule “Contact Lens Journal”
    when
    (TRUE)
    then

    ReplaceContents “222.a.CONTACT LENS JOURNAL” with “Contact Lens Journal” if(exists “222.a.CONTACT LENS JOURNAL”)
    ReplaceContents “222.a.CONTACT LENS JOURNAL” with “Contact Lens Journal” if(exists “222.a.CONTACT LENS JOURNAL\\\\.”)

    ReplaceContents “245.a.CONTACT LENS JOURNAL” with “Contact Lens Journal” if(exists “245.a.CONTACT LENS JOURNAL”)
    ReplaceContents “245.a.CONTACT LENS JOURNAL” with “Contact Lens Journal” if(exists “245.a.CONTACT LENS JOURNAL\\\\.”)
    end

  27. I would like to copy the first 5 characters of the 245 subfield a into the 092 subfield b for a group of DVDs. Then, I want to copy the whole 092 to the 852 h in the holdings record. Is there a way to do that? Thanks in advance for any help.

    1. Dear Skagit Valley:
      It is not possible via a normalization rule to
      1. copy pos. X to pos. Y of a non-control field to another field (what you refer to as “copy the first 5 characters of the 245 subfield a …”)
      2. copy a field from a bibliographic record to a holdings record (what you refer to as “copy the whole 092 to the 852 h in the holdings record”)
      Thank you.

  28. Could we add this as an example? I just got it to work, though I was told by EL Support that this wasn’t possible.

    rule “Primo VE – addtitle 246″
    when
    MARC.”246” has any “i,a,b,f,g,n,p”
    then
    set TEMP”1″ to MARC.”246″ sub without sort “i,a,b,f,g,n,p”
    replace string by string (TEMP”1″,””,”>”)
    kormarc remove nonfiling brackets MARC.”246″ sourcetag “246” from TEMP”1″
    create pnx.”display”.”addtitle” with TEMP”1″
    end

    What we are doing here is coding the brackets that may appear in MARC fields. For instance, in the 246:

    246 1_ |i Issues for called: |a NARFE magazine

    Currently displays like this in Primo VE:
    Other title Issues for called: NARFE magazine

    With the above Display Normalization rule, it now displays like this:
    Other title Issues for called: NARFE magazine

  29. Hi Yoel,

    Is is possible to write a condition that checks the length of a string?
    We need the length to be 21 characters with leading zeros.

    Thank you,
    Vicky

  30. Hello Vicky:
    You can check length of values from one position to another in control fields.
    For example this checks if position 0 of field 007 is “c”:
    removeControlField “007” if (existsControl “007.{0,1}.c”)
    This will check if positions 35-37 is “fre” in fieldf 008:
    (existsControl “008.{35,3}.fre”)

  31. Is there a way to add a subfield to the beginning of a field? This rule adds a $3 to the end of the 583. I’d like to add the $3 before the $a.

    rule “Add SCELC vols”
    when
    (TRUE)
    then
    addSubfield “583.3.v” if (exists “583.a.Committed*”)
    addField “866.{3,1}.8.0”
    addSubfield “866.{3,1}.a.v”
    end

  32. Hello Israel Yanez:
    First move the existing 583 to something else such as ABC (salience 10) Then instead of adding a subfield v to 583 (which no longer exists) add a new 583 with subfield v (salience 9) Change the old 583 with ABC back to 583 (salience 8) Combine the two 583s (salience 7).

    Need to rename and then name back the original 583 so that the order will be reversed in the new 583.

    rule “Add SCELC vols 1”
    salience 10
    when
    (TRUE)
    then
    changeField “583” to “ABC”
    end

    rule “Add SCELC vols 2”
    salience 9
    when
    (TRUE)
    then
    addField “583.3.v”

    addField “866.{3,1}.8.0”
    addSubfield “866.{3,1}.a.v”
    end

    rule “Add SCELC vols 3”
    salience 8
    when
    (TRUE)
    then
    changeField “ABC” to “583”
    end

    rule “Add SCELC vols 4”
    salience 7
    when
    (TRUE)
    then
    combineFields “583” excluding “”
    end

  33. I’ve tried using the example above for combining subfields (the 852 is used above). I’ve run into an issue when there are multiple instances of a field in a record. For example, I want to take 973 $p data and move it into $a. If there are multiple 973s in the record, then the $p data from the first one gets copied into all of the other 973 fields, which isn’t what I want. Do you have any advice?

  34. Hi Yoel
    I would like to know if it is possible to copy a field without the first and the last character which in my case, would be an asterisk.
    Since asterisk is a special character, I can’t use it in the condition.
    Best regards
    Joanne

  35. Hi Yoel,

    for a publishing I have to create a control field (003) with the content of a normal field (852.a with an ISIL). We have about 70 different contents in this field. So far I have not found a way by copyField or replaceContent, because of the difference between normal field and control field.
    Is there a possibilty to do this in one line or is it necessary to write 70 statements like
    when (TRUE)
    addcontrolField “003.DE-6” if (exists “852.a.DE-6”)
    addcontrolField “003.DE-6-A” if (exists “852.a.DE-6-A”)
    addcontrolField “003.DE-6-246” if (exists “852.a.DE-6-246”)
    # …
    end
    Thanks and best regards
    Rainer

  36. Hi Yoel,
    I’ve been trying to create a rule that would add a subfield 7 with text “nnas” to the field 773.
    Rule looks like that:
    rule “Add subfield $7 nnas”
    when
    (not exists “773.{0,-}.7.nnas”)
    then
    addSubField “773.{0,-}.7.nnas”
    end

    The problem is that in those records that need to be corrected, there are two 773 fields, the first one with indicators 0 and #, the other one with 1 and 8. And the rule adds the subfield 7 to both of those fields, even if I specified the indicators (as you can see above).
    Is there any way to create a rule that would add the subfield 7 only to the first 773 field?
    Best regards
    Katarzyna

  37. Hello Katarzyna:
    You can make a condition on the “add SubField” to only do it if the field is 773 with a first indicator 0.
    Then it won’t add it to the 773 with first indicator 1:

    rule “Add 773 7 nnas with condition”
    when
    (not exists “773.{0,-}.7.nnas”)
    then
    addSubField “773.{0,-}.7.nnas” if (exists “773.{0,-}”)
    end

  38. I changed the contition, because it seems like it should contain subfield information, not only field:

    rule “Add subfield $7 nnas”
    when
    (not exists “773.{0,-}.7.nnas”)
    then
    addSubField “773.{0,-}.7.nnas” if (exists “773.{0,-}.t”)
    end

    Now it works. Thank you for your help.
    Regards
    Katarzyna

  39. Hi Yoel,
    I’ve been trying to create a rule that will remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield $2 = reo

    Is there a way to do this?
    Kind regards
    Sandra

  40. Hi Sandra.
    See rule in this blog called “Remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield 2 abc”.
    Change “abc” to “reo” in your case.
    Thanks,
    Yoel

  41. Hi Yoel,

    We have just realized that we would also like to keep 6XX fields with a second indicator of 7 and subfield 2 lcgft; and 6XX fields with a second indicator of 7 and subfield 2 gsafd. How do I add these to the normalization rule?

    Kind regards

    Sandra

  42. Hello Sandra.
    See above rule “Remove all 6XX fields with a second indicator of 7 except 6XX fields with a second indicator of 7 and subfield 2 abc or def or ghi”.
    change the “abc” and the “def” and the “ghi” to whatever your subfield 2 values are.
    Thanks,
    Yoel

  43. Hi Yoel,

    Thank you so much for these invaluable examples.

    I am using your “Move anything after the forward slash in 250 subfield a to 250 subfield b” rule to split 245 subfield a into subfield a and b, using a colon instead of a forward slash, and it is working well.

    However, the records in Alma don’t register the new “$$b” as a subfield rather than just title data, until the record is opened in the MDE and saved. Is there any bulk way to do this, so I don’t have to open each changed record in MDE and save it individually? Please let me know if I am doing something wrong. My norm rule is as follows:

    rule “move anything after the colon in 245 subfield a to 245 subfield b”
    when
    (exists “245.a” ) AND (not exists “245.a.Book review*”)
    then
    replaceContents “245.*.:” with “:$_separator_$b”
    replaceContents “245.*._separator_” with “”
    end

    Kind regards, Abigail

  44. Hello Abigail:
    Please try as follows. Note
    1. If you copy and paste this you may need to retype the quotation marks
    2. Before you run it on a set test on a variety of records one at a time.

    rule “move anything after the colon in 245 subfield a to 245 subfield b”
    when
    (exists “245.a” ) AND (not exists “245.a.Book review*”)
    then
    replaceContents “245.a.:” with ” :_separator_”
    splitSubField “245.a._separator_”
    changeSubFieldExceptFirst “245.a” to “b”
    end

  45. Hello Abigail:
    Here is another option:

    rule “move anything after the colon in 245 subfield a to 245 subfield b”
    when
    (exists “245.a” ) AND (not exists “245.a.Book review*”)
    then
    replaceContents “245.a.:” with ” :_separator_”
    addSubField “245.b._placeholder_”
    replaceSubFieldContents “245.b” with “245.a”
    replaceContents “245.a._separator_*” with “”
    replaceContents “245.b.*_separator_” with “”
    end

  46. Perfect, Yoel, your first rule fixed the problem. I will look into the second one as well if any other issues come up.

    I really appreciate your help, and such a quick response! Many thanks.

  47. Hi,
    We found a problem. We have a NR for copy first 690$a to 090$a. Here’s logic:
    rule “copyFirst690.a to 090.a”
    when
    (true)
    then
    copyField “690.a” to “091.a”
    combineFields “091” excluding “b”
    changeSubFieldExceptFirst “091.a” to “s”
    copyField “091.a” to “090.a”
    end

    It’s working well when enhance a new record.
    But here’s the problem: when we run this after another enhancement, it’s not working.
    The another enhancement is composed of two other NRs and a process.

    It looks like the result of this NR execution is also affected by the enhancement effect of the previous one.
    That’s weird.

  48. Hello Yoel,

    I am trying to add subfield h to field 245 but I am having difficulty ensuring that the Marc semi colon remains in front of subfield b. This is what I have so far:

    rule “Add subfield h to field 245 with text electronic resource if there is no subfield h in field 245 ”
    when
    not exists “245.h.*”
    then
    addSubField “245.h.[electronic resource]”
    moveSubfieldsToEndOfField “245” “a,p,n,h,b,c”
    end

    and this is the result:
    $$a Sports in society : $$h [electronic resource] $$b issues and controversies / $$c Jay Coakley, Ph. D., University of Colorado, Colorado Springs.

    Thank you for your advice.
    Kind regards
    Sandra

  49. Martijn, did you ever find a solution to your question about removing fields with a $5 code that have any value other than your own library? (We’re looking at this issue as well.)

  50. Hello,

    does anybody know how to match an asterisk in a MARC field? I have a bunch of records with 245$$b ending in `.**` which I’m trying to tidy up using a modified version of the “Remove the last comma in 500 subfield a and do not touch the other commas” example drool above. But there seems no way to match the asterisk in this case. I tried escaping it with two or four backslashes without success:

    `replaceContents “245.b.\\\\.\\\\*\\\\*temporary_suffix_to_replace” with “”`
    or
    `replaceContents “245.b.\\\\.\\*\\*temporary_suffix_to_replace” with “”`

    None will work on `245$$a Zukunftsperspektiven des Marketing-Paradigmenwechsel und Neuakzentuierungen. $$b Festschrift anlässlich der Emeritierung von Prof. Dr. Dr. h. c. Hans Hörschgen.** $$c Rabe, Christina`

    Thanks.
    Kind regards,
    Georg

  51. Hello,

    I’m trying to add field 006 position 0 = m.
    I tried several rules, but nothing seems to work.
    the latest version I tried is:

    rule “add field 006 if not exists ”
    when
    (TRUE)
    then
    replaceControlContents “006.{0,1}” with “m”
    end

    Did anyone encounter this issue?

    All the best,
    Netanel

  52. Yoel,

    We already got the first letter of library of congress number by using the normalization rule.

    We would like to judge whether it is “A”, “B”. “C”, etc, then adding the suffix.
    However, this line TEMP”1″ has “A” not correct. Are there any way to create a judge syntax like if clause.

    rule “Primo VE Marc – Lsr02”
    when
    MARC is “090”.”a”
    then
    #create pnx.”display”.”lds02″ with MARC “090”.”a”
    set TEMP”1″ to MARC “090”.”a”
    replace string by string (TEMP”1″,”^(.{1}).*”,”$1″)
    when
    TEMP”1″ has “A”
    then
    add suffix (TEMP”1″,” – Philosophy “)

    create pnx.”search”.”lsr02″ with TEMP”1″
    end

    Any help would be appreciated.

  53. Hi Yoel,

    I want to change a numeric string, starting with 0-5 repetitions of zero’s, so that the zero’s are omitted.

    For example, turn 012345 into 12345, and 00054321 into 54321.

    I tried a few simple rules, but they don’t work.
    For example:

    when
    exists “035.a.{0,1}.0”
    then
    replaceContents “035.a.{0,1}” with “”
    end

    Any ideas?

    Thank you!
    Shunit

  54. Hi !

    The february Alma release let us know that there is now a possiblity to “use a dedicated normalization process in the import profile to update the data used in inventory and POL mapping. For example, a library may remove the currency information from the List price field”.
    What would the syntax be to remove the currency information ?

    For example, when importing .mrk files from Books in print, we have In (MARC21) :
    =020 \\$a9780691213569
    =020 \\$a0691213569 (Trade Cloth)$cUSD 65.00 Retail Price (Two Rivers Distribution)$9Active Record

    We’d like to have Out (UNIMARC) :
    947__ $$b 65.00

    Thanks for your help !

  55. Hi Yoel,

    Is it possible to add a hyphen in the middle of a string with fixed length?
    The customer would like to add a missing hyphens to ISSN’s.
    For example, convert 12345678 to 1234-5678.

    Thanks,
    Vicky

    1. Hello Vicky:
      This is possible using a regular expression.
      See new entry “Add a hyphen after the 4th digit in 022 subfield a if 022 subfield a contains 8 digits”
      Thanks

  56. Hi Yoel,
    I would like to remove the last period of this local field.

    In
    690 $a.variable content.
    Out
    690 $a.variable content

    I tried to use replaceContents “690.a..” with “” but didn’t work. Could you help? Thanks

  57. Hello Swetta
    See new rule I added to this blog called “Delete the period at the end of 690 subfield a when the text of 690 a is “Variable content””.

  58. Hi Yoel
    I’m having trouble with this normalization rule. The period at the end of EXAMPL.NOTE. is not showing when I run the rule.

    Here is the normalization rule:

    rule “add subfield x with note EXAMPL.NOTE.”
    when
    (TRUE)
    then
    addSubField “852.x.EXAMPL.NOTE.”
    end

    Please help. Thank you

    1. Hi Rose
      For the period at an end of a string you need the slashes as follows:

      rule “add subfield x with note EXAMPL.NOTE.”
      when
      (TRUE)
      then
      addSubField “852.x.EXAMPL.NOTE\\\\.”
      end

  59. Hi Yoel

    I want to create a normalization rule for holdings to fix the call number spacing issues. I want to add space between the DDC number and the author mark as some records have call numbers like this “610.73ANT”.

    Regards
    Asif

    1. Hi Asif:
      Could we make this more specific? For example is it correct to say as follows:?
      Any time there is a number and then a capital letter with no space between them then put a space between them.
      Thanks,
      Yoel

  60. Hi Yoel

    Yes, exactly the same as what you mentioned.

    Any time there is a number and then a capital letter with no space between them then put a space between them.

    Regards
    Asif

  61. Hi Yoel,

    I’m trying to convert Roman numbers to Arabic numbers. (xx into 20)

    replaceContents “996.a.x” with “10”
    replaceContents “996.a.xx” with “20”

    But when I run it, xx is turned into 1010.

    How can I indicate the end of the line? \$?

    I saw special codes like \b, \t, \n, \r. I don’t know what they mean. Any advice?

    Thanks,
    Misu

    1. Hi Misu:

      You need to reverse the order because it is reading first to change x to 10, so when it has xx it does “1010”.
      You should have it first look for xx , which it will change to 20, and then look for x

      Instead of
      replaceContents “996.a.x” with “10”
      replaceContents “996.a.xx” with “20”

      Do

      replaceContents “996.a.xx” with “20”
      replaceContents “996.a.x” with “10”

      Thanks
      Yoel

  62. Hi,

    I have records with data like this:

    965 $a Medicine
    965 $a Law
    965 $a History
    965 $a History $b History: United Kingdom
    965 $a History $b History: United States

    How do I only remove the line with 965 $a History?

    I’ve tried embedding the condition at the field level like this, but I get an error:
    removeField “965” if (exists “965.a.History”) and (not exists “965.b.*”)

    Cheers,
    Stacey

  63. My last comment is awaiting moderation, but I believe I’ve figured it out with a temp flow:

    when
    (TRUE)
    then
    replaceContents “965.a.History” with “temp” if (exists “965.b.*”)
    removeField “965” if (exists “965.a.History”)
    replaceContents “965.a.temp” with “History” if (exists “965.b.*”)
    end

    Cheers, Stacey

  64. Hi Yoel,

    I’m trying to make use of the containsScript condition to create a $9 with the correct language code in each subject marc field, such as repeating 650.

    The condition syntax seems to work only on the record level, and not on the field level.
    So, each 650 field shares all the language indications that exist in all the other 650 fields.

    For example when I use this on a record with 2 650 fields, one with a subject in Hebrew and another in English:

    rule “Is 650 Heb”
    when
    containsScript “Hebrew” “650.a”
    then
    addSubField “650.9.heb”
    end

    rule “Is 650 Eng”
    when
    containsScript “Latin” “650.a”
    then
    addSubField “650.9.eng”
    end

    I get this in the record:
    650 0 $$ עברית $$9 eng $$9 heb
    650 0 $$a English $$9 eng $$9 heb

    Trying to use the condition in the field level gets a syntax error:
    Then
    addSubField “650.9.heb” if (not exists containsScript “Hebrew” “650.a”)

    Same with trying the negative rule in the rule condition:
    when
    (containsScript “Hebrew” “650.a” AND not exists containsScript “English” “650.a”)

    I will be happy to have your advice.

    Best,
    Shunit

    1. Hello Shunit
      I added this to Alma Normalization Rule Examples blog now.
      It is called “Add subfield 9 with value “eng” to 650 field if 650 subfield a has English characters and add subfield 9 with value “heb” to 650 field if 650 subfield a has Hebrew characters.”
      Instead of using ‘containsScript’ I use ‘if (exists …’
      The character set is checked using a regular expression.
      Have a nice day,
      Yoel

  65. Hi Yoel,
    I’m trying to understand a normalization rule someone introduced into a process in our system earlier that looks like it was taken from here, but what she said it does is different from what your post says it does, which is different from what I would assume it does.
    The rule is rule “delete 863 4 5 6 7 8 if it does not have subfield 8 9”. Here you say it will delete the field if it doesn’t have a subfield 9, she said it would delete the field if it doesn’t have a subfield 8 or 9, but my understanding of the syntax is that it would delete the subfield unless it has a subfield 8 that has a value of 9. Here’s the relevant bit of the rule:

    when
    (TRUE)
    then
    removeField “863” if (not exists “863.8.9”)
    removeField “864” if (not exists “864.8.9”)
    removeField “865” if (not exists “865.8.9”)
    removeField “866” if (not exists “866.8.9”)
    removeField “867” if (not exists “867.8.9”)
    removeField “868” if (not exists “868.8.9”)
    end

    Can you clarify what exactly this code does?

    Thanks,
    Susan

    1. Hello Susan
      To make this more clear I have:
      1. Changed the description of the rule in the blog to “Remove fields 863 to 868 if they do not have a subfield 8 with a value of 9”. This should be clear now.
      2. Added a before and after picture which shows that
            A. The field which does not have subfield 8 with value 9 gets deleted.
            B. The field which does have subfield 8 with value 9 does not get deleted.
      Please let me know if now it is clear.
      Thank you,
      Yoel

  66. Hi Yoel

    I want to create a normalization rule for the bib record to store the record of the person who created or midfield the bib record in any of the local MARC tags, like this given format (FYI, I took this format from ILS Virtua).

    $$a 202312291651 $$b staff1 $$c 202205021818 $$d staff2 $$c 202104131812 $$d staff3.

    Regards
    Asif

    1. Hello Asif:
      It is not possible to use a normalization rule to put the staff user who created or modified the bibliographic record in any of the local MARC tags into a bibliographic field. You can see who edited a bibliographic record and when, and how it differs from the previous version, in the metadata editor at “view related data > view versions”

  67. Hi Yoel,

    I want to create a normalization rule that copies everything before the first comma in 100 $a into a new field. How would I accomplish this?

    Thanks in advance,
    Kristen

    1. Hi Kristen:
      I have created a new rule which does this and put it in the blog.
      See “Copy everything before the comma in 100 subfield a to 913 subfield a”.
      Have a nice day,
      Yoel

Leave a Reply