AW: [Metafacture] use of the MF test infrastructure

Böhme, Christoph C.Boehme at dnb.de
Sun Apr 26 20:30:43 CEST 2015


Hi Günter,

I finally got round to have a look on how to use MarcXML in Metamorph tests. It turned out that it is not possible in the current version. However, the problem is simple to fix and I just pushed a commit solving the problem (see [1]).

After applying the fix MarcXML can be written like this:

<test-case name="...">
    <input type="application/marcxml+xml">
         <collection xmlns="http://www.loc.gov/MARC21/slim">
                <record>
                      <leader>...</leader>
                      <controlfield tag="001">123</controlfield>
                </record>
         </collection>
    </input>
    ...
</test-case>

You can also specify MarcXML in the result element in the same way. It should also be possible to omit the collection element if you only have a single record, but I have not tried this.

Instead of specifying a default namespace on the collection  element you can, of course, use any other method for declaring the namespace.

There is no need to wrap xml data in cdata-sections as the input and result elements allow arbitrary xml content. The reason this is not working without applying the fix is that the test framework distinguishes between xml and non-xml content. This is done based on the mimetype set via the type-attribute. XML-Parsing is only used for mimetypes “application/xml”, “text/xml”, and any mimetype ending with “+xml”. As no mimetype was defined for MarcXML this was not working. The fix simply adds this mimetype.

Best,
Christoph


[1] https://github.com/culturegraph/metafacture-core/issues/229


Von: metafacture-bounces at lists.dnb.de [mailto:metafacture-bounces at lists.dnb.de] Im Auftrag von Guenter Hipler
Gesendet: Sonntag, 5. April 2015 16:24
An: metafacture at lists.dnb.de
Cc: Sebastian Schüpbach
Betreff: [Metafacture] use of the MF test infrastructure

Hi,

I tried to use the Metafacture test infrastructure.
@Christoph: One reason not at least because I stumbled upon your last change on the wiki [1]

Things are working fine using formeta as input conditions (with internal and external transformation morph transformation rules) [2] [3]

Although personally I prefer to use a formeta format in comparison to Marc most of my colleagues are more familiar with Marc and I would like to use these testcases to provide a better documentation for our use cases (at the moment transformations).

In metastream-readers.properties there is a
marcxml org.culturegraph.mf.stream.reader.MarcXmlReader entry
which I tried to use [4] but even for various alternatives in the input element of the testcase I get a parser exception. Looking into the code the formeta result reader will be instantiated and is getting the result condition which is correct formeta but the exception
java.lang.AssertionError: org.culturegraph.mf.exceptions.FormatException: Parsing error at position 1: >{<neuerWert…, No record found:
is thrown. Don't know if it is related to a missing input item?

My question:
Is it possible to use Marc definitions for the input element in test cases?

@Christoph: thanks for your response on my last question related to xml-schema extensions for metamorph functions . I think at the moment I will go with my own Java type (not at least because I want a solution) Once I'm more familiar with the infrastructure I try to come back to it.

Günter



[1] https://github.com/culturegraph/metafacture-core/wiki/Testing-Framework-for-Metamorph
[2] https://github.com/guenterh/mfSandbox/blob/master/src/test/java/org/guenterH/discover/step1/morph/MarcFormetaGH.xml
[3] https://github.com/guenterh/mfSandbox/blob/master/src/test/java/org/guenterH/discover/step1/morph/DataSource.java
[4] https://github.com/guenterh/mfSandbox/blob/master/src/test/java/org/guenterH/discover/step1/morph/MarcXMLNotOkGH.xml


--

Universität Basel

Universitätsbibliothek

Günter Hipler

Projekt SwissBib

Schoenbeinstrasse 18-20

4056 Basel, Schweiz

Tel.: + 41 (0)61 267 31 12 Fax: ++41 61 267 3103

E-Mail guenter.hipler at unibas.ch<mailto:guenter.hipler at unibas.ch>

URL: www.swissbib.org<http://www.swissbib.org>  / http://www.ub.unibas.ch/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dnb.de/pipermail/metafacture/attachments/20150426/1dd96369/attachment.html


More information about the Metafacture mailing list