Skip to content
ruby scripts for handling MARC
Ruby Perl
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README
csv2rdf.rb
example.csv
example.rdf
marc2csv.rb
marc2xml.rb
marcdump.rb
marcfix.pl

README

### MARCTOOLS - Collection of MARC conversion tools
### Ruby and Perl scripts

# Creator: Benjamin Rokseth
# Date: 15.11.2011

##########
## csv2rdf.rb -- ruby script to Convert comma-separated table to semantic markup using headers as properties
##########

## FEATURES ##
takes csv and uses column headers as properties
first column is used as resource id, using base_uri from command line
rdf type given in command line
output can be .nt .rdf or .n3

## USAGE ##
csv2rdf.rb  -i input_file.csv -o output_file -b base_uri -t rdf_type [-r recordlimit]
  -i input_file must be comma-separated file
  -o output_file extension can be either .rdf (slooow) .n3 (sloow) or .nt (very fast)
  -b base_uri must be uri
  -t rdf_type must be uri
  -r [number] stops processing after given number of records
  
## EXAMPLE ##
ruby csv2rdf.rb -i example.csv -b http://example.com/bookreviews/ -t http://purl.org/stuff/rev#Review -o example.rdf

##########
## marc2csv.rb -- ruby script to convert NORMARC file to CSV
##########

Usage: ruby marc2csv.rb -i input_file.mrc -o output_file.csv [-r recordlimit]

##########
## marcfix.pl  -- Perl script removes breaking 000 fields from NORMARC
##########
Usage: perl marcfix.pl inputfile.mrc > outputfile.mrc

##########
## marc2csv.rb -- ruby script to convert NORMARC binary file to CSV
########## 
Usage: ruby marc2xml.rb -i InputFile.mrc [-o OutputFile.csv] [-r recordlimit]\n"
  
## REQUIREMENTS ##
ruby >= 1.8.7
rdf.rb (thanks to Arto Bendiken et.al. for the brilliant RDF library for ruby)
rdf-rdfxml.rb (for rdf-xml output, requires development libraries libxml2 and libxslt1)
rdf-n3.rb (for n3 output)

## UBUNTU INSTALL ##
(for rdf-xml support)
sudo apt-get install libxml2-dev libxslt1-dev
gem install rdf rdf-rdfxml rdf-n3 (csv if ruby < 1.9)
Something went wrong with that request. Please try again.