project-cdsware-users@cern.ch archives


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Additional MARC21 tags for Dublin Core v0.5


  • From: Ferran Jorba <Ferran.Jorba@xxxxxx>
  • Subject: [patch] Additional MARC21 tags for Dublin Core v0.5
  • Date: Mon, 17 Oct 2005 16:51:43 +0200

Hi Tibor,

could you consider this patch for inclussion?  It is relative to current
0.7.1.  If it doesn't apply cleanly, I'll retrieve current cvs sources.

Thanks,

Ferran
This patch allows Dublin Core output to be more comprehensive than the
default CDSware distribution, restricted to a subset of MARC21 as used at
CERN.  It is not perfect, but it should not hurt current CDSware users and
is, at least, a little more MARC21 compliant.

Mapping taken from http://www.loc.gov/marc/marc2dc.html

Index: cdsware-0.7.1/modules/websearch/lib/search_engine.py.shtml
===================================================================
--- cdsware-0.7.1.orig/modules/websearch/lib/search_engine.py.shtml	2005-10-13 10:57:19.000000000 +0200
+++ cdsware-0.7.1/modules/websearch/lib/search_engine.py.shtml	2005-10-17 16:10:49.482219776 +0200
@@ -2862,26 +2862,58 @@
         if record_exist_p == -1:
             out += ""
         else:
-            for f in get_fieldvalues(recID, "041__a"):
-                out += "        <language>%s</language>\n" % f
-
-            for f in get_fieldvalues(recID, "100__a"):
-                out += "        <creator>%s</creator>\n" % encode_for_xml(f)
+            for f in get_fieldvalues(recID, "245%a"):
+                out += "        <title>%s</title>\n" % encode_for_xml(f)
 
-            for f in get_fieldvalues(recID, "700__a"):
-                out += "        <creator>%s</creator>\n" % encode_for_xml(f)
+            for tag in ("100","110","111","700","710","711","720"):
+                for f in get_fieldvalues(recID, tag + "%a"):
+                    out += "        <creator>%s</creator>\n" % encode_for_xml(f)
+
+            for tag in ("600","610","611","630","650","653"):
+                for f in get_fieldvalues(recID, tag + "%"):
+                    out += "        <subject>%s</subject>\n" % encode_for_xml(f)
+            for tag in range(500,599):
+                if (tag not in (506,530,540,546)):
+                    for f in get_fieldvalues(recID, str(tag) + "%a"):
+                        out += "        <description>%s</description>\n" % encode_for_xml(f)
+
+            for f in get_fieldvalues(recID, "260%b"):
+                out += "        <publisher>%s</publisher>\n" % encode_for_xml(f)
+
+            for f in get_fieldvalues(recID, "260%c"):
+                out += "        <date>%s</date>\n" % encode_for_xml(f)
 
-            for f in get_fieldvalues(recID, "245__a"):
-                out += "        <title>%s</title>\n" % encode_for_xml(f)
+            for f in get_fieldvalues(recID, "655%a"):
+                out += "        <type>%s</type>\n" % encode_for_xml(f)
 
-            for f in get_fieldvalues(recID, "65017a"):
-                out += "        <subject>%s</subject>\n" % encode_for_xml(f)
+            for f in get_fieldvalues(recID, "856%q"):
+                out += "        <format>%s</format>\n" % encode_for_xml(f)
 
-            for f in get_fieldvalues(recID, "8564_u"):
+            for f in get_fieldvalues(recID, "856%u"):
                 out += "        <identifier>%s</identifier>\n" % encode_for_xml(f)
 
-            for f in get_fieldvalues(recID, "520__a"):
-                out += "        <description>%s</description>\n" % encode_for_xml(f)
+            for tag in ("041","546"):
+                for f in get_fieldvalues(recID, tag + "%a"):
+                    out += "        <language>%s</language>\n" % f
+
+            for f in get_fieldvalues(recID, "530%a"):
+                out += "        <relation>%s</relation>\n" % f
+            for tag in range(760,787):
+                for subfield in ("o","t"):
+                    for f in get_fieldvalues(recID, str(tag) + "%" + subfield):
+                        out += "        <relation>%s</relation>\n" % f
+
+            for tag in ("786%o","786%t"):
+                for f in get_fieldvalues(recID, tag):
+                    out += "        <source>%s</source>\n" % encode_for_xml(f)
+
+            for tag in ("651","752"):
+                for f in get_fieldvalues(recID, tag + "%a"):
+                    out += "        <coverage>%s</coverage>\n" % f
+
+            for tag in ("506","540"):
+                for f in get_fieldvalues(recID, tag + "%a"):
+                    out += "        <rigths>%s</rights>\n" % f
 
             out += "        <date>%s</date>\n" % get_creation_date(recID)
         out += "    </dc>\n"