Metafacture Java Examples
This is a minimal Java 8 Maven project with solutions to the exercises from the workshop Analysis of library metadata with Metafacture conducted by Christoph Böhme at SWIB13. It can be used as a template for Java projects using Metafacture.
The processing pipelines or workflows are built using the typesafe Metafacture Java API directly, not the Flux DSL.
Prerequisites: Java 8, Maven 3; verify with
Create and change into a folder where you want to store the project:
mkdir ~/git ; cd ~/git
git clone https://github.com/hbz/metafacture-java-examples.git
mvn clean verify
Run the included metamorph tests:
mvn clean test
Run a sample with Maven:
mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass="samples.Sample1_PrintData"
Output is written to the individual folders for each sample in
The processing pipelines are written in Java, the actual transformation logic and tests are written in XML. Both can be comfortably edited using Eclipse, which provides content assist (auto-suggest), Maven support, and direct execution of the tests and the transformation.
- Download and run the Eclipse Java IDE (at least version 4.4, Luna), close the welcome screen and import metafacture-core and metafacture-java-examples:
Existing Maven Projects...→
- Follow the instructions for installing additional plugins and restart Eclipse when it asks you to
- Set up the XML schemas for content assist and documentation while editing metamorph and metamorph-test files:
User Specified Entries→
- repeat previous step for
metamorph-test.xsdin the same location
To run a sample in Eclipse, open
metafacture-java-examples/src/test/java/samples, right click a sample → ‘Run As…’ → ‘Java Application’. Output is written to the corresponding folder in