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:
#
represents a space (e.g. in the indicator positions)<number>
represents a number.
represents a character mask (fits to any charater)<A|B>
represents list of options (A
orB
)+
represents repetition (the previous character or character group is repeatable)(...)+
represents a repeatable character group
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 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.3 Get an 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.4 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' ] |