Tech Blog

Alma Normalization Rule Examples

see also: Working with normalization rules

Note that if you do copy/paste here make sure the quotation marks transfer correctly.

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

(it uses a temprary 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

Remove all fields of record except 020 ISBN and 001 MMSID

rule "remove all fields except 020 ISBN and 001 MMSID"
# This rule first copies the 020 to temporary field ABC then deletes all other fields except 001 then puts the ABC back to 020
when
(TRUE)
then
copyField "020" to "ABC"
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"
removeField "ABC"
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

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 subfield 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

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

Add field 900 depending on contents of control field 008

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

Replace a backslash with nothing

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 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 “The Thomas J. Safransky Collection” if 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 337 337 and 338

rule "add RDA fields 336 337 and 338"
when
  (not exists "336")
then
  addField "336.a.CONTENT_TYPE"
end

rule "add Bib 337"
when
  (not exists "337")
then
  addField "337.a.MEDIA_TYPE"
end

rule "add Bib 338"
when
  (not exists "338")
then
  addField "338.a.CARRIER_TYPE"
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

Change a backslash to nothing in 245 subfield a

rule "replace a backslash with nothing (blank)"
    when
         (TRUE)
     then
            replaceContents "245.a.\\" with ""
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/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 a period 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

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

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 and populate 007 position 7-10 year from 260 and 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

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

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

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

Leave a Reply