Skip to content

hbz/metafacture-java-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Setup

Prerequisites: Java 8, Maven 3; verify with mvn -version

Maven

Create and change into a folder where you want to store the project:

  • mkdir ~/git ; cd ~/git

Clone metafacture-java-examples:

  • git clone https://github.com/hbz/metafacture-java-examples.git

Build metafacture-java-examples:

  • 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 src/test/resources.

Eclipse

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:
  • FileImport...MavenExisting Maven Projects...NextBrowse... → select ~/gitFinish
  • 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:
  • Window (on Mac: Eclipse) → PreferencesXMLXML Catalog
  • select User Specified EntriesAdd...Workspace...metafacture-core/src/main/resources/schemata/metamorph.xsd
  • repeat previous step for metamorph-test.xsd in 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 src/test/resources.