Appendix C — MARCspec tutorial

QA Catalogue uses Carsten Klee’s specification, MARCspec - A common MARC record path language (version 0.16beta+2) for addressing a particular data element in a MARC21 or UNIMARC record. It can be used in filtering, extraction and Shacl4Bib expression. The following provides some examples.

Typographical conventions:

C.1 Get the Leader

MARCspec expression: ldr or LDR

MARC21 record MARCspec returns
LDR 02157cas a2200517Ka 4500 LDR 02157cas a2200517Ka 4500
ldr 02157cas a2200517Ka 4500

C.1.1 Get a position in the leader

MARCspec expression: ldr/<number+|#> or LDR/<number+|#>

A number means the Nth position of the Leader string (starts from 0). The special character # means the last position.

MARC21 record MARCspec returns
LDR 02157cas a2200517Ka 4500 LDR/6 a
LDR/# 0

C.1.2 Get a position range in the Leader

MARCspec expression: ldr/<number+>-<number+|#> or LDR/<number+>-<number+|#>

A number means the Nth position of the Leader string (starts from 0). The special character # means the last position.

MARC21 record MARCspec returns
LDR 02157cas a2200517Ka 4500 LDR/0-4 02157

C.2 Get a Control Field

MARCspec expression: 00<number>

MARC21 record MARCspec returns
001 010000178 001 010000178
003 SIRSI 003 SIRSI

C.2.1 Get a Control Field position

MARCspec expression: 00<number>/<number+|#>

MARC21 record MARCspec returns
001 010000178 001/0 0
001/# 8

C.2.2 Get a position range in a Control Field

MARCspec expression: 00<number>/<number+>-<number+|#>

MARC21 record MARCspec returns
001 010000178 001/1-# 10000178

C.3 Get a Data Field

MARCspec expression: <number><number><number>

MARC21 record MARCspec returns
080 ## $a821.124 080 080 ## $a821.124

C.3.1 Get a Data Field - with masking

MARCspec expression: <number|.><number|.><number|.>

Where . (dot character) represents any number

MARC21 record MARCspec returns
020 ## $a010000178
080 ## $a821.124<br>084 ## $a014
0.0 020 ## $a010000178
080 ## $a821.124

C.3.2 Get Data Field(s) by index

MARCspec expression: <number|.><number|.><number|.>[<number|#>]

MARC21 record MARCspec returns
300 ##$a149 pages ;$c23 cm
300 ##$a1 score (16 p.) ;$c29 cm
300 ##$a11 volumes :$billustrations ;$c24 cm
300 ##$a1 map :$bcol. ;$c30 x 55 cm
300[0] 300 ##$a149 pages ;$c23 cm
300[1] 300 ##$a1 score (16 p.) ;$c29 cm
300[#] 300 ##$a1 map :$bcol. ;$c30 x 55 cm

C.3.3 Get Data Field(s) by index range

MARCspec expression: <number|.><number|.><number|.>[<number|#>-<number|#>]

MARC21 record MARCspec returns
300 ##$a149 pages ;$c23 cm
300 ##$a1 score (16 p.) ;$c29 cm
300 ##$a11 volumes :$billustrations ;$c24 cm
300 ##$a1 map :$bcol. ;$c30 x 55 cm
300[0-2] 300 ##$a149 pages ;$c23 cm
300 ##$a1 score (16 p.) ;$c29 cm
300 ##$a11 volumes :$billustrations ;$c24 cm
300[1-#] 300 ##$a1 score (16 p.) ;$c29 cm
300 ##$a11 volumes :$billustrations ;$c24 cm
300 ##$a1 map :$bcol. ;$c30 x 55 cm
300[#-1] 300 ##$a11 volumes :$billustrations ;$c24 cm
300 ##$a1 map :$bcol. ;$c30 x 55 cm

C.3.4 Get an Indicator

MARCspec expression: <number|.><number|.><number|.>^<1|2>

Where 1 and 2 represent the first and second indicator.

MARC21 record MARCspec returns
080 ## $a821.124
084 ## $a014
080^1 #

C.3.4.1 Get Indicator of an indexed DataField

MARCspec expression: <number|.><number|.><number|.>[<number|#>]^<1|2>

Where 1 and 2 represent the first and second indicator.

MARC21 record MARCspec returns
080 #1 $a821.124
080 #2 $a014
080[1]^2 2

C.3.5 Get a Subfield

MARCspec expression: <number|.><number|.><number|.>$<character>

MARC21 record MARCspec returns
245 15 $aThe “winter mind” :
$bWilliam Bronk and American letters /
$cBurt Kimmelman
245$a The “winter mind” :

C.3.6 Get multiple Subfields

MARCspec expression: <number|.><number|.><number|.>($<character>)+

MARC21 record MARCspec returns
245 15 $aThe “winter mind” :
$bWilliam Bronk and American letters /
$cBurt Kimmelman
245$a$b [ 'The “winter mind” :', 'William Bronk and American letters' ]

C.3.7 Get Subfield of an indexed DataField

MARCspec expression: <number|.><number|.><number|.>[<number|#>]($<character>)+

MARC21 record MARCspec returns
300 ##$a149 pages ;$c23 cm
300 ##$a1 score (16 p.) ;$c29 cm
300[1]$a 1 score (16 p.) ;