Top Level Namespace

Defined Under Namespace

Modules: Marc2LinkedData

Constant Summary collapse

EXAMPLE_RECORD_FILE =

EXAMPLE_RECORD_FILE=‘../marc/catalog/stf.00.mrc’

'../marc/catalog/stf.51.mrc'
LEADER_STATUS_CODES =

From www.loc.gov/marc/authority/adleader.html System-Generated Elements - The following Leader elements are usually system generated:

00-04 Logical record length

05 - Record status:
 a - Increase in encoding level
 c - Corrected or revised
 d - Deleted
 n - New
 o - Obsolete
 s - Deleted; heading split into two or more headings
 x - Deleted; heading replaced by another heading

06 - Type of record
 z - Authority data

07-08 Undefined character positions

09 - Character coding scheme
 # - MARC-8
 a - UCS/Unicode

10 	Indicator count
 2 - Number of character positions used for indicators

11 	Subfield code count
 2 - Number of character positions used for a subfield code

12-16 Base address of data

 [number] - Length of Leader and Directory

17 - Encoding level
 n - Complete authority record
 o - Incomplete authority record

20-23 Entry map

18-19 - Undefined character positions

20 - Length of the length-of-field portion
 4 - Number of characters in the length-of-field portion of a Directory entry

21 - Length of the starting-character-position portion
 5 - Number of characters in the starting-character-position portion of a Directory entry

22 - Length of the implementation-defined portion
 0 - Number of characters in the implementation-defined portion of a Directory entry

It is common for default values in other Leader elements to be generated automatically as well. Capitalization - Alphabetic codes are input as lower case letters.

example: record.leader

> “00774cz a2200253n 4500”

00-04: ‘00774’ - record length 05: ‘c’ - corrected or revised 06: ‘z’ - always ‘z’ for authority records 09: ‘a’ - UCS/Unicode 12-16: ‘00253’ - base address of data, Length of Leader and Directory 17: ‘n’ - Complete authority record

{
  'a' => 'Increase in encoding level',
  'c' => 'Corrected or revised',
  'd' => 'Deleted',
  'n' => 'New',
  'o' => 'Obsolete',
  's' => 'Deleted; heading split into two or more headings',
  'x' => 'Deleted; heading replaced by another heading'
}
SUL_URI =

Create SUL LOD…

RDF::URI.new('http://linked-data.stanford.edu/library/')
CAT_URI =
SUL_URI.join("catalog/#{cat_key}")

Instance Method Summary collapse

Instance Method Details

#leader_parse(record) ⇒ Object



97
98
99
100
101
102
103
104
105
106
# File 'lib/marc2linkeddata/readMarcCatalog.rb', line 97

def leader_parse(record)
  leader = {
    :length => record.leader[0..4].to_i,
    :status => record.leader[5],  # LEADER_STATUS_CODES[ record.leader[5] ]
    :type => record.leader[6],    # always 'z' for authority records
    :encoding => record.leader[9],  # TODO: translate letter code into ruby encoding string
    :data_address => record.leader[12..16].to_i,
    :complete => record.leader[17].include?('n')
  }
end