Test for filter bug in config
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 16 Sep 2003 13:58:00 +0000 (13:58 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 16 Sep 2003 13:58:00 +0000 (13:58 +0000)
test/config/Makefile.am
test/config/m.abs [new file with mode: 0644]
test/config/m.flt [new file with mode: 0644]
test/config/m.rec [new file with mode: 0644]
test/config/test2.sh [new file with mode: 0755]

index 35c7e9f..5139392 100644 (file)
@@ -1,6 +1,6 @@
-# $Id: Makefile.am,v 1.1 2003-09-16 12:18:25 adam Exp $
+# $Id: Makefile.am,v 1.2 2003-09-16 13:58:00 adam Exp $
 
-check_SCRIPTS = test1.sh
-TESTS = test1.sh
+check_SCRIPTS = test1.sh test2.sh
+TESTS = test1.sh test2.sh
 
-EXTRA_DIST = zebra.cfg $(check_SCRIPTS) g.grs g.abs
+EXTRA_DIST = zebra.cfg $(check_SCRIPTS) g.rec g.abs m.rec m.flt m.rec
diff --git a/test/config/m.abs b/test/config/m.abs
new file mode 100644 (file)
index 0000000..e88200f
--- /dev/null
@@ -0,0 +1,50 @@
+# $Id: m.abs,v 1.1 2003-09-16 13:58:00 adam Exp $
+
+name my
+attset bib1.att
+tagset meta.tag
+varset var1.var
+
+esetname F @
+esetname B meta-b.est
+
+maptab meta-usmarc.map
+
+all any
+
+elm (2,1)               title                   Title:w,Title:p,Title:s
+elm dc_title            title                   Title:w,Title:p,Title:s
+elm (2,2)               creator                 Author:w,Author:p
+elm dc_creator          creator                 Author:w,Author:p
+elm dc_publisher       publisher               Author:w,Author:p,Publisher:w,Publisher:p
+elm author-publisher   author-publisher        author-publisher:p,author-publisher:w   
+elm (2,21)              subject                 Subject-heading
+elm dc_subject          subject                 Subject-heading:w,Subject-heading:p
+elm dc_subject_s_DBC    subject                 Subject-heading:w,Subject-heading:p
+elm dc_subject_s_dkbib_DBCM subject            Subject-heading:w,Subject-heading:p
+elm dc_subject_s_dkbib_DBCF subject             Subject-heading:w,Subject-heading:p
+elm dc_subject_s_dkbib_DBCS subject             Subject-heading:w,Subject-heading:p
+elm dc_subject_s_DK5    subject_DK5             Local-classification:w,Local-classification:p
+elm (2,17)              description             abstract
+elm dc_description      description             abstract        
+elm (2,31)              publisher               Publisher
+elm (2,32)              contributor             -
+elm (2,4)               date                    Date
+elm treatment_date      date                    Date,Date:s 
+elm (2,22)              type                    Content-type,Content-type:s
+elm (2,27)              format                  Material-type
+elm (2,28)              identifier              Record-source
+elm dc_identifier_s_url identifier_url          Record-source,Record-source:0
+elm dc_identifier_s_purl identifier_purl        Record-source
+elm dc_identifier_s_urn identifier_urn          Record-source
+elm dc_identifier_s_isbn identifier_isbn        Record-source,ISBN
+elm (2,33)              source                  -
+elm (2,20)              language                Code-language
+elm dc_language_s_ISO_639_2_B_1998              language                Code-language
+elm (2,30)             relation                -
+elm (2,34)             coverage                -
+elm (2,29)             rights                  -
+
+# These tags are required by Zebra for GRS-1 generation
+elm (1,10)             rank                    -
+elm (1,14)             localControlNumber      Local-number
diff --git a/test/config/m.flt b/test/config/m.flt
new file mode 100644 (file)
index 0000000..883da34
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# DEF portal input filter
+#
+
+/<meta>/       { begin record meta; set type ""; set AUTHOR ""; set PUBLISHER "" }
+/<\/meta>/     { 
+                    data -element author-publisher "$AUTHOR XXX $PUBLISHER"; end record
+               }
+
+
+/</ /[A-Za-z0-9._:]*/ { puts "tag:$1"; set tag $1; set scheme ""; set lang ""; begin context attributes }
+
+CONTEXT {attributes}
+
+/>/            {
+                       if {$scheme != ""} { set tag "$tag-s-$scheme" };
+                       if {$lang != ""} { set tag "$tag-l-$lang" };
+                       regsub -all {[\. -/:]} $tag "_" tag;
+                       begin element $tag;
+                       end context;
+                       begin context content;
+               }
+
+/lang=\"/ BODY /\"/   { set lang $1 }
+
+/scheme=\"/ BODY /\"/ { set scheme $1 }
+
+CONTEXT {content}
+
+/<\/[aA]>/      { data $0 }
+
+/<\/[^>]*>/    { end element; end context }
+
+/./            { if {$tag == "dc_creator"} { append AUTHOR $0}; if {$tag == "dc_publisher"} { append PUBLISHER $0};   data $0 }
diff --git a/test/config/m.rec b/test/config/m.rec
new file mode 100644 (file)
index 0000000..c731df1
--- /dev/null
@@ -0,0 +1,4 @@
+<meta>
+<dc:subject scheme="DBC">film</dc:subject scheme="DBC">
+<treatment:date>2002-04-10</treatment:date>
+</meta>
diff --git a/test/config/test2.sh b/test/config/test2.sh
new file mode 100755 (executable)
index 0000000..3357251
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+if ../../index/zebraidx -V|grep Tcl >/dev/null; then
+       ../../index/zebraidx init
+       ../../index/zebraidx -s -t grs.tcl.m update m.rec | grep tag:dc:subject >/dev/null
+else
+       exit 0
+fi