[Koha-cvs] koha C4/AuthoritiesMarc.pm authorities/authorit... [rel_TG]

Tumer Garip tgarip at neu.edu.tr
Wed Mar 28 22:25:11 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_TG
Changes by:	Tumer Garip <tgarip1957>	07/03/28 20:25:11

Modified files:
	C4             : AuthoritiesMarc.pm 
	authorities    : authorities.pl 
	misc/zebra-datas: zebra-authorities.cfg 
	z3950          : zebraqueue_start.pl 
Added files:
	misc/zebra-datas/domfilter: dom_authconf.xml kohaauth2index.xsl 

Log message:
	converting authorities to use the new zebra dom filter

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.37.2.3&r2=1.37.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/authorities/authorities.pl?cvsroot=koha&only_with_tag=rel_TG&r1=1.18.2.3&r2=1.18.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/misc/zebra-datas/zebra-authorities.cfg?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/z3950/zebraqueue_start.pl?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/misc/zebra-datas/domfilter/dom_authconf.xml?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/misc/zebra-datas/domfilter/kohaauth2index.xsl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1

Patches:
Index: C4/AuthoritiesMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.37.2.3
retrieving revision 1.37.2.4
diff -u -b -r1.37.2.3 -r1.37.2.4
--- C4/AuthoritiesMarc.pm	28 Mar 2007 02:50:28 -0000	1.37.2.3
+++ C4/AuthoritiesMarc.pm	28 Mar 2007 20:25:10 -0000	1.37.2.4
@@ -49,6 +49,7 @@
 	&merge
 	&FindDuplicateauth
 	&ZEBRAdelauthority
+	&ZEBRA_readyauthority
  );
 
 sub AUTHfind_marc_from_kohafield {
@@ -835,7 +836,27 @@
 }## if tag 
 return @value;
 }
-
+sub ZEBRA_readyauthority{
+my ($dbh,$authid)=@_;
+my $authxml=XMLgetauthority($dbh,$authid);
+my $zebraxml=auth_collection_header();
+$zebraxml.=$authxml;
+$zebraxml.="</collection>";
+$zebraxml=Encode::encode("utf8",$zebraxml);
+return $zebraxml;
+}
+sub auth_collection_header {
+####  this one is for  collection 
+    my $format = shift;
+    my $enc = shift || 'UTF-8';
+    return( <<KOHA_XML_HEADER );
+<?xml version="1.0" encoding="UTF-8"?>
+<collection
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
+  xmlns="http://www.loc.gov/MARC21/slim">
+KOHA_XML_HEADER
+}
 1;
 __END__
 
@@ -849,7 +870,7 @@
 
 =cut
 
-# $Id: AuthoritiesMarc.pm,v 1.37.2.3 2007/03/28 02:50:28 tgarip1957 Exp $
+# $Id: AuthoritiesMarc.pm,v 1.37.2.4 2007/03/28 20:25:10 tgarip1957 Exp $
 
 # Revision 1.30  2006/09/06 16:21:03  tgarip1957
 # Clean up before final commits

Index: authorities/authorities.pl
===================================================================
RCS file: /sources/koha/koha/authorities/authorities.pl,v
retrieving revision 1.18.2.3
retrieving revision 1.18.2.4
diff -u -b -r1.18.2.3 -r1.18.2.4
--- authorities/authorities.pl	28 Mar 2007 02:50:28 -0000	1.18.2.3
+++ authorities/authorities.pl	28 Mar 2007 20:25:10 -0000	1.18.2.4
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: authorities.pl,v 1.18.2.3 2007/03/28 02:50:28 tgarip1957 Exp $
+# $Id: authorities.pl,v 1.18.2.4 2007/03/28 20:25:10 tgarip1957 Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -106,8 +106,6 @@
  $template->param(error             =>1,xmlerror=>1,);
 goto FINAL;
   };	# check for a duplicate
-###Authorities need the XML header unlike biblios
-$xml='<?xml version="1.0" encoding="UTF-8"?>'.$xml;
   my $xmlhash=XML_xml2hash_onerecord($xml);
 	my ($duplicateauthid,$duplicateauthvalue) = C4::AuthoritiesMarc::FindDuplicateauth($xmlhash,$authtypecode) if ($op eq "add") && (!$is_a_modif);
 #warn "duplicate:$duplicateauthid,$duplicateauthvalue";	

Index: misc/zebra-datas/zebra-authorities.cfg
===================================================================
RCS file: /sources/koha/koha/misc/zebra-datas/Attic/zebra-authorities.cfg,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- misc/zebra-datas/zebra-authorities.cfg	26 Mar 2007 22:38:10 -0000	1.1.2.1
+++ misc/zebra-datas/zebra-authorities.cfg	28 Mar 2007 20:25:10 -0000	1.1.2.2
@@ -1,9 +1,10 @@
 # Simple Zebra configuration file that defines
 # a database with MARCXML records.
-# $Id: zebra-authorities.cfg,v 1.1.2.1 2007/03/26 22:38:10 tgarip1957 Exp $
+# $Id: zebra-authorities.cfg,v 1.1.2.2 2007/03/28 20:25:10 tgarip1957 Exp $
 #
 # Where are the config files located?
-profilePath: ${srcdir:-.}:${srcdir:-.}/tab
+# Where are the config files located?
+profilePath: ${srcdir:-.}:${srcdir:-.}/tab:${srcdir:-.}/domfilter:/filters
 encoding: UTF-8
 # Files that describe the attribute sets supported.
 attset: bib1.att
@@ -11,8 +12,8 @@
 attset:gils.att
 
 # Specify record type
-mrc.recordType:grs.marcxml.record
-recordType:grs.xml
+recordtype: dom.domfilter/dom_authconf.xml
+
 database:authorities
 recordId: (bib1,Authority/format-id)
 storeKeys:1

Index: z3950/zebraqueue_start.pl
===================================================================
RCS file: /sources/koha/koha/z3950/Attic/zebraqueue_start.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- z3950/zebraqueue_start.pl	26 Mar 2007 02:19:27 -0000	1.1.2.2
+++ z3950/zebraqueue_start.pl	28 Mar 2007 20:25:11 -0000	1.1.2.3
@@ -27,7 +27,7 @@
 if ($server eq "biblioserver"){
 	($marcxml) =ZEBRA_readyXML($dbh,$biblionumber);
 	}elsif($server eq "authorityserver"){
-	$marcxml =C4::AuthoritiesMarc::XMLgetauthority($dbh,$biblionumber);
+	$marcxml =C4::AuthoritiesMarc::ZEBRA_readyauthority($dbh,$biblionumber);
 	} 
 
 eval {

Index: misc/zebra-datas/domfilter/dom_authconf.xml
===================================================================
RCS file: misc/zebra-datas/domfilter/dom_authconf.xml
diff -N misc/zebra-datas/domfilter/dom_authconf.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/zebra-datas/domfilter/dom_authconf.xml	28 Mar 2007 20:25:11 -0000	1.1.2.1
@@ -0,0 +1,18 @@
+ <dom xmlns="http://indexdata.com/zebra-2.0">
+<extract name="index">
+  	<xslt     stylesheet="kohaauth2index.xsl" />
+</extract>
+<input syntax="xml">
+	<xmlreader level="1"/>
+</input>
+<retrieve name="marc" >
+    <xslt stylesheet="identity.xsl"/>
+  </retrieve>
+<retrieve name="F" >
+    <xslt stylesheet="identity.xsl"/>
+  </retrieve>
+<retrieve name="zebra" >
+    <xslt stylesheet="zebra.xsl"/>
+  </retrieve>
+</dom>
+

Index: misc/zebra-datas/domfilter/kohaauth2index.xsl
===================================================================
RCS file: misc/zebra-datas/domfilter/kohaauth2index.xsl
diff -N misc/zebra-datas/domfilter/kohaauth2index.xsl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/zebra-datas/domfilter/kohaauth2index.xsl	28 Mar 2007 20:25:11 -0000	1.1.2.1
@@ -0,0 +1,47 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:z="http://indexdata.com/zebra-2.0"
+   xmlns:m="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  exclude-result-prefixes="z"
+ version="1.0">	
+	<xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+	<!-- disable all default text node output -->
+	<xsl:template match="text()"/>
+	<!-- match on auth xml record -->
+	<xsl:template match="/m:record">
+	<xsl:variable name="controlField001"   select="normalize-space(m:controlfield[@tag='001'])"/>
+
+		<z:record z:id="{$controlField001}">
+			<xsl:apply-templates/>
+		</z:record>
+	</xsl:template>
+	
+	<!-- KOHA indexing templates -->
+	<!--authnumber-->
+	<xsl:template match="m:controlfield[@tag='001']">
+		<z:index name="Authority/format-id:w " >
+			<xsl:value-of select="."/>
+		</z:index>
+			
+	</xsl:template>
+	
+	
+	<!-- Record-type (authority type) -->
+	<xsl:template match="m:datafield">
+	<xsl:variable name="tag" select="@tag"/>
+	<xsl:if test="$tag ='035'">	
+		<z:index name="Record-type:w" >
+			<xsl:value-of select="m:subfield[@code='a']"/>
+		</z:index>
+	</xsl:if>
+
+	<!--All tags ge 100 get indexed as subject-->
+	
+	<xsl:if test="$tag &gt;=100">
+		<z:index name="Subject-heading:p LC-subject-heading:p LC-subject-heading:w Subject-heading:s LC-subject-heading:s" >
+			<xsl:value-of select="m:subfield[@code='a']"/>
+		</z:index>
+		<z:index name="Subject-heading:w any:w" >
+			<xsl:value-of select="."/>
+		</z:index>
+	</xsl:if>
+
+	</xsl:template>
+</xsl:stylesheet>





More information about the Koha-cvs mailing list