星期五, 3月 09, 2007

zoom.pl nbinet.ncl.edu.tw marc

#!/usr/bin/perl -w

use ZOOM;
use MARC::Record;
use Encode;
use MARC::Batch;

$conn = new ZOOM::Connection("nbinet.ncl.edu.tw:210/innopac");
#$conn = new ZOOM::Connection("140.136.208.1:210/innopac");
print("主機:",$conn->option("serverImplementationName"),"\n");
$conn->option(preferredRecordSyntax => "usmarc");
#$rs = $conn->search_pqf('@attr 1=4 perl');
#$ss = $conn->scan('@attr 1=1003 a');

# if ($conn->errcode() != 0) {
# die("somthing went wrong: " . $conn->errmsg())
# }
# $conn->destroy();
# $rs = $conn->search_pqf('@attr 1=7 957493327X');
$rs = $conn->search_pqf('@attr 1=4 @attr 4=107 100');
my $n = $rs->size();
for my $i (1 .. $n) {
$rec = $rs->record($i-1);

# print $rec->render(); $rec->raw();
# print $rec->raw() . "\n";
# print "========================\n";

my $b = $rec->raw();
my $l =length ($b);
my $transl= '';
my $status = 0;
my $tmp ='';


for ($i=0; $i<$l; $i++) {
my $key = substr($b,$i,1);
if ($status == 0){
if (ord($key) != '27') {
$transl=$transl.$key;
}
else
{
$status = 1;
}
}
if ($status == 1){
if (ord($key)==36){ $status = 2; }
}
if ($status == 2) {
if (ord($key)==49){
$status = 3;
$count = -1 ;
}
}
if ($status == 3) {
if (ord($key) == '27' )
{ $status = 4;}
else {
if ($count == -1 ) {
$count = 0;
}
else {
$tmp=$tmp.$key;
}
}
}

if ($status == 4) {
if (ord($key) ==40) { $status = 5 ;}
}
if ($status == 5) {
if (ord($key) == 66) { $status = 6;}
}
if ($status == 6) {
$transl=$transl.decode('cccii',$tmp);
$status = 0;
$tmp='';
}
}
print $transl;
# $rec->render() => usmarc, $rec->raw() => iso2709
#print decode('cccii',$rec->raw()) , "\n";
}

星期三, 3月 07, 2007

cccii convert utf8

#!/usr/bin/perl -w

use ZOOM;
use MARC::Record;
use Encode;
use MARC::Batch;

$conn = new ZOOM::Connection("nbinet.ncl.edu.tw:210/innopac");
#$conn = new ZOOM::Connection("140.136.208.1:210/innopac");
print("主機:",$conn->option("serverImplementationName"),"\n");
$conn->option(preferredRecordSyntax => "usmarc");
#$rs = $conn->search_pqf('@attr 1=4 perl');
#$ss = $conn->scan('@attr 1=1003 a');

# if ($conn->errcode() != 0) {
# die("somthing went wrong: " . $conn->errmsg())
# }
# $conn->destroy();
$rs = $conn->search_pqf('@attr 1=7 957493327X');
my $n = $rs->size();
for my $i (1 .. $n) {
$rec = $rs->record($i-1);

# print $rec->render(); $rec->raw();
# print $rec->raw() . "\n";
# print "========================\n";

my $b = $rec->raw();
my $l =length ($b);
my $transl= '';
my $status = 0;
my $tmp ='';


for ($i=0; $i<$l; $i++) {
my $key = substr($b,$i,1);
if ($status == 0){
if (ord($key) != '27') {
$transl=$transl.$key;
}
else
{
$status = 1;
}
}
if ($status == 1){
if (ord($key)==36){ $status = 2; }
}
if ($status == 2) {
if (ord($key)==49){
$status = 3;
$count = -1 ;
}
}
if ($status == 3) {
if (ord($key) == '27' )
{ $status = 4;}
else {
if ($count == -1 ) {
$count = 0;
}
else {
$tmp=$tmp.$key;
}
}
}

if ($status == 4) {
if (ord($key) ==40) { $status = 5 ;}
}
if ($status == 5) {
if (ord($key) == 66) { $status = 6;}
}
if ($status == 6) {
$transl=$transl.decode('cccii',$tmp);
$status = 0;
$tmp='';
}
}
print $transl;
# $rec->render() => usmarc, $rec->raw() => iso2709
#print decode('cccii',$rec->raw()) , "\n";
}

new project copy trad-chinese zh_TW marc

new koha project
mirror all http://nbinet.ncl.edu.tw/ marcdata to koha breedings
about 5 million records,these marcdatas have to decode cccii to
utf8.

use perl script & modules
innopac use " { "cccii code " } "

innopac cccii

連接 INNOPAC 圖書館的CCCII編碼方式已經解決了, 他們是用 "{}"
來把每一個字括起來

eg.

字1,字2 = { + 字1 + } + { + 字2 + } = {212321}{212324}

星期二, 3月 06, 2007

catalog

http://140.136.208.1/search/.b1002201/.b1002201/1,1,1,B/marc~b1001204?save=b1001204/++export/1,-1,-1,B/export?ex_format=50&ex_device=43

http://140.119.115.1:1080/search/.b1799783/.b1799783/1,1,1,B/marc~b1799780?save=b1799780

http://140.119.115.1:1080/search/.a1/++export/1,-1,-1,B/export?ex_format=50&ex_device=45

http://140.136.208.1/search/.a1/++export/1,-1,-1,B/export?ex_format=50&ex_device=45

http://tulips.ntu.edu.tw/search/.a1/.a1/1,1,1,B/marc~b1799780?save=b1799780

http://tulips.ntu.edu.tw/search/.a1/++export/1,-1,-1,B/export?ex_format=50&ex_device=45

http://140.136.208.1/search/.b1002201/.b1002201/1,1,1,B/marc~b1001204?save=b1001204/++export/1,-1,-1,B/export?ex_format=50&ex_device=43

http://140.119.115.1:1080/search/.b1799783/.b1799783/1,1,1,B/marc~b1799780?save=b1799780

http://140.119.115.1:1080/search/.a1/++export/1,-1,-1,B/export?ex_format=50&ex_device=45

http://140.136.208.1/search/.a1/++export/1,-1,-1,B/export?ex_format=50&ex_device=45

http://140.119.115.1:1080/search/.a1/.a1/1,1,1,B/marc~b1799780?save=b1799780

fetch innopac

1.save tmp
http://140.119.115.1:1080/search/.a1/.a1/1,1,1,B/marc~b1799780?save=b1799780
2.export
http://140.136.208.1/search/.a1/++export/1,-1,-1,B/export?ex_format=50&ex_device=45
save file
ex_format=50 => MARC
ex_format=47 => Full Display
ex_format=6 => Brief Display

ex_device=45 => local disk
ex_device=44 => e-mail
ex_device=43 => screen
ex_format=50&ex_device=44&email_addx=long_sam.tw%40yahoo.com.tw&email_subj=From+the+library+catalog

catalog spider

create catalog spider
fetch nbinet cmarc for unicode
import iso2709 koha breedings

星期日, 3月 04, 2007

unimarc print

#!/usr/bin/perl -w

use MARC::Batch;

my $batch = MARC::Batch->new('USMARC','/home/laxendion/tools/iso/new1.dat');
while( my $record = $batch->next()) {

my @fields = $record->fields();
foreach my $field (@fields) {
print
$field->tag(), " ",
defined $field->indicator(1) ? $field->indicator(1) : "",
defined $field->indicator(2) ? $field->indicator(2) : "",
" ", $field->as_string, " \n";
}
}

unimarc 681 convert 805

#!/usr/bin/perl -w

use MARC::Record;
use MARC::Batch;

my $batch = MARC::Batch->new('USMARC','/home/laxendion/tools/iso/marc');
open(OUT,'> new1.dat') or die $!;
$batch->strict_off();
## read in each record.
while ( my $record = $batch->next() ) {
##fetch 852h
#my $good = $record->field('681');
#my $goodsub = $good->subfield('a');
#$record->subfield(681,"a");
## find the tag after 900.
my $class = $record->field('681')->subfield("a");
my $before;
foreach ($record->fields()) {
$before = $_;
last if $_->tag() > 800;
}

## create the 942 field.
my $new = MARC::Field->new('805','','','d' => $class);
## insert our 942 field after the $before.
$record->insert_fields_before($before,$new);
print $class . "\n";
## and print out the new record.
print OUT $record->as_usmarc();

}

An example perl script to move 852h >dewey< to 942k dewey default for Koha2.2

http://wiki.koha.org/doku.php?id=herea

## Example U2 this is a modified script with thanks to the MARC::Record
## designers and documentation group

use MARC::Batch;
my $batch = MARC::Batch->new('USMARC','/home/mike1/lib4per/MICRO.new');
open(OUT,'>new1.dat') or die $!;
$batch->strict_off();
## read in each record.
while ( my $record = $batch->next() ) {
##fetch 852h
my $good = $record->field('852');
my $goodsub = $good->subfield('h');
## find the tag after 900.
my $before;
foreach ($record->fields()) {
$before = $_;
last if $_->tag() > 900;
}

## create the 942 field.
my $new = MARC::Field->new('942','','',k=>$goodsub);

## insert our 942 field after the $before.
$record->insert_fields_before($before,$new);

## and print out the new record.
print OUT $record->as_usmarc();

}

星期六, 3月 03, 2007

koha 3.0 opac for zebra

1.install koha 2.2.5 & koha 2.2.6 ...
2.cp nkes Koha => your Koha
and run rel_3_0/koha/updater/updater/updatedatabase

3.setup zebra
http://wiki.koha.org/doku.php?id=installingzebraplugin226
http://wiki.koha.org/doku.php?id=faqzebra
zebra.cfg
http://kohaa.blogspot.com/2007/02/zebracfg.html

PS. cvs dev_week
cp dev_week/koha/zebraplugin/zebradb/biblios/tab/* to your zebra/etc/*
4.cvs koha rel_3_0
cp /opac/*.pl -> /opac/cgi-bin/
http://kohataiwan.googlegroups.com/web/prog_opac_zh_TW.po
http://koha.wikispaces.com/chinesenization

5.export nkes marc iso2709

6.Must have zebra.cfg config directory(zebra-XXX.cfg
use -c parameter)

copy zebrapl
zebra init
zebra create biblios(databaename see your koha.xml)
zebra -g iso2709 -d biblios(databaename see your koha.xml) update
iso2709.marc(marc data) -n
zebra -f /etc/koha.xml

koha.xml(see rel_3_0 /misc/koha.xml)

7.modify koha-httpd.conf
opac
chanage SetEnv KOHA_CONF /etc/koha.xml
and restart apache
--------------------------------------------------------------------
chanage systempreferences
opacthemes => prog
lang =>zh_TW
opacstylesheet => /opac-tmpl/prog/zh_TW/includes/opac.css
marcflavour => unimarc check your marc type

PS.MARCXML /misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
you use unimarc must modify scipt,marc21 don't modify
=> marcxml parser problem
see http://www.indexdata.com/zebra/doc/