#!/usr/bin/perl -w use MARC::Crosswalk::DublinCore; use MARC::File::USMARC; use utf8; binmode(STDOUT, ":utf8"); $/ = chr(29); print qq|\n|; while (my $blob = <>) { my $marc = MARC::Record->new_from_usmarc( $blob ); my $crosswalk = MARC::Crosswalk::DublinCore->new( qualified => 0 ); my $dc = $crosswalk->as_dublincore( $marc ); my $has_content = 0; for( $dc->elements ) { if (!$has_content) { $has_content = 1; print qq|\n|; } my $element = lc($_->name); my $qualifier = lc($_->qualifier); my $scheme = lc($_->scheme); my $content = $_->content; $content =~ s/&/&/gs; $content =~ s//>/gs; if ($element eq 'creator') { $element = 'contributor'; $qualifier = 'author'; $content =~ s/[0-9]//g; $content =~ s/comp\.//g; $content =~ s/col\.//g; $content =~ s/dir\.//g; $content =~ s/prĂ³l\.//g; $content =~ s/coord\.//g; $content =~ s/ed\.//g; $content =~ s/^\s+|\s+$//g; } if ($element eq 'format') { $element = 'description'; $qualifier = ''; } if ($element eq 'language') { $qualifier = 'iso'; } if ($element eq 'type') { $element = 'type'; $qualifier = ''; } if ($element eq 'subject') { $content =~ s/[0-9]//g; $content =~ s/^\s+|\s+$//g; } if ($element eq 'title') { $content =~ s/\[[^][]*\]//g; $content =~ s/^\s+|\s+$//g; } if ($element eq 'identifier') { $element = 'relation'; $qualifier = 'uri'; } printf qq| %s\n|, $content; } else { printf qq|>%s\n|, $content; } } print qq|\n| if $has_content; } print qq|\n|; exit;