Set of tools to deal with MARC records.
Creates a SQLite DB with the OCLC (MARC Tag 001) number and the position of the record inside the file.
This is helpful for big MARC files that consist of thousands or millions of records.
use Umlts\MarcToolset\MarcMapWriter;
$db = new SQLite3( $db_file );
$mm = ( new MarcMapWriter( $marc_file, $db ) )->map();
Looks up a MARC record by OCLC (MARC Tag 001) number and reads it.
use Umlts\MarcToolset\MarcMapReader;
$mr = new MarcMapReader( $marc_file, $db );
try {
$file_marc_record = $mr->get( $oclc_number );
echo $file_marc_record;
} catch ( MarcRecordNotFoundException $e ) {
echo "Record not found.";
}
use Umlts\MarcToolset\MarcDump;
// Create object and call method
$marc_file = __DIR__ . '/../data/random.mrc';
( new MarcDump( $marc_file ) )->dump();
// or call statically
MarcDump::dump( $marc_file );
use Umlts\MarcToolset\MarcCount;
$marc_file = __DIR__ . '/../data/random.mrc';
// Create object and call method
echo ( new MarcCount( $marc_file ) )->count();
// or call statically
echo MarcCount::count( $marc_file );
use Umlts\MarcToolset\MarcLint;
$marc_file = __DIR__ . '/../data/random.mrc';
// Create object and call check method
( new MarcLint( $marc_file ) )->check();
// or call statically
MarcLint::check( $marc_file );