Biblio::Isis - Read CDS/ISIS, WinISIS and IsisMarc database
use Biblio::Isis;
my $isis = new Biblio::Isis(
isisdb => './cds/cds',
);
for(my $mfn = 1; $mfn <= $isis->count; $mfn++) {
print $isis->to_ascii($mfn),"\n";
}
This module will read ISIS databases created by DOS CDS/ISIS, WinIsis or IsisMarc. It can be used as perl-only alternative to OpenIsis module which seems to depriciate it's old XS
bindings for perl.
It can create hash values from data in ISIS database (using to_hash
), ASCII dump (using to_ascii
) or just hash with field names and packed values (like ^asomething^belse
).
Unique feature of this module is ability to include_deleted
records. It will also skip zero sized fields (OpenIsis has a bug in XS bindings, so fields which are zero sized will be filled with random junk from memory).
It also has support for identifiers (only if ISIS database is created by IsisMarc), see to_hash
.
This module will always be slower than OpenIsis module which use C library. However, since it's written in perl, it's platform independent (so you don't need C compiler), and can be easily modified. I hope that it creates data structures which are easier to use than ones created by OpenIsis, so reduced time in other parts of the code should compensate for slower performance of this module (speed of reading ISIS database is rarely an issue).
Open ISIS database
my $isis = new Biblio::Isis(
isisdb => './cds/cds',
read_fdt => 1,
include_deleted => 1,
hash_filter => sub {
my $v = shift;
$v =~ s#foo#bar#g;
},
debug => 1,
);
Options are described below:
.MST
, and .XRF
and optionally .FDT
(if using read_fdt
option) files../cds/cds.MST
and related files.Return number of records in database
print $isis->count;
Read record with selected MFN
my $rec = $isis->fetch(55);
Returns hash with keys which are field names and values are unpacked values for that field like this:
$rec = {
'210' => [ '^aNew York^cNew York University press^dcop. 1988' ],
'990' => [ '2140', '88', 'HAY' ],
};
Returns ASCII output of record with specified MFN
print $isis->to_ascii(42);
This outputs something like this:
210 ^aNew York^cNew York University press^dcop. 1988
990 2140
990 88
990 HAY
If read_fdt
is specified when calling new
it will display field names from .FDT
file instead of numeric tags.
Read record with specified MFN and convert it to hash
my $hash = $isis->to_hash($mfn);
It has ability to convert characters (using hash_filter
) from ISIS database before creating structures enabling character re-mapping or quick fix-up of data.
This function returns hash which is like this:
$hash = {
'210' => [
{
'c' => 'New York University press',
'a' => 'New York',
'd' => 'cop. 1988'
}
],
'990' => [
'2140',
'88',
'HAY'
],
};
You can later use that hash to produce any output from ISIS data.
If database is created using IsisMarc, it will also have to special fields which will be used for identifiers, i1
and i2
like this:
'200' => [
{
'i1' => '1',
'i2' => ' '
'a' => 'Goa',
'f' => 'Valdo D\'Arienzo',
'e' => 'tipografie e tipografi nel XVI secolo',
}
],
This method will also create additional field 000
with MFN.
Return name of selected tag
print $isis->tag_name('200');
Read content of .CNT
file and return hash containing it.
print Dumper($isis->read_cnt);
This function is not used by module (.CNT
files are not required for this module to work), but it can be useful to examine your index (while debugging for example).
Unpack one of two 26 bytes fixed length record in .CNT
file.
Here is definition of record:
off key description size
0: IDTYPE BTree type s
2: ORDN Nodes Order s
4: ORDF Leafs Order s
6: N Number of Memory buffers for nodes s
8: K Number of buffers for first level index s
10: LIV Current number of Index Levels s
12: POSRX Pointer to Root Record in N0x l
16: NMAXPOS Next Available position in N0x l
20: FMAXPOS Next available position in L0x l
24: ABNORMAL Formal BTree normality indicator s
length: 26 bytes
This will fill $self
object under cnt
with hash. It's used by read_cnt
.
Some parts of CDS/ISIS documentation are not detailed enough to exmplain some variations in input databases which has been tested with this module. When I was in doubt, I assumed that OpenIsis's implementation was right (except for obvious bugs).
However, every effort has been made to test this module with as much databases (and programs that create them) as possible.
I would be very greatful for success or failure reports about usage of this module with databases from programs other than WinIsis and IsisMarc. I had tested this against ouput of one isis.dll
-based application, but I don't know any details about it's version.
Dobrica Pavlinusic
CPAN ID: DPAVLIN
dpavlin@rot13.org
http://www.rot13.org/~dpavlin/
This module is based heavily on code from LIBISIS.PHP
library to read ISIS files V0.1.1 written in php and (c) 2000 Franck Martin <franck@sopac.org> and released under LGPL.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
OpenIsis web site http://www.openisis.org
perl4lib site http://perl4lib.perl.org