From 9b259a3f7554f47907db159a8d909cc96282d73f Mon Sep 17 00:00:00 2001 From: Anne Ferger Date: Fri, 26 Jan 2024 15:18:46 +0100 Subject: [PATCH] updated conversion including mei 4 to 5 comprises versoin 0.3.0 --- pom.xml | 2 +- .../de/edirom/meigarage/mei/Conversion.java | 85 ++++++++++++++++++- .../meigarage/mei/ConverterConfiguration.java | 6 ++ .../edirom/meigarage/mei/MEIXSLConverter.java | 42 +++++++++ 4 files changed, 133 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 05c05f2..d3808b6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.edirom.meigarage mei-xsl-converter - 0.2.3 + 0.3.0 MEI XSL Converter diff --git a/src/main/java/de/edirom/meigarage/mei/Conversion.java b/src/main/java/de/edirom/meigarage/mei/Conversion.java index 45a6973..6ecfd5c 100644 --- a/src/main/java/de/edirom/meigarage/mei/Conversion.java +++ b/src/main/java/de/edirom/meigarage/mei/Conversion.java @@ -160,8 +160,91 @@ public enum Conversion { true, // "visible as input" 9, // "cost" new HashMap() {} + ), + MEI2MARC( + "mei2marc", // "id" + "text/xml", // "output format id" + "mei21", // "input format id" + "MEI 2.1 (2013) Document", // "input description" + "score", // "output type" (score, audio, image, customization) + "text/xml", // "input mime type" + "marcxml", // "input format id" + "MARC XML Document", // "input description" + "score", // "input type" (score, audio, image, customization) + true, // "visible as input" + 9, // "cost" + new HashMap() {} + ), + MEI2MODS( + "mei2mods", // "id" + "text/xml", // "output format id" + "mei21", // "input format id" + "MEI 2.1 (2013) Document", // "input description" + "score", // "output type" (score, audio, image, customization) + "text/xml", // "input mime type" + "mods", // "input format id" + "MODS (Metadata Object Description Schema) XML Document", // "input description" + "score", // "input type" (score, audio, image, customization) + true, // "visible as input" + 9, // "cost" + new HashMap() {} + ), + MEI2MUP( + "mei2mup", // "id" + "text/xml", // "intput format id" + "mei21", // "input format id" + "MEI 2.1 (2013) Document", // "input description" + "score", // "input type" (score, audio, image, customization) + "text/x-mup", // "output mime type" + "mup", // "output format id" + "Mup music publication program", // "output description" + "score", // "output type" (score, audio, image, customization) + true, // "visible as input" + 9, // "cost" + new HashMap() {} + ), + MEI2MUSICXML( + "mei2musicxml", // "id" + "text/xml", // "intput format id" + "mei21", // "input format id" + "MEI 2.1 (2013) Document", // "input description" + "score", // "input type" (score, audio, image, customization) + "text/xml", // "input mime type" + "musicxml-timewise", // "input format id" + "MusicXML Document (timewise)", // "input description" + "score", // "input type" (score, audio, image, customization) + true, // "visible as input" + 9, // "cost" + new HashMap() {} + ), + MEI40TO50( + "mei40to50", // "id" + "text/xml", // "input mime type" + "mei40", // "input format id" + "MEI 4.0 (2018) Document", // "input description" + "score", // "input type" (score, audio, image, customization) + "text/xml", // "output format id" + "mei50", // "output format id" + "MEI 5.0 (2023) Document", // "output description" + "score", // "output type" (score, audio, image, customization) + true, // "visible as input" + 9, // "cost" + new HashMap() {} + ), + MNX2MEI( + "mnx2mei", // "id" + "application/json", // "input mime type" + "mnx", // "input format id" + "MNX JSON Document", // "input description" + "score", // "input type" (score, audio, image, customization) + "text/xml", // "output format id" + "mei40", // "input format id" + "MEI 4.0 (2018) Document", // "input description" + "score", // "output type" (score, audio, image, customization) + true, // "visible as input" + 9, // "cost" + new HashMap() {} ) - ; diff --git a/src/main/java/de/edirom/meigarage/mei/ConverterConfiguration.java b/src/main/java/de/edirom/meigarage/mei/ConverterConfiguration.java index 46a5d73..6016730 100644 --- a/src/main/java/de/edirom/meigarage/mei/ConverterConfiguration.java +++ b/src/main/java/de/edirom/meigarage/mei/ConverterConfiguration.java @@ -35,6 +35,12 @@ public class ConverterConfiguration { CONVERSIONS.add(getConversionActionArgument(Conversion.MEI2012TOMEI21)); CONVERSIONS.add(getConversionActionArgument(Conversion.MEI40TOLILYPOND)); CONVERSIONS.add(getConversionActionArgument(Conversion.COMPAREFILES)); + CONVERSIONS.add(getConversionActionArgument(Conversion.MEI2MARC)); + CONVERSIONS.add(getConversionActionArgument(Conversion.MEI2MODS)); + CONVERSIONS.add(getConversionActionArgument(Conversion.MEI2MUP)); + CONVERSIONS.add(getConversionActionArgument(Conversion.MEI2MUSICXML)); + CONVERSIONS.add(getConversionActionArgument(Conversion.MEI40TO50)); + CONVERSIONS.add(getConversionActionArgument(Conversion.MNX2MEI)); } private static ConversionActionArguments getConversionActionArgument(Conversion format) { diff --git a/src/main/java/de/edirom/meigarage/mei/MEIXSLConverter.java b/src/main/java/de/edirom/meigarage/mei/MEIXSLConverter.java index d758bd7..723eeb0 100644 --- a/src/main/java/de/edirom/meigarage/mei/MEIXSLConverter.java +++ b/src/main/java/de/edirom/meigarage/mei/MEIXSLConverter.java @@ -203,6 +203,48 @@ else if(fromDataType.getFormat().equals(Conversion.COMPAREFILES.getIFormatId()) properties.put("base", "data-configuration/scripts/"); performXsltTransformation(inputStream, outputStream, "data-configuration/scripts/compare.files.xsl", properties, tempDir); } + else if(fromDataType.getFormat().equals(Conversion.MEI2MARC.getIFormatId()) && + toDataType.getFormat().equals(Conversion.MEI2MARC.getOFormatId())) { + + properties.put("extension", "xml"); + properties.put("base", "encoding-tools/mei2marc/"); + performXsltTransformation(inputStream, outputStream, "encoding-tools/mei2marc/mei2marc.xsl", properties, tempDir); + } + else if(fromDataType.getFormat().equals(Conversion.MEI2MODS.getIFormatId()) && + toDataType.getFormat().equals(Conversion.MEI2MODS.getOFormatId())) { + + properties.put("extension", "xml"); + properties.put("base", "encoding-tools/mei2mods/"); + performXsltTransformation(inputStream, outputStream, "encoding-tools/mei2mods/mei2mods.xsl", properties, tempDir); + } + else if(fromDataType.getFormat().equals(Conversion.MEI2MUP.getIFormatId()) && + toDataType.getFormat().equals(Conversion.MEI2MUP.getOFormatId())) { + + properties.put("extension", "xml"); + properties.put("base", " encoding-tools/mei2mup/"); + performXsltTransformation(inputStream, outputStream, "encoding-tools/mei2mup/mei2mup-1.0.3.xsl", properties, tempDir); + } + else if(fromDataType.getFormat().equals(Conversion.MEI2MUSICXML.getIFormatId()) && + toDataType.getFormat().equals(Conversion.MEI2MUSICXML.getOFormatId())) { + + properties.put("extension", "xml"); + properties.put("base", " encoding-tools/mei2musicxml/"); + performXsltTransformation(inputStream, outputStream, "encoding-tools/mei2musicxml/mei2musicxml.xsl", properties, tempDir); + } + else if(fromDataType.getFormat().equals(Conversion.MEI40TO50.getIFormatId()) && + toDataType.getFormat().equals(Conversion.MEI40TO50.getOFormatId())) { + + properties.put("extension", "xml"); + properties.put("base", " encoding-tools/mei40To50/"); + performXsltTransformation(inputStream, outputStream, "encoding-tools/mei40To50/mei40To50.xsl", properties, tempDir); + } + else if(fromDataType.getFormat().equals(Conversion.MNX2MEI.getIFormatId()) && + toDataType.getFormat().equals(Conversion.MNX2MEI.getOFormatId())) { + + properties.put("extension", "xml"); + properties.put("base", " encoding-tools/mnx2mei/"); + performXsltTransformation(inputStream, outputStream, "encoding-tools/mnx2mei/mnx2mei.xsl", properties, tempDir); + } } /*