Created
November 7, 2013 16:43
-
-
Save dr0i/7357697 to your computer and use it in GitHub Desktop.
Hbz01-stats-example.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2013 hbz, Pascal Christoph. | |
* Licensed under the Eclipse Public License 1.0 */ | |
package org.lobid.lodmill; | |
import java.io.File; | |
import java.io.IOException; | |
import org.culturegraph.mf.morph.Metamorph; | |
import org.culturegraph.mf.stream.converter.xml.XmlDecoder; | |
import org.culturegraph.mf.stream.source.DirReader; | |
import org.culturegraph.mf.stream.source.FileOpener; | |
import org.junit.Test; | |
/** | |
* @author Pascal Christoph | |
* | |
*/ | |
@SuppressWarnings("javadoc") | |
public final class MabTarXml2lobidTest { | |
@SuppressWarnings("static-method") | |
@Test | |
public void testFlow() throws IOException { | |
final DirReader dirOpener = new DirReader(); | |
final FileOpener opener = new FileOpener(); | |
opener.setCompression("BZIP2"); | |
dirOpener.setReceiver(opener); | |
final XmlDecoder xmlDecoder = new XmlDecoder(); | |
final MabXmlHandler handler = new MabXmlHandler(); | |
final Metamorph morph = new Metamorph("default_morph-stats.xml");// morph-hbz01-to-lobid.xml"; | |
final Stats stats = new Stats(); | |
opener.setReceiver(xmlDecoder).setReceiver(handler).setReceiver(morph) | |
.setReceiver(stats); | |
File infile = new File("hbzvk/snapshot/01604/");// | |
dirOpener.process(infile.getAbsolutePath()); | |
Stats.writeTextileMappingTable(stats.sortedByValuesDescending(), new File( | |
"/dev/null")); | |
opener.closeStream(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment