From 32ee0e6a58d7df4a3d9f1d062948ce316b381bc8 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 20 Oct 2003 15:44:57 +0000 Subject: [PATCH] removing outdated scripts. --- marc/deletemarc | 26 -------- marc/koha2marc | 35 ---------- marc/marcschema.sql | 141 ----------------------------------------- marc/perlmarcstructure | 62 ------------------ marc/updatedb2marc.pl | 64 ------------------- 5 files changed, 328 deletions(-) delete mode 100644 marc/deletemarc delete mode 100644 marc/koha2marc delete mode 100644 marc/marcschema.sql delete mode 100644 marc/perlmarcstructure delete mode 100755 marc/updatedb2marc.pl diff --git a/marc/deletemarc b/marc/deletemarc deleted file mode 100644 index fb83c9c3b8..0000000000 --- a/marc/deletemarc +++ /dev/null @@ -1,26 +0,0 @@ -delete from Bib_Table; -delete from 0XX_Tag_Table; -delete from 0XX_Subfield_Table; -delete from 1XX_Tag_Table; -delete from 1XX_Subfield_Table; -delete from 2XX_Tag_Table; -delete from 2XX_Subfield_Table; -delete from 3XX_Tag_Table; -delete from 3XX_Subfield_Table; -delete from 4XX_Tag_Table; -delete from 4XX_Subfield_Table; -delete from 5XX_Tag_Table; -delete from 5XX_Subfield_Table; -delete from 6XX_Tag_Table; -delete from 6XX_Subfield_Table; -delete from 7XX_Tag_Table; -delete from 7XX_Subfield_Table; -delete from 8XX_Tag_Table; -delete from 8XX_Subfield_Table; -delete from 9XX_Tag_Table; -delete from 9XX_Subfield_Table; -delete from Resource_Table; -delete from Blob_Table; -delete from Storage_Table; -delete from Control_Table; - diff --git a/marc/koha2marc b/marc/koha2marc deleted file mode 100644 index 6ca5aca4a0..0000000000 --- a/marc/koha2marc +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/perl - - -# CAREFUL!!!! -# This next line deletes _ALL_ of the existing MARC data from the -# MySQL tables!!! It is only in here during development!!!! - -system("mysql Koha -pkohapass < deletemarc"); - -use C4::Context; -use C4::Catalogue; -use CGI; -use DBI; -#use strict; -use C4::Acquisitions; -use C4::Biblio; -use C4::Output; -my $dbh = C4::Context->dbh; -my $userid=$ENV{'REMOTE_USER'}; - -my $sth=$dbh->prepare("select * from biblio,biblioitems where biblio.biblionumber=biblioitems.biblionumber"); -$sth->execute; -my $env; -$env->{'marconly'}=1; - -while (my $biblioitem=$sth->fetchrow_hashref) { - print "Processing $biblioitem->{'title'}\n"; - my $Record_ID; - ($env, $Record_ID) = newBiblioItem($env,$biblioitem); - my $sti=$dbh->prepare("select * from items,biblioitems where items.biblioitemnumber=biblioitems.biblioitemnumber and biblioitems.biblioitemnumber=$biblioitem->{'biblioitemnumber'}"); - $sti->execute; - while (my $item=$sti->fetchrow_hashref) { - newItem($env, $Record_ID, $item); - } -} diff --git a/marc/marcschema.sql b/marc/marcschema.sql deleted file mode 100644 index 409aff7bfb..0000000000 --- a/marc/marcschema.sql +++ /dev/null @@ -1,141 +0,0 @@ -# $Id$ -# -# $Log$ -# Revision 1.16 2002/08/30 17:26:14 tonnesen -# Added bibliothesaurus table -# -# Revision 1.15 2002/07/24 15:52:53 tipaul -# 1st scripts for MARC-DB. -# -# WARNING : YOU MUST DO THE FOLLOWING IF YOU EXPECT THE MAIN-BRANCH TO WORK. -# -# * install MARC::Record package, from cpan or sourceforge -# * OVERWRITE File.pm and USMARC.pm. The original misses 1 functionnality we absolutly need in koha (reading a MARC from a variable, not from a file). Thanks to Steve, who modified MARC::Record. -# * modify your DB by adding marcschema.sql tables -# * populate new tables by launching fill_usmarc.pl -# -# Then, it should work... -# What works exactly will come in the next commit, in a few minuts (hitchcock suspens...) -# -# Revision 1.14 2002/06/04 08:13:31 tipaul -# ouuppsss... forget the 1.13 version, i made a mistake. This version works and should be the last -# -# Revision 1.13/1.14 2002/06/04 07:56:56 tipaul -# New and hopefully last version of the MARC-DB. Is the fastest in benchmark, everybody agree ;-) (Sergey, Steve and me, Paul) -# -# Revision 1.13 2002/06/04 Paul -# should be the last version... remains only 2 tables : the main table and the subfield one. -# benchmark shows this structure is the fastest. I had to add indicator in the subfield table. should be in a tag_table, but as it s the -# only real information that should be in this table, it has been thrown to subfield table (not a normal form, but an optimized one...) -# -# Revision 1.12 2002/05/31 20:03:17 tonnesen -# removed another _sergey -# -# Revision 1.11 2002/05/31 19:41:29 tonnesen -# removed fieldid in favour of tagid, removed _sergey from table names, added -# tagorder field to tag table, renamed marc_field_table to marc_tag_table. -# -# -# -# These first three tables store the data from a MARC record. - -# marc_biblio contains 1 record for each biblio in the DB -CREATE TABLE marc_biblio ( - bibid bigint(20) unsigned NOT NULL auto_increment, - biblionumber int(20) unsigned NOT NULL, - datecreated date NOT NULL default '0000-00-00', - datemodified date default NULL, - origincode char(20) default NULL, - PRIMARY KEY (bibid), - KEY origincode (origincode), - KEY biblionumber (biblionumber) - ) TYPE=MyISAM; - -CREATE TABLE marc_subfield_table ( - subfieldid bigint(20) unsigned NOT NULL auto_increment,# subfield identifier - bibid bigint(20) unsigned NOT NULL, # link to marc_biblio table - tag char(3) NOT NULL, # tag number - tagorder tinyint(4) NOT NULL default '1', # display order for tags within a biblio when a tag is repeated - tag_indicator char(2) NOT NULL, # tag indicator - subfieldcode char(1) NOT NULL default '', # subfield code - subfieldorder tinyint(4) NOT NULL default '1', # display order for subfields within a tag when a subfield is repeated - subfieldvalue varchar(255) default NULL, # the subfields value if not longer than 255 char - valuebloblink bigint(20) default NULL, # the link to the blob, if value is longer than 255 char - PRIMARY KEY (subfieldid), - KEY bibid (bibid), - KEY tag (tag), - KEY tag_indicator (tag_indicator), - KEY subfieldorder (subfieldorder), - KEY subfieldcode (subfieldcode), - KEY subfieldvalue (subfieldvalue) -); - -# marc_blob_subfield containts subfields longer than 255 car. -# They are linked to a marc_subfield_table record by bloblink - CREATE TABLE marc_blob_subfield ( - blobidlink bigint(20) NOT NULL auto_increment, - subfieldvalue longtext NOT NULL, - PRIMARY KEY (blobidlink) - ) TYPE=MyISAM; - -# The next two tables are used for labelling the tags and subfields for -# different implementions of marc USMARC, UNIMARC, CANMARC, UKMARC, etc. - -# marc_tag_structure contains the definition of the marc tags. -# any MARC is supposed to be support-able - CREATE TABLE marc_tag_structure ( - tagfield char(3) NOT NULL default '', - liblibrarian char(255) NOT NULL default '', - libopac char(255) NOT NULL default '', - repeatable tinyint(4) NOT NULL default '0', - mandatory tinyint(4) NOT NULL default '0', - PRIMARY KEY (tagfield) - ) TYPE=MyISAM; - - -# marc_subfield_structure contains the definition of the marc -# subfields. Any MARC is supposed to be support-able - CREATE TABLE marc_subfield_structure ( - tagfield char(3) NOT NULL default '', - tagsubfield char(1) NOT NULL default '', - liblibrarian char(255) NOT NULL default '', # the text shown to a librarian - libopac char(255) NOT NULL default '', # the text shown to an opac user - repeatable tinyint(4) NOT NULL default '0', # is the field repeatable 0/1 ? - mandatory tinyint(4) NOT NULL default '0', # is the subfield mandatory in manual add 0/1 ? - kohafield char(40) NOT NULL default '', # the name of the normal-koha- DB field - PRIMARY KEY (tagfield,tagsubfield) - ) TYPE=MyISAM; - - -# This table is the table used for searching the marc records - -# marc_tag_word contains 1 record for each word in each subfield in each tag in each biblio - CREATE TABLE marc_word ( - bibid bigint(20) NOT NULL default '0', - tag char(3) NOT NULL default '', - tagorder tinyint(4) NOT NULL default '1', - subfieldid char(1) NOT NULL default '', - subfieldorder tinyint(4) NOT NULL default '1', - word varchar(255) NOT NULL default '', - sndx_word varchar(255) NOT NULL default '', # the soundex version of the word (indexed) - KEY bibid (bibid), - KEY tag (tag), - KEY tagorder (tagorder), - KEY subfieldid (subfieldid), - KEY subfieldorder (subfieldorder), - KEY word (word), - KEY sndx_word (sndx_word) - ) TYPE=MyISAM; - - -CREATE TABLE bibliothesaurus ( - code bigint(20) NOT NULL auto_increment, - freelib char(255) NOT NULL default '', - stdlib char(255) NOT NULL default '', - type char(80) NOT NULL default '', - PRIMARY KEY (code), - KEY freelib (freelib), - KEY stdlib (stdlib), - KEY type (type) - ) TYPE=MyISAM; - diff --git a/marc/perlmarcstructure b/marc/perlmarcstructure deleted file mode 100644 index c9ef0778cb..0000000000 --- a/marc/perlmarcstructure +++ /dev/null @@ -1,62 +0,0 @@ - -A proposed perl data structure for storing marc info - - -$record is a hash reference - -$record->{leader}= -$record->{bibid}=58973 -$record->{tags}=$tags - -$tags is a hash reference - -$tags->{$tag} -$tags->{$tag}->{$tagorder} -$tags->{$tag}->{$tagorder}->{indicator}='04' -$tags->{$tag}->{$tagorder}->{tagid}=573498 -$tags->{$tag}->{$tagorder}->{subfields}=$subfields - -$subfields is a hash reference - -$subfields->{$mark} -$subfields->{$mark}->{$subfieldorder} -$subfields->{$mark}->{$subfieldorder}='MacDonald, John A.' - -Sample : -bibid=58973, -110 ## $afirst text $asecond text $bthird text -120 ## $alast text ?? -120 01 $nno, another text - -in perlmarcstructure, it can be writen : -$record->{bibid}=58973; -$record->{tags}->{110}->{1}->{indicator}='##'; -$record->{tags}->{110}->{1}->{subfields}->{a}->{1}='first text'; -$record->{tags}->{110}->{1}->{subfields}->{a}->{2}='second text'; -$record->{tags}->{110}->{1}->{subfields}->{b}->{1}='third text'; - -$record->{tags}->{120}->{1}->{indicator}='##'; -$record->{tags}->{120}->{1}->{subfields}->{a}->{1}='last text ??'; - -$record->{tags}->{120}->{2}->{indicator}='01'; -$record->{tags}->{120}->{2}->{subfields}->{n}->{1}='no, another text'; - -This takes care of possible repeating tags and subfields as well as ordering of -tags and subfields, but it makes it difficult to look up specific tags and -subfields without looping through every time. It might be an idea to add an -index to the structure to aid these lookups. - -$record->{index}->{110}->{tags}=\(3,4) <-- array ref shows that tags 3 and 4 - are 110 tags - -Need a similar index for subfields.... I'm not sure if this is any simpler than -just looping through the tags every time. :) - -I think looping is the way to go... - -This still needs more work. This will also require an API for accessing or -modifying this structure, as it is non-trivial to parse the data. I'm also -starting to wonder how difficult it is going to be to develop templates using -this kind of structure. HTML::Template has no facility for parsing this kind -of data structure. We might need an alternate (or completely different) data -structure that is parseable by HTML::Template. diff --git a/marc/updatedb2marc.pl b/marc/updatedb2marc.pl deleted file mode 100755 index c3d9685dfe..0000000000 --- a/marc/updatedb2marc.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/perl -# migrate koha-biblios to MARCbiblios - -package C4::test; - -# Copyright 2000-2002 Katipo Communications -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA - -use strict; -require Exporter; -use C4::Context; -use C4::Catalogue; -use C4::Biblio; -use MARC::Record; -use MARC::File::USMARC; - -#die; -my $dbh = C4::Context->dbh; -my $sth = $dbh->prepare("select * from systempreferences"); -$sth->execute; -$dbh->do("delete from marc_biblio"); -$dbh->do("delete from marc_blob_subfield"); -$dbh->do("delete from marc_subfield_table"); -$dbh->do("delete from marc_word"); -my $sth=$dbh->prepare("select * from biblio left join biblioitems on biblioitems.biblionumber=biblio.biblionumber order by biblio.biblionumber"); -my ($row,$row2); -my $sth2 = $dbh->prepare("select count(*) from biblio"); -$sth2->execute; -my ($total) = $sth2->fetchrow_array; -my $rest = $total; -$sth->execute; -my $i=0; -while ($row=$sth->fetchrow_hashref) { - $i++; - $rest--; - if ($i>99) { - $i=0; - print "$rest / $total\n"; - } - my $MARCbiblio = MARCkoha2marcBiblio($dbh,$row->{biblionumber},$row->{biblioitemnumber}); - &MARCaddbiblio($dbh,$MARCbiblio,$row->{biblionumber}); - my $sth_item = $dbh->prepare("select * from items where biblionumber=? and biblioitemnumber=?"); - $sth_item->execute($row->{biblionumber},$row->{biblioitemnumber}); - while ($row2=$sth_item->fetchrow_hashref) { - my $MARCitem = &MARCkoha2marcItem($dbh,$row2->{biblionumber},$row2->{itemnumber}); - &MARCadditem($dbh,$MARCitem,$row2->{biblionumber}); - } -} - - -- 2.39.2