diff --git a/pom.xml b/pom.xml
index 89795b5..d9722e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,19 +2,27 @@
- 4.0.0
+ 4.0.0org.dataconservancy.pkgtooldcs-packaging-tool-cli1.0.0-SNAPSHOTAutomated Packaging Command Line Tool
+
org.dataconservancyproject-pom8
+
-
+
+
+ standalone
+ ${project.artifactId}
+ dist
+ ${project.artifactId}
+
@@ -46,6 +54,19 @@
org.apache.maven.pluginsmaven-jar-plugin3.0.0
+
+
+
+ true
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 3.0.0org.apache.maven.plugins
@@ -125,6 +146,53 @@
org.jacocojacoco-maven-plugin
+
+ maven-assembly-plugin
+
+ true
+ true
+
+
+
+ standalone-jar
+ package
+
+ single
+
+
+
+
+ org.dataconservancy.packaging.tool.cli.AutomatedPackageTool
+ true
+ true
+
+
+ ${project.name}
+ ${project.version}
+ r${buildNumber}
+
+
+
+
+ jar-with-dependencies
+
+
+
+
+ dist
+ package
+
+ single
+
+
+
+
+ bin
+
+
+
+
+
@@ -140,22 +208,42 @@
org.slf4jslf4j-api
- 1.7.10
+ 1.7.21
+
+
+ ch.qos.logback
+ logback-classic
+ 1.1.2org.dataconservancy.pkgtooldcs-packaging-tool-api
- 1.0.3
+ 1.0.8-SNAPSHOT
+
+
+ org.dataconservancy.pkgtool
+ dcs-packaging-tool-impl
+ 1.0.8-SNAPSHOT
+
+
+ org.dataconservancy.pkgtool
+ dcs-packaging-tool-ser
+ 1.0.8-SNAPSHOTorg.dataconservancy.pkgtooldcs-packaging-tool-model-builder
- 1.0.3
+ 1.0.8-SNAPSHOTorg.dataconservancy.packaging.shareddcs-packaging-shared
- 1.0.0-SNAPSHOT
+ 1.0.1-SNAPSHOT
+
+
+ org.dataconservancy.rules
+ dcs-packaging-rules
+ 0.1.0-SNAPSHOT
@@ -176,10 +264,28 @@
org.dataconservancy.pkgtooldcs-packaging-tool-api
+
+ org.dataconservancy.pkgtool
+ dcs-packaging-tool-impl
+
+
+ org.dataconservancy.pkgtool
+ dcs-packaging-tool-ser
+ org.dataconservancy.pkgtooldcs-packaging-tool-model-builder
+
+ org.dataconservancy.rules
+ dcs-packaging-rules
+
+
+ org.slf4j
+ slf4j-simple
+
+
+
@@ -196,11 +302,42 @@
ch.qos.logbacklogback-classic
- runtime
+ 1.1.2
+
+
+
+
+ dc.maven.releases
+ Data Conservancy Public Maven 2 Repository (releases)
+ default
+ http://maven.dataconservancy.org/public/releases/
+
+ true
+
+
+ false
+
+
+
+
+ dc.maven.snapshots
+ Data Conservancy Public Maven 2 Repository (snapshots)
+ default
+ http://maven.dataconservancy.org/public/snapshots/
+
+ false
+
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/org/dataconservancy/packaging/tool/cli/AutomatedPackageTool.java b/src/main/java/org/dataconservancy/packaging/tool/cli/AutomatedPackageTool.java
index b4956be..691b94a 100644
--- a/src/main/java/org/dataconservancy/packaging/tool/cli/AutomatedPackageTool.java
+++ b/src/main/java/org/dataconservancy/packaging/tool/cli/AutomatedPackageTool.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Johns Hopkins University
+ * Copyright 2017 Johns Hopkins University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,223 +17,361 @@
package org.dataconservancy.packaging.tool.cli;
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.jena.rdf.model.Model;
+
+import org.dataconservancy.packaging.shared.IpmPackager;
import org.dataconservancy.packaging.tool.api.PackagingFormat;
+import org.dataconservancy.packaging.tool.api.RulesEngine;
+import org.dataconservancy.packaging.tool.api.RulesEngineException;
+import org.dataconservancy.packaging.tool.impl.RulesEngineImpl;
+import org.dataconservancy.packaging.tool.model.BagItParameterNames;
import org.dataconservancy.packaging.tool.model.GeneralParameterNames;
+import org.dataconservancy.packaging.tool.model.PackageDescriptionRulesBuilder;
import org.dataconservancy.packaging.tool.model.PackageGenerationParameters;
-import org.dataconservancy.packaging.tool.model.PackageGenerationParametersBuilder;
import org.dataconservancy.packaging.tool.model.PackageToolException;
import org.dataconservancy.packaging.tool.model.PackagingToolReturnInfo;
import org.dataconservancy.packaging.tool.model.ParametersBuildException;
+import org.dataconservancy.packaging.tool.model.PropertiesConfigurationParametersBuilder;
+import org.dataconservancy.packaging.tool.model.builder.xstream.JaxbPackageDescriptionRulesBuilder;
+import org.dataconservancy.packaging.tool.model.rules.RulesSpec;
+
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDate;
import java.util.List;
import java.util.Properties;
-import org.slf4j.Logger;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
import org.slf4j.LoggerFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
/**
- * Created by jrm on 8/10/16.
- *
- * @author jrm
+ * Command line interface to create a DC package as directed by the rules engine.
+ * @author jrm - initial framework.
+ * @author Ben Trumbore (wbt3@cornell.edu) - connect CLI to functionality.
*/
+@SuppressWarnings({"unused", "FieldCanBeLocal"})
public class AutomatedPackageTool {
- private final static String rulesFileName = "rules.xsd";
- private final static String packageMetadataFileName = "packageMetadata";
- private final static String packageGenerationsParametersFileName = "packageGenerationParameters";
- private final static File userDataconservancyDirectory = new File(System.getProperty("user.home") + File.pathSeparator + ".dataconservancy");
- private final static String defaultResourceConfigPath = "/org/dataconservancy/apt/config/";
+ private static final String rulesFileName = "apt-rules.xml";
+ private static final String packageGenerationsParametersFileName = "packageGenerationParameters";
+ private static final String defaultResourceConfigPath = "/org/dataconservancy/apt/config/";
+ private static final String packageNameKey = "Package-Name";
+ private static final String defaultPackageName = "MyPackage";
+
+ private static final File userDcDir = new File(System.getProperty("user.home") + "/.dataconservancy");
+ private static final String javaTemp = System.getProperty("java.io.tmpdir").replace(File.separatorChar, '/');
- private final Logger log = LoggerFactory.getLogger(this.getClass());
+ private final Logger log = (Logger)LoggerFactory.getLogger(this.getClass());
- /*
- *
- * Arguments
- */
- @Argument(required = true, index = 0, metaVar = "[content]", usage = "content root directory")
- private File contentRootFile = null;
+ private PackageGenerationParameters packageParams = new PackageGenerationParameters();
- @Argument(required = false, index = 1, metaVar = "[profile]", usage = "domain profile file")
- private File domainProfileFile = null;
+ /*
+ * Arguments
+ */
+ @Argument(required = true, index = 0, metaVar = "", usage = "content root directory")
+ private static File contentRootFile;
- /*
- *
- * General Options
- */
- /** Request for help/usage documentation */
- @Option(name = "-h", aliases = { "-help", "--help" }, usage = "print help message")
- private boolean help = false;
+ @Argument(required = true, index = 1, metaVar = "", usage = "package metadata file location")
+ private static File packageMetadataFile;
- /** Requests the current version number of the cli application. */
- @Option(name = "-v", aliases = { "-version", "--version" }, usage = "print version information")
- private boolean version = false;
+ /*
+ * General Options
+ */
+ /** Request for help/usage documentation */
+ @Option(name = "-h", aliases = { "-help", "--help" }, usage = "print help message")
+ private boolean help = false;
+
+ /** Requests the current version number of the cli application. */
+ @Option(name = "-v", aliases = { "-version", "--version" }, usage = "print version information")
+ private boolean version = false;
/** Requests for debugging info. */
- @Option(name = "-d", aliases = { "-debug", "--debug" }, usage = "print debug information")
- private boolean debug = false;
+ @Option(name = "-d", aliases = { "-debug", "--debug" }, usage = "print debug information")
+ private boolean debug = false;
/** Requests for parameter info */
@Option(name = "-i", aliases = { "-info", "--info"}, usage = "print parameter info")
private boolean info = false;
- /*
- *
- * Package Generation Options
- */
- /** Packaging format */
- @Option(name = "-f", aliases = { "--format" }, usage = "packaging format to use")
- private PackagingFormat pkgFormat = PackagingFormat.BOREM;
+ /*
+ * Package Generation Options
+ */
+ /** Package Generation Params location **/
+ @Option(name = "-g", aliases = { "--generation-params" }, metaVar = "",
+ usage = "package generation params file location")
+ private static File packageGenerationParamsFile;
+
+ /** Rules file **/
+ @Option(name = "-r", aliases = {"--rules", "--rules-file"}, metaVar = "",
+ usage = "The location of the rules file")
+ private static File rulesFile;
+
+ /** Package Name **/
+ @Option(name = "-n", aliases = { "--name", "--package-name"}, metaVar = "",
+ usage = "The package name, which also determines the output filename. " +
+ "Will override value in Package Generation Parameters file.")
+ private static String packageName;
- /** Package Generation Params location */
- @Option(name = "-g", aliases = { "--generation-params" }, metaVar = "", usage = "package generation params file location")
- private static File packageGenerationParamsFile;
+ /** Package output location **/
+ @Option(name = "-o", aliases = { "--location", "--output-location"}, metaVar = "",
+ usage = "The output directory to which the package file will be written. " +
+ "Will override value in Package Generation Parameters file.")
+ private static File outputLocation;
+
+ /** Force overwrite of target file **/
+ @Option(name = "--overwrite", aliases = { "--force" },
+ usage = "If specified, will overwrite if the destination package file already exists without prompting.")
+ private static boolean overwriteIfExists = false;
+
+ /** Package staging location **/
+ @Option(name = "--stage", aliases = { "--staging", "--staging-location", "--package-staging-location"},
+ metaVar = "", usage = "The directory to which the package will be staged before building. " +
+ "Will override value in Package Generation Parameters file.")
+ private String packageStagingLocation = javaTemp + "DCS-PackageToolStaging";
- /** Package Metadata File location */
- @Option(name = "-m", aliases = { "--package-metadata" }, metaVar = "", usage = "package metadata file location")
- private static File packageMetadataFile;
+ /** Packaging format **/
+ @Option(name = "-f", aliases = { "--format" }, usage = "packaging format to use")
+ private PackagingFormat pkgFormat = PackagingFormat.BOREM;
/** Archive format **/
- @Option(name = "-a", aliases = { "--archiving-format"}, metaVar = "tar|zip", usage = "Archive format to use when creating the package. Defaults to tar")
+ @Option(name = "-a", aliases = { "--archiving-format"}, metaVar = "tar|zip",
+ usage = "Archive format to use when creating the package. Defaults to tar")
private String archiveFormat;
/** Compression format for tar archives **/
- @Option(name = "-c", aliases = { "--compression-format"}, metaVar = "gz|none", usage = "Compression format, if archive type is tar. If not specified, no compression is used. Ignored if non-tar archive is used.")
+ @Option(name = "-c", aliases = { "--compression-format"}, metaVar = "gz|none",
+ usage = "Compression format, if archive type is tar. " +
+ "If not specified, no compression is used. Ignored if non-tar archive is used.")
private String compressionFormat;
/** Checksum algorithms **/
- @Option(name = "-s", aliases = { "--checksum"}, metaVar = "md5|sha1", usage = "Checksum algorithms to use. If none specified, will use md5. Can be specified multiple times")
+ @Option(name = "-s", aliases = { "--checksum"}, metaVar = "md5|sha1",
+ usage = "Checksum algorithms to use. If none specified, will use md5. Can be specified multiple times")
private List checksums;
- /** Package Name **/
- @Option(name = "-n", aliases = { "--name", "--package-name"}, metaVar = "", usage = "The package name, which also determines the output filename. Will override value in Package Generation Parameters file.")
- private static String packageName;
+ /** Serialization Format **/
+ @Option(name = "-z", aliases = { "--serialization", "--serialization-format"}, metaVar = "JSONLD|TURTLE|XML",
+ usage = "Serialization format for the ORE-ReM file")
+ private String serializationFormat;
- /** Package output location **/
- @Option(name = "-o", aliases = { "--location", "--output-location"}, metaVar = "", usage = "The output directory to which the package file will be written. Will override value in Package Generation Parameters file.")
- private static File outputLocation;
+ /** Serialization Format **/
+ @Option(name = "-eid", aliases = { "--external-project-id"},
+ usage = "External project ID to associate with the package")
+ private String externalID;
- /** Package staging location **/
- @Option(name = "--stage", aliases = { "--staging", "--staging-location", "--package-staging-location"}, metaVar = "", usage = "The directory to which the package will be staged before building. Will override value in Package Generation Parameters file.")
- private String packageStagingLocation;
- /** Force overwrite of target file **/
- @Option(name = "--overwrite", aliases = { "--force" }, usage = "If specified, will overwrite if the destination package file already exists without prompting.")
- private boolean overwriteIfExists = false;
-
- /** Write to stdout **/
- @Option(name = "--stdout", usage = "Write to stdout, instead of to a file.")
- private boolean stdout = false;
+ /**
+ * Entry point for the application
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
- /** Serialization Format **/
- @Option(name = "-z", aliases = { "--serialization", "--serialization-format"}, metaVar="JSONLD|TURTLE|XML", usage = "Serialization format for the ORE-ReM file")
- private String serializationFormat;
+ final AutomatedPackageTool application = new AutomatedPackageTool();
- /** Rules file **/
- @Option(name = "-r", aliases = {"--rules", "--rules-file"}, metaVar = "", usage = "Thelocation of the rules file")
- private static File rulesFile;
+ final CmdLineParser parser = new CmdLineParser(application);
+ parser.getProperties().withUsageWidth(80);
- public static void main(String[] args) {
+ try {
+ parser.parseArgument(args);
+
+ // Handle general options such as help, version.
+ if (application.help) {
+ parser.printUsage(System.err);
+ System.err.println();
+ System.exit(0);
+ } else if (application.version) {
+ System.err.println(AutomatedPackageTool.class.getPackage().getImplementationVersion());
+ System.exit(0);
+ }
- final AutomatedPackageTool application = new AutomatedPackageTool();
+ if (!contentRootFile.exists() || !contentRootFile.isDirectory()) {
+ System.err.println("Supplied content directory " + contentRootFile.getCanonicalPath() +
+ " does not exist or is not a directory.");
+ System.exit(1);
+ }
- CmdLineParser parser = new CmdLineParser(application);
- parser.setUsageWidth(80);
-
- try {
- parser.parseArgument(args);
-
- /* Handle general options such as help, version */
- if (application.help) {
- parser.printUsage(System.err);
- System.err.println();
- System.exit(0);
- } else if (application.version) {
- System.err.println(AutomatedPackageTool.class.getPackage()
- .getImplementationVersion());
- System.exit(0);
- }
-
- if (!outputLocation.exists() || !outputLocation.isDirectory()) {
- System.err.println("Supplied output file directory " + outputLocation.getCanonicalPath() + " does not exist or is not a directory.");
+ if (outputLocation != null && (!outputLocation.exists() || !outputLocation.isDirectory())) {
+ System.err.println("Supplied output file directory " + outputLocation.getCanonicalPath() +
+ " does not exist or is not a directory.");
System.exit(1);
}
- if (!(packageName.length() > 0)) {
+ if (packageName != null && !(packageName.length() > 0)) {
System.err.println("Bag name must have positive length.");
System.exit(1);
}
- if (packageMetadataFile != null && (!packageMetadataFile.exists() || !packageMetadataFile.isFile())) {
- System.err.println("Supplied package metadata file " + packageMetadataFile.getCanonicalPath() + " does not exist or is not a file.");
+ if (!packageMetadataFile.exists() || !packageMetadataFile.isFile()) {
+ System.err.println("Supplied package metadata file " + packageMetadataFile.getCanonicalPath() +
+ " does not exist or is not a file.");
System.exit(1);
}
- if(rulesFile != null && (!rulesFile.exists() || !rulesFile.isFile())){
- System.err.println("Supplied rules file " + rulesFile.getCanonicalPath() + " does not exist or is not a file.");
+ if (rulesFile != null && (!rulesFile.exists() || !rulesFile.isFile())) {
+ System.err.println("Supplied rules file " + rulesFile.getCanonicalPath() +
+ " does not exist or is not a file.");
System.exit(1);
}
- /* Run the package generation application proper */
- application.run();
-
- } catch (CmdLineException e) {
- /*
- * This is an error in command line args, just print out usage data
- * and description of the error.
- */
- System.err.println(e.getMessage());
- parser.printUsage(System.err);
- System.err.println();
- System.exit(1);
- } catch (Exception e) {
+ // Run the package generation application proper.
+ application.run();
+
+ } catch (CmdLineException e) {
+ // This is an error in command line args, just print out usage data and description of the error.
+ System.err.println(e.getMessage());
+ parser.printUsage(System.err);
+ System.err.println();
+ System.exit(1);
+ } catch (Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
- private void run() throws Exception {
- final ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
- "classpath*:org/dataconservancy/apt/config/applicationContext.xml",
- "classpath*:org/dataconservancy/config/applicationContext.xml",
- "classpath*:org/dataconservancy/packaging/tool/ser/config/applicationContext.xml");
- boolean useDefaults = true;
+ private void run() throws Exception {
+ // Control the logger output level.
+ final Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ if (debug) {
+ root.setLevel(Level.DEBUG);
+ } else {
+ root.setLevel(Level.WARN); // TODO - Change to INFO when some info logging is moved to debug.
+ }
+
+ // Get the inputs to the packager.
+ final RdfContentProvider contentProvider = createContentProvider();
+ final InputStream paramsStream = collectPackagingParameters();
+ final InputStream metadataStream = createPackageMetadata();
+
+ // Create the package and copy it to the output folder
+ if (contentProvider != null) {
+ final IpmPackager packager = new IpmPackager();
+ packager.setPackageName(packageName);
+ final org.dataconservancy.packaging.tool.api.Package pkg =
+ packager.buildPackage(contentProvider, metadataStream, paramsStream);
+ copyPackage(pkg);
+ }
+ }
- // Prepare parameter builder
- PackageGenerationParametersBuilder parametersBuilder = appContext.getBean("packageGenerationParametersBuilder",
- PackageGenerationParametersBuilder.class);
- // Load parameters first from default, then override with home directory .packageGenerationParameters, then with
- // specified params file (if given).
- PackageGenerationParameters packageParams;
+ private RdfContentProvider createContentProvider() {
+ final InputStream rulesStream = getPackagingRules();
+ final Model jenaModel = createJenaModel(rulesStream);
+ // Create content provider using local data path
+ final String rootPath;
try {
- packageParams = parametersBuilder.buildParameters(getClass().getResourceAsStream(defaultResourceConfigPath + packageGenerationsParametersFileName));
+ rootPath = contentRootFile.getCanonicalPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ RdfContentProvider contentProvider = null;
+ try {
+ final String parentFolder = new File(rootPath).getParent();
+ // Handle Windows path separators
+ final URI contentURI = new URI(parentFolder.replace(File.separatorChar, '/'));
+ contentProvider = new RdfContentProvider(jenaModel, contentURI);
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+
+ return contentProvider;
+ }
+
+
+ // Resolve the rules file location. Priority is given to a command line file path,
+ // then to the user's default location, then to the application default.
+ private InputStream getPackagingRules() {
+ InputStream rulesStream = null;
+ try {
+ if (rulesFile == null) {
+ final File userRulesFile = new File(userDcDir, rulesFileName);
+ if (userRulesFile.exists()) {
+ rulesStream = new FileInputStream(userRulesFile);
+ } else {
+ // Get the default rules file supplied with the app
+ rulesStream = getClass().getResourceAsStream(defaultResourceConfigPath + rulesFileName);
+ }
+ } else {
+ rulesStream = new FileInputStream(rulesFile);
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ return rulesStream;
+ }
+
+
+ private Model createJenaModel(final InputStream rulesStream) {
+ // Rules engine creates Jena model from rules and local data
+ final PackageDescriptionRulesBuilder builder = new JaxbPackageDescriptionRulesBuilder();
+ final RulesSpec rulesSpec = builder.buildPackageDescriptionRules(rulesStream);
+ final RulesEngine engine = new RulesEngineImpl(rulesSpec);
+
+ final String dataPath;
+ try {
+ dataPath = contentRootFile.getCanonicalPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ final File dataFolder = new File(dataPath);
+ Model jenaModel = null;
+ try {
+ jenaModel = engine.generateRdf(dataFolder);
+ } catch (RulesEngineException e) {
+ e.printStackTrace();
+ }
+
+ return jenaModel;
+ }
+
+
+ // Load parameters first from application default, then override with file of user defaults,
+ // then override with a specified parameters file (if given), then with command line options.
+ private InputStream collectPackagingParameters() {
+ // Get default parameters from a source code resource.
+ try {
+ packageParams = new PropertiesConfigurationParametersBuilder().
+ buildParameters(getClass().getResourceAsStream(defaultResourceConfigPath +
+ packageGenerationsParametersFileName));
updateCompression(packageParams);
} catch (ParametersBuildException e) {
throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_PARAM_BUILD_EXCEPTION, e);
}
- File userParamsFile = new File(userDataconservancyDirectory, packageGenerationsParametersFileName);
+ // Override any parameters defined in the user's default parameter file.
+ final File userParamsFile = new File(userDcDir, packageGenerationsParametersFileName);
if (userParamsFile.exists()) {
try {
- PackageGenerationParameters homeParams =
- parametersBuilder.buildParameters(new FileInputStream(userParamsFile));
+ final PackageGenerationParameters homeParams = new PropertiesConfigurationParametersBuilder().
+ buildParameters(new FileInputStream(userParamsFile));
- System.err.println("Overriding generation parameters with values from standard '" + packageGenerationsParametersFileName + "'");
- useDefaults = false;
+ System.err.println("Overriding generation parameters with values from standard '" +
+ packageGenerationsParametersFileName + "'");
updateCompression(homeParams);
packageParams.overrideParams(homeParams);
} catch (FileNotFoundException e) {
@@ -243,13 +381,14 @@ private void run() throws Exception {
}
}
+ // Override any parameters defined in a file provided as a command line option.
if (packageGenerationParamsFile != null) {
try {
- PackageGenerationParameters fileParams = parametersBuilder.
+ final PackageGenerationParameters fileParams = new PropertiesConfigurationParametersBuilder().
buildParameters(new FileInputStream(packageGenerationParamsFile));
- System.err.println("Overriding generation parameters with values from " + packageGenerationParamsFile + " specified on command line");
- useDefaults = false;
+ System.err.println("Overriding generation parameters with values from " +
+ packageGenerationParamsFile + " specified on command line");
updateCompression(fileParams);
packageParams.overrideParams(fileParams);
} catch (ParametersBuildException e) {
@@ -263,57 +402,33 @@ private void run() throws Exception {
}
}
- // Finally, override with command line options
- // If any options overridden, this will cause useDefaults to become false, if it wasn't already
- PackageGenerationParameters flagParams = createCommandLinePrefs();
+ // Finally, override any parameters specified with individual command line options.
+ final PackageGenerationParameters flagParams = createCommandLinePrefs();
if (!flagParams.getKeys().isEmpty()) {
- useDefaults = false;
System.err.println("Overriding generation parameters using command line flags");
updateCompression(flagParams);
packageParams.overrideParams(flagParams);
}
- //we need to validate any specified file locations in the package generation params to make sure they exist
+ // We need to validate any specified file locations in the package generation parameters
+ // to make sure they exist.
if (packageParams.getParam(GeneralParameterNames.PACKAGE_LOCATION) == null) {
- packageParams.addParam(GeneralParameterNames.PACKAGE_LOCATION, System.getProperty("java.io.tmpdir"));
+ packageParams.addParam(GeneralParameterNames.PACKAGE_LOCATION, javaTemp);
}
+
validateLocationParameters(packageParams);
- // Resolve the rules file location. Priority is given to a command line file path, then to one in the user's home location, then to the app default
- if(rulesFile == null){
- File userRulesFile = new File(userDataconservancyDirectory, rulesFileName);
- if (userRulesFile.exists()){
- rulesFile = userRulesFile;
- } else {
- //get the default rules file supplied with the app
- }
+ // Print the parameter info
+ if (info) {
+ System.err.println("\nPARAMETERS");
+ final String params = packageParams.toParametersString();
+ System.err.println(params);
}
-
- System.err.println("MOOOOOOOOOOOOOOOOOOOOOOOO");
-
+ final String params = packageParams.toParametersString();
+ return new ByteArrayInputStream(params.getBytes(StandardCharsets.UTF_8));
}
- /**
- * we validate locations of files passed as arguments elsewhere, but the locations passed as options
- * eventually end up in the PackageGenerationsParameters. We validate these parameter values only after
- * we finish the process of building the parameters from the various available sources.
- * @param params the package generation parameters
- */
- private void validateLocationParameters(PackageGenerationParameters params) {
-
- //required, cannot be null
- String packageLocation = params.getParam(GeneralParameterNames.PACKAGE_LOCATION, 0);
- if (packageLocation == null || packageLocation.isEmpty()) {
- throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION);
- } else {
- File packageLocationFile = new File(packageLocation);
- if (!packageLocationFile.exists()) {
- System.err.println(packageLocation);
- throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION);
- }
- }
- }
/**
* Update the compression format for the parameters, if necessary.
@@ -321,51 +436,86 @@ private void validateLocationParameters(PackageGenerationParameters params) {
* format to "none" unless another format is explicitly set.
* @param params The package generation params, used to get the file needed
*/
- private void updateCompression(PackageGenerationParameters params) {
- String archive = params.getParam(GeneralParameterNames.ARCHIVING_FORMAT, 0);
- String compress = params.getParam(GeneralParameterNames.COMPRESSION_FORMAT, 0);
+ private void updateCompression(final PackageGenerationParameters params) {
+ final String archive = params.getParam(GeneralParameterNames.ARCHIVING_FORMAT, 0);
+ final String compress = params.getParam(GeneralParameterNames.COMPRESSION_FORMAT, 0);
//manually set the compression to none if archive is ZIP and no compression
// is specifically set in this object, or if archive is exploded
- if (archive != null && ((archive.equals(ArchiveStreamFactory.ZIP) && compress == null) || archive.equals("exploded"))) {
+ if (archive != null &&
+ ((archive.equals(ArchiveStreamFactory.ZIP) && compress == null) || archive.equals("exploded"))) {
params.addParam(GeneralParameterNames.COMPRESSION_FORMAT, "none");
}
}
+
/**
* Create a PackageGenerationParameter for command line flags
* @return a PackageGenerationParameter object with any command line overrides
*/
private PackageGenerationParameters createCommandLinePrefs() {
- PackageGenerationParameters params = new PackageGenerationParameters();
+ final PackageGenerationParameters params = new PackageGenerationParameters();
- if (archiveFormat != null) {params.addParam(GeneralParameterNames.ARCHIVING_FORMAT, archiveFormat);}
- if (compressionFormat != null) {params.addParam(GeneralParameterNames.COMPRESSION_FORMAT, compressionFormat);}
+ if (pkgFormat != null) {
+ params.addParam(GeneralParameterNames.PACKAGE_FORMAT_ID, pkgFormat.toString());
+ }
+ if (archiveFormat != null) {
+ params.addParam(GeneralParameterNames.ARCHIVING_FORMAT, archiveFormat);
+ }
+ if (compressionFormat != null) {
+ params.addParam(GeneralParameterNames.COMPRESSION_FORMAT, compressionFormat);
+ }
if (packageName != null) {
params.addParam(GeneralParameterNames.PACKAGE_NAME, packageName);
- // params.addParam(BagItParameterNames.PKG_BAG_DIR, packageName);
}
- if (outputLocation != null) {params.addParam(GeneralParameterNames.PACKAGE_LOCATION, outputLocation.getAbsolutePath());}
- if (packageStagingLocation != null) {params.addParam(GeneralParameterNames.PACKAGE_STAGING_LOCATION, packageStagingLocation);}
+ if (outputLocation != null) {
+ params.addParam(GeneralParameterNames.PACKAGE_LOCATION, outputLocation.getAbsolutePath());
+ }
+ if (packageStagingLocation != null) {
+ params.addParam(GeneralParameterNames.PACKAGE_STAGING_LOCATION, packageStagingLocation);
+ }
if (checksums != null && !checksums.isEmpty()) {
params.addParam(GeneralParameterNames.CHECKSUM_ALGORITHMS, checksums);
}
- if(serializationFormat != null){
+ if (serializationFormat != null) {
params.addParam(GeneralParameterNames.REM_SERIALIZATION_FORMAT, serializationFormat);
}
+
return params;
}
- private LinkedHashMap> createPackageMetadata(){
- Properties props = new Properties();
- if(packageMetadataFile != null) {
- if(!packageMetadataFile.exists()){
+ /**
+ * we validate locations of files passed as arguments elsewhere, but the locations passed as options
+ * eventually end up in the PackageGenerationsParameters. We validate these parameter values only after
+ * we finish the process of building the parameters from the various available sources.
+ * @param params the package generation parameters
+ */
+ private void validateLocationParameters(final PackageGenerationParameters params) {
+
+ // required, cannot be null
+ final String packageLocation = params.getParam(GeneralParameterNames.PACKAGE_LOCATION, 0);
+ if (packageLocation == null || packageLocation.isEmpty()) {
+ throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION);
+ } else {
+ final File packageLocationFile = new File(packageLocation);
+ if (!packageLocationFile.exists()) {
+ System.err.println(packageLocation);
+ throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION);
+ }
+ }
+ }
+
+
+ private InputStream createPackageMetadata() {
+ final Properties metadata = new Properties();
+ if (packageMetadataFile != null) {
+ if (!packageMetadataFile.exists()) {
throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION);
}
try (InputStream fileStream = new FileInputStream(packageMetadataFile)) {
- props.load(fileStream);
+ metadata.load(fileStream);
} catch (FileNotFoundException e) {
throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION, e);
} catch (IOException e) {
@@ -373,16 +523,75 @@ private LinkedHashMap> createPackageMetadata(){
throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION);
}
}
- LinkedHashMap> metadata = new LinkedHashMap<>();
- List valueList;
- for (String key : props.stringPropertyNames()) {
- valueList = Arrays.asList(props.getProperty(key).trim().split("\\s*,\\s*"));
- metadata.put(key,valueList);
+ if (! metadata.containsKey(packageNameKey)) {
+ final List name = packageParams.getParam(packageNameKey);
+ if (name != null && name.size() > 0) {
+ metadata.setProperty(packageNameKey, name.get(name.size() - 1));
+ } else {
+ metadata.setProperty(packageNameKey, defaultPackageName);
+ }
+ } else if (packageName == null) {
+ packageName = metadata.getProperty(packageNameKey);
+ } else {
+ metadata.setProperty(packageNameKey, packageName);
+ }
+
+ if (externalID != null) {
+ metadata.setProperty(GeneralParameterNames.EXTERNAL_PROJECT_ID, externalID);
}
- return metadata;
+ metadata.setProperty(BagItParameterNames.BAGGING_DATE, LocalDate.now().toString());
+
+ final ByteArrayOutputStream metaDataOut = new ByteArrayOutputStream();
+ InputStream metadataStream = null;
+ try {
+ metadata.store(metaDataOut, null);
+ metaDataOut.close();
+ metadataStream = new ByteArrayInputStream(metaDataOut.toByteArray());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return metadataStream;
}
+ private void copyPackage(final org.dataconservancy.packaging.tool.api.Package pkg) {
+ // Determine the file to copy
+ final String sourceName = pkg.getPackageName();
+ final Path sourcePath = Paths.get(packageStagingLocation, sourceName);
+
+ // If no output location is specified, don't copy the package
+ if (outputLocation == null) {
+ System.err.printf("Package '%s' has been created.\n", sourcePath);
+ return;
+ }
+
+ // Determine the file to create
+ Path destPath = Paths.get(outputLocation.getAbsolutePath(), sourceName);
+ File dest = new File(destPath.toString());
+
+ // If the file already exists and we can't overwrite it, find a new name
+ if (! overwriteIfExists) {
+ int index = 0;
+ final String extension = sourceName.substring(packageName.length());
+ while (dest.exists()) {
+ // Append (#) to the root of the file name to avoid the conflict
+ index++;
+ final String destName = String.format("%s (%d)%s", packageName, index, extension);
+ destPath = Paths.get(outputLocation.getAbsolutePath(), destName);
+ dest = new File(destPath.toString());
+ }
+ }
+
+ // Copy the file
+ try {
+ Files.copy(sourcePath, destPath, REPLACE_EXISTING);
+ System.err.printf("Package '%s' has been created.\n", destPath);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/src/main/java/org/dataconservancy/packaging/tool/cli/RdfContentProvider.java b/src/main/java/org/dataconservancy/packaging/tool/cli/RdfContentProvider.java
index 0142027..c4e52c0 100644
--- a/src/main/java/org/dataconservancy/packaging/tool/cli/RdfContentProvider.java
+++ b/src/main/java/org/dataconservancy/packaging/tool/cli/RdfContentProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Johns Hopkins University
+ * Copyright 2017 Johns Hopkins University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,9 +25,11 @@
import org.dataconservancy.packaging.shared.AbstractContentProvider;
import org.dataconservancy.packaging.tool.model.ipm.FileInfo;
import org.dataconservancy.packaging.tool.model.ipm.Node;
-import org.slf4j.Logger;
+
+import ch.qos.logback.classic.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -38,12 +40,16 @@
* Implementation of ContentProvider for RDF sourced data.
* @author Ben Trumbore (wbt3@cornell.edu).
*/
+@SuppressWarnings("unused")
public class RdfContentProvider extends AbstractContentProvider {
- private Logger logger = LoggerFactory.getLogger(RdfContentProvider.class);
+ private Logger logger = (Logger)LoggerFactory.getLogger(RdfContentProvider.class);
private Model domainObjects = null;
private URI contentPath;
+ // Must use an Atomic Reference to allow root node to be set inside lambda function below.
+ private final AtomicReference root = new AtomicReference();
+
/**
* Create a content provider that can be passed to
* {@link org.dataconservancy.packaging.shared.IpmPackager#buildPackage}.
@@ -64,102 +70,189 @@ public Model getDomainModel() {
}
// Define property names that are found on some RDF nodes.
- private static final String HAS_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
- private static final String HAS_TITLE = "http://dataconservancy.org/business-object-model#hasTitle";
- private static final String METADATA_FOR = "http://dataconservancy.org/business-object-model#metadataFor";
- private static final String IS_MEMBER_OF = "http://dataconservancy.org/business-object-model#isMemberOf";
+ private static final String HAS_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
+ private static final String HAS_TITLE = "http://dataconservancy.org/business-object-model#hasTitle";
+ private static final String METADATA_FOR = "http://dataconservancy.org/business-object-model#metadataFor";
+ private static final String IS_METADATA_FOR = "http://dataconservancy.org/business-object-model#isMetadataFor";
+ private static final String IS_MEMBER_OF = "http://dataconservancy.org/business-object-model#isMemberOf";
// Define properties that will be inspected for some RDF nodes.
- private static final Property hasType = ResourceFactory.createProperty(HAS_TYPE);
- private static final Property hasTitle = ResourceFactory.createProperty(HAS_TITLE);
- private static final Property metadataFor = ResourceFactory.createProperty(METADATA_FOR);
- private static final Property isMemberOf = ResourceFactory.createProperty(IS_MEMBER_OF);
+ private static final Property hasType = ResourceFactory.createProperty(HAS_TYPE);
+ private static final Property hasTitle = ResourceFactory.createProperty(HAS_TITLE);
+ private static final Property metadataFor = ResourceFactory.createProperty(METADATA_FOR);
+ private static final Property isMetadataFor = ResourceFactory.createProperty(IS_METADATA_FOR);
+ private static final Property isMemberOf = ResourceFactory.createProperty(IS_MEMBER_OF);
/**
* We manually build the IPM tree here. Fundamentally, we're doing three things:
* 1) Creating "directory" nodes that correspond to a domain object.
- * 2) Creating "content" nodes that correspond to a domain object that
- * describes associated content.
+ * 2) Creating "content" nodes that correspond to a domain object that describes associated content.
* 3) Arranging these nodes into a tree structure of our liking.
* @return The root node of the IPM model for this content provider.
*/
public Node getIpmModel() {
- // Must use an Atomic Reference to allow root node to be set inside lambda function below.
- final AtomicReference root = new AtomicReference();
-
- final String msgFmt = "Creating %s IPM node named '%s' for domain object %s";
-
- // For each subject resource that is not anonymous, create a node.
- // - If the node type is an Image or File, then it will be a content node.
- // - Otherwise, make a directory node.
- // It is assumed that all folders will precede their child nodes/folders.
+ // For each subject resource that is not anonymous, find or create a node.
+ // The root node is remembered when it is created, then returned from this method.
domainObjects.listSubjects().forEachRemaining(subject -> {
if (subject.isAnon()) {
logger.debug("Skipping IPM node creation for anonymous resource '{}'", subject.getId().toString());
return;
}
- final URI u = URI.create(subject.getURI());
+ final List statements = subject.listProperties().toList();
+ final Statement s = subject.getProperty(isMemberOf);
+ final String parent = (s == null) ? "none" : s.getObject().toString();
- // Hash URIs do not get their own node; they will be considered to be a single node.
- // TODO - Is this needed for JenaModel input? (copied from buildModelTree)
- if (u.getFragment() != null) {
- logger.debug("Skipping IPM node creation for hash URI resource '{}'", subject.getURI());
- return;
- }
+ logger.debug(String.format("%25s %s %s %s",
+ subject.getProperty(hasTitle).getObject().toString(), subject.toString(),
+ parent, subject.getProperty(hasType).getObject().toString()));
- // What type of node is this? What is its name?
- final String type = subject.getProperty(hasType ).getObject().toString();
- final String title = subject.getProperty(hasTitle).getObject().toString();
- final boolean isImage = type.equals("http://dataconservancy.org/business-object-model#Metadata");
- final boolean isFile = type.equals("http://dataconservancy.org/business-object-model#File");
- final boolean isFolder = type.equals("http://dataconservancy.org/business-object-model#DataItem");
-
- // Create the new package tree node and insert it into the tree.
- final Node n = new Node(u);
- n.setDomainObject(u);
-
- // Assign node file info and parent depending on node type.
- // Note that file info must be assigned before finding/assigning parent.
- if (isImage || isFile) {
- logger.info(String.format(msgFmt, "file", title, subject.getURI()));
- final Property prop = isImage ? metadataFor : isMemberOf;
- final String parentID = subject.getProperty(prop).getObject().toString();
- assignFileInfo(title, parentID, contentPath, domainObjects, n, true);
- assignParentNode(n, root.get());
- } else if (isFolder) {
- logger.info(String.format(msgFmt, "directory", title, subject.getURI()));
- final String parentID = subject.getProperty(isMemberOf).getObject().toString();
- assignFileInfo(title, parentID, contentPath, domainObjects, n, false);
- assignParentNode(n, root.get());
- } else { // root folder, type == "Collection"
- logger.info(String.format(msgFmt, "root directory", title, subject.getURI()));
- assignFileInfo(title, null, contentPath, domainObjects, n, false);
- root.set(n);
+ // Is this node for a folder?
+ final String rdfType = subject.getProperty(hasType ).getObject().toString();
+ final boolean isFolder = rdfType.equals("http://dataconservancy.org/business-object-model#DataItem") ||
+ rdfType.equals("http://dataconservancy.org/business-object-model#Collection") ||
+ rdfType.equals("DataItem") ||
+ rdfType.equals("Collection");
+
+ // Find or create a node for the RDF subject. Any missing parent nodes are recursively created.
+ if (isFolder) {
+ findOrCreateFolderNode(subject);
+ } else {
+ createFileNode(subject, rdfType);
}
});
return root.get();
}
+
+ /**
+ * Create a file node and, recursively, any missing folder nodes on its path.
+ * @param subject The RDF resource for the file
+ * @param type The type of the RDF resource
+ * @return The newly created file node
+ */
+ private Node createFileNode(final Resource subject, final String type) {
+ // File type determines which property is used to access its parent.
+ final boolean isImage1 = type.equals("http://dataconservancy.org/business-object-model#Metadata");
+ final boolean isImage2 = type.equals("MetadataFile");
+ final boolean isFile = type.equals("http://dataconservancy.org/business-object-model#File") ||
+ type.equals("http://dataconservancy.org/business-object-model#DataFile") ||
+ type.equals("DataFile");
+
+ final Property prop = isImage1 ? metadataFor : isImage2 ? isMetadataFor : isMemberOf;
+ final String parentID = subject.getProperty(prop).getObject().toString();
+ final Resource parent = domainObjects.getResource(parentID);
+
+ // Create a node for the file.
+ final URI uri = URI.create(subject.getURI());
+ final Node node = new Node(uri);
+ node.setDomainObject(uri);
+
+ // Recursively find the node's parent node. If the parent is a "synthesized" DataItem node,
+ // use its parent instead. Add the new node to the true parent node.
+ final Node parentNode = findOrCreateFolderNode(parent);
+ final Node ancestorNode = (parentNode.getFileInfo() == null) ? parentNode.getParent() : parentNode;
+ final String fileName = subject.getProperty(hasTitle).getObject().toString();
+ assignFileInfo(fileName, ancestorNode.getDomainObject().toString(), contentPath, node, true);
+ parentNode.addChild(node);
+
+ logger.debug(String.format("Creating file named '%s' for object %s", fileName, uri.toString()));
+ return node;
+ }
+
+
+ /**
+ * Find an existing node for the supplied RDF folder resource, or create one.
+ * Recursively create any folders on the path to this folder.
+ * @param subject The RDF resource for the folder
+ * @return The node that was found or created for the folder
+ */
+ private Node findOrCreateFolderNode(final Resource subject) {
+ final String msgFmt = "Creating %s named '%s' for object %s";
+ final String title = subject.getProperty(hasTitle).getObject().toString();
+ final String nodeUri = subject.getURI();
+
+ // If this node has no parent, it is the root node
+ final Statement prop = subject.getProperty(isMemberOf);
+ if (prop == null) {
+ // If the root node doesn't exist, create and remember it.
+ if (root.get() == null) {
+ final URI uri = URI.create(subject.getURI());
+ final Node node = new Node(uri);
+ node.setDomainObject(uri);
+ assignFileInfo(title, null, contentPath, node, false);
+ root.set(node);
+ logger.debug(String.format(msgFmt, "root folder", title, nodeUri));
+ }
+ return root.get();
+ } else {
+ // This is not the root node. Recursively find or create its parent node.
+ final String parentID = prop.getObject().toString();
+ final Resource parent = domainObjects.getResource(parentID);
+ final Node parentNode = findOrCreateFolderNode(parent);
+
+ // See if this node already exists as a child of its parent node.
+ Node node = null;
+ final List children = parentNode.getChildren();
+ if (children != null) {
+ for (Node child : children) {
+ if (nodeUri.equals(child.getIdentifier().toString())) {
+ node = child;
+ break;
+ }
+ }
+ }
+
+ if (node == null) {
+ // There is no existing node for this subject, so create one.
+ final URI uri = URI.create(subject.getURI());
+ node = new Node(uri);
+ node.setDomainObject(uri);
+ parentNode.addChild(node);
+
+ // If this is a "synthesized" node for a DataItem, do not assign it a FileInfo.
+ final String localPath = getPath(title, parentID);
+ final Path fullPath = Paths.get(contentPath + "/" + localPath);
+ final File testFile = new File(fullPath.toString());
+ if (testFile.isFile()) {
+ // Without a FileInfo, no bin file will be created in the package.
+ // The node's URI will be used as the base name for the .ttl file.
+ logger.debug(String.format(msgFmt, "synthetic folder", title, nodeUri));
+ } else {
+ assignFileInfo(title, parentID, contentPath, node, false);
+ logger.debug(String.format(msgFmt, "folder", title, nodeUri));
+ }
+ }
+
+ return node;
+ }
+ }
+
+
/**
- * Create a FileInfo that points to file/folder content found in content tree path.
- *
+ * Create a FileInfo that points to file/folder content found in the content tree path.
* @param fileName The name of the file or folder to be included.
* @param parentID ID of the node's parent in the domain model.
* @param contentPath Path to the root of the local package data tree.
- * @param domainObjects The domain model tree.
* @param node The node for which the FileInfo is being created.
* @param isFile True if the node represents a file, False if it is a folder.
*/
private void assignFileInfo(final String fileName, final String parentID, final URI contentPath,
- final Model domainObjects, final Node node, final boolean isFile) {
- final String localPath = (parentID == null)
- ? fileName
- : getPath(fileName, parentID, domainObjects);
+ final Node node, final boolean isFile) {
+ final String localPath = (parentID == null) ? fileName : getPath(fileName, parentID);
final Path fullPath = Paths.get(contentPath + "/" + localPath);
- final FileInfo info = new FileInfo(fullPath);
+ // Empty folders will not be included in the content tree so we must add them instead of reading their info.
+ final FileInfo info;
+ final File file = new File(fullPath.toString());
+ if (file.exists()) {
+ info = new FileInfo(fullPath);
+ } else {
+ info = new FileInfo(fullPath.toUri(), fileName);
+ file.mkdir();
+ }
+
if (isFile) {
info.setIsFile(true);
} else {
@@ -168,69 +261,27 @@ private void assignFileInfo(final String fileName, final String parentID, final
node.setFileInfo(info);
}
+
/**
* Creates a complete path from the tail end of a path up to the domain model root.
- * Prepends the current path's parent name and
- * recurses until the domain model does not contain a higher parent.
+ * Prepends the current path's parent name and recurses until the domain model does not
+ * contain a higher parent.
* @param pathTail When first called, the leaf file/folder of the desired path.
* During recursion, the accumulated path from the leaf upwards.
* @param parentID The ID of the domain model node that is the parent of the pathTail.
- * @param domainObjects The domain model.
* @return The complete path from domain model root to the provided leaf.
*/
- private String getPath(final String pathTail, final String parentID, final Model domainObjects) {
+ private String getPath(final String pathTail, final String parentID) {
final Resource parent = domainObjects.getResource(parentID);
final String parentName = parent.getProperty(hasTitle).getObject().toString();
final String newPath = parentName + "/" + pathTail;
final Statement grandparent = parent.getProperty(isMemberOf);
if (grandparent != null) {
- return getPath(newPath, grandparent.getObject().toString(), domainObjects);
+ return getPath(newPath, grandparent.getObject().toString());
} else {
return newPath;
}
}
- /**
- * Finds and assigns the parent IPM tree node of the given node.
- * @param node The node for which a parent is found and assigned.
- * @param root The root node of the IPM tree.
- */
- private void assignParentNode(final Node node, final Node root) {
- // Find the file system paths to the provided root and target nodes.
- String nodeLoc = node.getFileInfo().getLocation().getPath();
- nodeLoc = nodeLoc.replaceFirst("^/(.:/)", "$1"); // Remove leading "/" on Windows
- final Path nodePath = Paths.get(nodeLoc);
- String rootLoc = root.getFileInfo().getLocation().getPath();
- rootLoc = rootLoc.replaceFirst("^/(.:/)", "$1"); // Remove leading "/" on Windows
- final Path rootPath = Paths.get(rootLoc);
-
- // Find the relative file system path between the root and target nodes.
- Path relPath = rootPath.relativize(nodePath);
-
- // Walk the tree from the root node down through its children
- // until the target node is reached. At each step find the child whose name
- // matches the first name in the remaining relative path.
- Node parent = root;
- while (relPath.getNameCount() > 1) {
- final String name = relPath.getName(0).toString();
- final List children = parent.getChildren();
- Node match = null;
- for (Node child : children) {
- if (child.getFileInfo().getName().equals(name)) {
- match = child;
- break;
- }
- }
- if (match == null) {
- throw new RuntimeException("Expected IPM model folder '" + name + "' does not exist!");
- }
- parent = match;
- relPath = relPath.subpath(1, relPath.getNameCount());
- }
-
- // Assign the target node's discovered parent.
- parent.addChild(node);
- }
-
}
diff --git a/src/main/resources/AutomatedPackageTool/DEPENDENCIES b/src/main/resources/AutomatedPackageTool/DEPENDENCIES
new file mode 100644
index 0000000..e9ac411
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/DEPENDENCIES
@@ -0,0 +1,173 @@
+// ------------------------------------------------------------------
+// Transitive dependencies of this project determined from the
+// maven pom organized by organization.
+// ------------------------------------------------------------------
+
+Package Tool Command Line
+
+
+From: 'an unknown organization'
+ - antlr antlr:antlr:jar:2.7.5
+
+ - AOP alliance (http://aopalliance.sourceforge.net) aopalliance:aopalliance:jar:1.0
+ License: Public Domain
+ - JSONLD Java :: Core (http://github.com/jsonld-java/jsonld-java/jsonld-java/) com.github.jsonld-java:jsonld-java:jar:0.2
+ License: Revised BSD License (https://raw.github.com/jsonld-java/jsonld-java/master/LICENCE)
+ - JSONLD Java :: Jena Integration (http://github.com/jsonld-java/jsonld-java/jsonld-java-integration/jsonld-java-jena/) com.github.jsonld-java:jsonld-java-jena:jar:0.2
+ License: Revised BSD License (https://raw.github.com/jsonld-java/jsonld-java/master/LICENCE)
+ - FORESITE :: Object Reuse and Exchange library (http://www.openarchives.org/ore) com.googlecode.foresite-toolkit:foresite:jar:0.9
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - concurrent-jena com.hp.hpl.jena:concurrent-jena:jar:1.3.2
+
+ - json-jena com.hp.hpl.jena:json-jena:jar:1.0
+
+ - ICU4J (http://www-306.ibm.com/software/globalization/icu/) com.ibm.icu:icu4j:jar:3.4.4
+ License: ICU License (http://www-306.ibm.com/software/globalization/icu/license.jsp)
+ - jdom jdom:jdom:jar:1.0
+
+ - Lucene Core (http://lucene.apache.org/java/lucene-core) org.apache.lucene:lucene-core:jar:2.2.0
+ License: Apache 2 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - spring-aop org.springframework:spring-aop:jar:3.0.7.RELEASE
+
+ - spring-asm org.springframework:spring-asm:jar:3.0.7.RELEASE
+
+ - spring-beans org.springframework:spring-beans:jar:3.0.7.RELEASE
+
+ - spring-context org.springframework:spring-context:jar:3.0.7.RELEASE
+
+ - spring-core org.springframework:spring-core:jar:3.0.7.RELEASE
+
+ - spring-expression org.springframework:spring-expression:jar:3.0.7.RELEASE
+
+ - stax-api stax:stax-api:jar:1.0
+
+ - Woodstox (http://woodstox.codehaus.org) woodstox:wstx-asl:jar:3.0.0
+
+ - xalan xalan:xalan:jar:2.7.0
+
+ - Xerces2-j (https://xerces.apache.org/xerces2-j/) xerces:xercesImpl:jar:2.11.0
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - xmlParserAPIs xerces:xmlParserAPIs:jar:2.0.2
+
+ - XML Commons External Components XML APIs (http://xml.apache.org/commons/components/external/) xml-apis:xml-apis:jar:1.4.01
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) License: The SAX License (http://www.saxproject.org/copying.html) License: The W3C License (http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.zip)
+ - XMLUnit for Java (http://xmlunit.sourceforge.net/) xmlunit:xmlunit:jar:1.3
+ License: BSD License (http://xmlunit.svn.sourceforge.net/viewvc/*checkout*/xmlunit/trunk/xmlunit/LICENSE.txt)
+
+From: 'Data Conservancy' (http://dataconservancy.org)
+ - DCS MHF :: Metadata Representation API (http://maven.dataconservancy.org/sites/mhf/dcs-mhf-representation-api/) org.dataconservancy.mhf:dcs-mhf-representation-api:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - DCS Model :: DCP Object Model (http://maven.dataconservancy.org/sites/model/dcs-model) org.dataconservancy.model:dcs-model:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - DCS Model :: DCP Model Builder (http://maven.dataconservancy.org/sites/model/dcs-model-builder) org.dataconservancy.model:dcs-model-builder:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - DCS Model :: DCP XStream Model Builder (http://maven.dataconservancy.org/sites/model/dcs-model-builder-xstream) org.dataconservancy.model:dcs-model-builder-xstream:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - DCS Model :: Package Model (http://maven.dataconservancy.org/sites/model/dcs-pkg-model) org.dataconservancy.model:dcs-pkg-model:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - DCS Model :: Package Model Implementation (http://maven.dataconservancy.org/sites/model/dcs-pkg-model-impl) org.dataconservancy.model:dcs-pkg-model-impl:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Shared Packaging Code org.dataconservancy.packaging:dcs-package-shared:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Validation Logic org.dataconservancy.packaging:dcs-package-validation:jar:1.1.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Tool API org.dataconservancy.packaging:dcs-packaging-tool-api:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Tool API Implementation org.dataconservancy.packaging:dcs-packaging-tool-impl:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Tool Model org.dataconservancy.packaging:dcs-packaging-tool-model:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Tool Model Builder org.dataconservancy.packaging:dcs-packaging-tool-model-builder:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - JSON Implementation of Package Model Builder org.dataconservancy.packaging:dcs-packaging-tool-model-builder-json:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Tool Model Builder using Properties Configuration org.dataconservancy.packaging:dcs-packaging-tool-model-builder-properties:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+ - Package Tool Model Builder using Xstream org.dataconservancy.packaging:dcs-packaging-tool-model-builder-xstream:jar:0.9.0-beta
+ License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
+
+From: 'Extreme! Lab, Indiana University' (http://www.extreme.indiana.edu/)
+ - MXP1: Xml Pull Parser 3rd Edition (XPP3) (http://www.extreme.indiana.edu/xgws/xsoap/xpp/mxp1/) xpp3:xpp3_min:jar:1.1.4c
+ License: Indiana University Extreme! Lab Software License, vesion 1.1.1 (http://www.extreme.indiana.edu/viewcvs/~checkout~/XPP3/java/LICENSE.txt) License: Public Domain (http://creativecommons.org/licenses/publicdomain)
+
+From: 'FasterXML' (http://fasterxml.com/)
+ - Jackson-annotations (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-annotations:jar:2.2.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) License: GNU Lesser General Public License, Version 2.1 (http://www.gnu.org/licenses/lgpl-2.1.html)
+ - Jackson-core (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-core:jar:2.2.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) License: GNU Lesser General Public License, Version 2.1 (http://www.gnu.org/licenses/lgpl-2.1.html)
+ - jackson-databind (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-databind:jar:2.2.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) License: GNU Lesser General Public License, Version 2.1 (http://www.gnu.org/licenses/lgpl-2.1.html)
+
+From: 'HP Labs' (http://www.hpl.hp.com/semweb/)
+ - ARQ (http://jena.sourceforge.net/ARQ/) com.hp.hpl.jena:arq:jar:2.2
+ License: BSD (http://jena.sourceforge.net/ARQ/license.html)
+ - ARQ Extra (http://jena.sourceforge.net/ARQ/) com.hp.hpl.jena:arq-extra:jar:2.2
+ License: BSD (http://jena.sourceforge.net/ARQ/license.html)
+ - IRI (http://jena.sourceforge.net/) com.hp.hpl.jena:iri:jar:0.5
+ License: BSD (http://jena.sourceforge.net/license.html)
+ - Jena (http://jena.sourceforge.net/) com.hp.hpl.jena:jena:jar:2.5.5
+ License: BSD (http://jena.sourceforge.net/license.html)
+ - Jena Tests (http://jena.sourceforge.net/) com.hp.hpl.jena:jenatest:jar:2.5.5
+ License: BSD (http://jena.sourceforge.net/license.html)
+
+From: 'Joda.org' (http://www.joda.org)
+ - Joda time (http://joda-time.sourceforge.net) joda-time:joda-time:jar:2.0
+ License: Apache 2 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+
+From: 'Kohsuke Kawaguchi' (http://www.kohsuke.org/)
+ - args4j (http://args4j.kohsuke.org/args4j/) args4j:args4j:bundle:2.0.26
+ License: MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+From: 'QOS.ch' (http://www.qos.ch)
+ - Logback Classic Module (http://logback.qos.ch) ch.qos.logback:logback-classic:jar:1.0.1
+ License: Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html) License: GNU Lesser General Public License (http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)
+ - Logback Core Module (http://logback.qos.ch) ch.qos.logback:logback-core:jar:1.0.1
+ License: Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html) License: GNU Lesser General Public License (http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)
+ - JCL 1.1.1 implemented over SLF4J (http://www.slf4j.org) org.slf4j:jcl-over-slf4j:jar:1.6.1
+ License: MIT License (http://www.opensource.org/licenses/mit-license.php)
+ - SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.6.1
+ License: MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+From: 'Sun Microsystems' (http://java.sun.com/)
+ - ROME, RSS and atOM utilitiEs for Java (https://rome.dev.java.net/) rome:rome:jar:0.9
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+
+From: 'The Apache Software Foundation' (http://www.apache.org/)
+ - Commons CLI (http://commons.apache.org/cli/) commons-cli:commons-cli:jar:1.2
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Commons Codec (http://commons.apache.org/codec/) commons-codec:commons-codec:jar:1.4
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Commons Configuration (http://commons.apache.org/configuration/) commons-configuration:commons-configuration:jar:1.8
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Commons IO (http://jakarta.apache.org/commons/io/) commons-io:commons-io:jar:1.3.2
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Commons Lang (http://commons.apache.org/lang/) commons-lang:commons-lang:jar:2.6
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Commons Logging (http://commons.apache.org/logging) commons-logging:commons-logging:jar:1.1.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Commons Compress (http://commons.apache.org/compress/) org.apache.commons:commons-compress:jar:1.3
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Apache HttpClient (http://hc.apache.org/httpcomponents-client) org.apache.httpcomponents:httpclient:jar:4.3.2
+ License: Apache License, Version 2.0 (LICENSE.txt)
+ - HttpClient Cache (http://hc.apache.org/httpcomponents-client) org.apache.httpcomponents:httpclient-cache:jar:4.2.5
+ License: Apache License (LICENSE.txt)
+ - Apache HttpCore (http://hc.apache.org/httpcomponents-core-ga) org.apache.httpcomponents:httpcore:jar:4.3.1
+ License: Apache License, Version 2.0 (LICENSE.txt)
+ - Apache Jena - Libraries POM (http://jena.apache.org/apache-jena-libs/) org.apache.jena:apache-jena-libs:pom:2.11.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Apache Jena - ARQ (SPARQL 1.1 Query Engine) (http://jena.apache.org/jena-arq/) org.apache.jena:jena-arq:jar:2.11.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Apache Jena - Core (http://jena.apache.org/jena-core/) org.apache.jena:jena-core:jar:2.11.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Apache Jena - IRI (http://jena.apache.org/jena-iri/) org.apache.jena:jena-iri:jar:1.0.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+ - Apache Jena - TDB (Native Triple Store) (http://jena.apache.org/jena-tdb/) org.apache.jena:jena-tdb:jar:1.0.1
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+
+From: 'XStream' (http://xstream.codehaus.org)
+ - XStream Core com.thoughtworks.xstream:xstream:jar:1.3.1
+ License: BSD style (http://xstream.codehaus.com/license.html)
+
+
+
+
diff --git a/src/main/resources/AutomatedPackageTool/LICENSE b/src/main/resources/AutomatedPackageTool/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/src/main/resources/AutomatedPackageTool/NOTICE b/src/main/resources/AutomatedPackageTool/NOTICE
new file mode 100644
index 0000000..5babc0c
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/NOTICE
@@ -0,0 +1,8 @@
+
+Package Tool Command Line
+Copyright 2010-2014 Data Conservancy
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
diff --git a/src/main/resources/AutomatedPackageTool/README.txt b/src/main/resources/AutomatedPackageTool/README.txt
new file mode 100644
index 0000000..8b78bb3
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/README.txt
@@ -0,0 +1,46 @@
+ usage: AutomatedPackageTool [options]
+
+ : content root directory
+ : package metadata file location
+ --overwrite (--force) : If specified, will overwrite if the
+ destination package file already
+ exists without prompting. (default:
+ true)
+ --stage (--staging, : The directory to which the package
+ --staging-location, will be staged before building. Will
+ --package-staging-location) override value in Package Generation
+ Parameters file. (default:
+ c:/temp/staging)
+ -a (--archiving-format) tar|zip : Archive format to use when creating
+ the package. Defaults to tar
+ -c (--compression-format) gz|none : Compression format, if archive type
+ is tar. If not specified, no
+ compression is used. Ignored if
+ non-tar archive is used.
+ -d (-debug, --debug) : print debug information (default:
+ false)
+ -eid (--external-project-id) VAL : External project ID to associate with
+ the package
+ -f (--format) [BOREM | TEST] : packaging format to use (default:
+ BOREM)
+ -g (--generation-params) : package generation params file
+ location
+ -h (-help, --help) : print help message (default: true)
+ -i (-info, --info) : print parameter info (default: false)
+ -n (--name, --package-name) : The package name, which also
+ determines the output filename. Will
+ override value in Package Generation
+ Parameters file. (default: FooBar)
+ -o (--location, --output-location) : The output directory to which the
+ package file will be written. Will
+ override value in Package Generation
+ Parameters file. (default: C:\temp)
+ -r (--rules, --rules-file) : The location of the rules file
+ -s (--checksum) md5|sha1 : Checksum algorithms to use. If none
+ specified, will use md5. Can be
+ specified multiple times
+ -v (-version, --version) : print version information (default:
+ false)
+ -z (--serialization, : Serialization format for the ORE-ReM
+ --serialization-format) file
+ JSONLD|TURTLE|XML
\ No newline at end of file
diff --git a/src/main/resources/AutomatedPackageTool/bin/pkg-gen.bat b/src/main/resources/AutomatedPackageTool/bin/pkg-gen.bat
new file mode 100644
index 0000000..18b4d24
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/bin/pkg-gen.bat
@@ -0,0 +1,38 @@
+:: Copyright 2017 Johns Hopkins University
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+
+@ECHO OFF
+
+SET JAVA_BIN=java
+SET EXECUTABLE_JAR=dcs-packaging-tool-cli-1.0.0-SNAPSHOT.jar
+SET COMMAND_LINE=%JAVA_BIN% -jar %EXECUTABLE_JAR% %*
+
+java -version 2>nul 1>nul
+
+IF %ERRORLEVEL%==0 (goto java-found) ELSE (goto java-not-found)
+
+:java-found
+%COMMAND_LINE%
+goto exit
+
+:java-not-found
+@ECHO ON
+echo Did not find %JAVA_BIN% on the command path.
+echo Please insure that Java is installed
+echo and that it is on your command path.
+goto exit
+
+
+:exit
+echo Exiting.
diff --git a/src/main/resources/AutomatedPackageTool/bin/pkg-gen.sh b/src/main/resources/AutomatedPackageTool/bin/pkg-gen.sh
new file mode 100644
index 0000000..57fac0b
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/bin/pkg-gen.sh
@@ -0,0 +1,33 @@
+# Copyright 2015 Johns Hopkins University
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#!/bin/bash
+
+JAVA_BIN=java
+JAVA_OPTS=""
+
+EXECUTABLE_JAR=dcs-packaging-tool-cli-1.0.0-SNAPSHOT.jar
+
+JAVA_CMD="$JAVA_BIN $JAVA_OPTS"
+COMMAND_LINE="$JAVA_CMD -jar $EXECUTABLE_JAR $@"
+
+which $JAVA_BIN 2>&1 > /dev/null
+
+if [ $? != 0 ] ; then
+ echo "Did not find $JAVA_BIN on the command path."
+ echo "Please be sure that the path to your Java executable is set on your command path."
+ exit 1
+fi
+
+$COMMAND_LINE
diff --git a/src/main/resources/AutomatedPackageTool/samples/apt-rules.xml b/src/main/resources/AutomatedPackageTool/samples/apt-rules.xml
new file mode 100644
index 0000000..0d13346
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/samples/apt-rules.xml
@@ -0,0 +1,352 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Collection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Collection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MetadataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/AutomatedPackageTool/samples/metadata.properties b/src/main/resources/AutomatedPackageTool/samples/metadata.properties
new file mode 100644
index 0000000..cfa1b1b
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/samples/metadata.properties
@@ -0,0 +1,6 @@
+Domain-Profile = http://dataconservancy.org/ptg-profiles/dcs-bo-1.0
+Package-Name = PackageName
+Contact-Name = User Name
+Contact-Email = user@organization
+Bag-Count = 1 of 1
+Bagging-Date = 2017-01-01
\ No newline at end of file
diff --git a/src/main/resources/AutomatedPackageTool/samples/packageGenerationParameters b/src/main/resources/AutomatedPackageTool/samples/packageGenerationParameters
new file mode 100644
index 0000000..36ee91f
--- /dev/null
+++ b/src/main/resources/AutomatedPackageTool/samples/packageGenerationParameters
@@ -0,0 +1,48 @@
+# Copyright 2017 Johns Hopkins University
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#***************************************************
+# The following fields are REQUIRED to be supplied
+#***************************************************
+
+Package-Format-Id = BOREM
+
+BagIt-Profile-Identifier = http://dataconservancy.org/formats/data-conservancy-pkg-1.0
+
+#***************************************************
+# The following fields SHOULD be supplied
+#***************************************************
+
+#Options for Checksum algorimth are: md5, sha1
+Checksum-Algs = md5
+
+#Options for Archiving-format are: tar, zip, none
+Archiving-Format = tar
+
+#Options for Compression-format are: gz, none
+Compression-Format = gz
+
+#Options for ReM-Serialization-Format are: json, turtle, xml
+ReM-Serialization-Format = TURTLE
+
+#***************************************************
+# The following fields MAY be supplied
+#***************************************************
+
+# Package-Location = /
+# Package-Staging-Location = /
+# Package-Name = MyPackage
+# External-Project-Id = Id
+# Domain-Profile = profile
\ No newline at end of file
diff --git a/src/main/resources/org/dataconservancy/apt/config/apt-rules.xml b/src/main/resources/org/dataconservancy/apt/config/apt-rules.xml
new file mode 100644
index 0000000..cb68311
--- /dev/null
+++ b/src/main/resources/org/dataconservancy/apt/config/apt-rules.xml
@@ -0,0 +1,367 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Collection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Collection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MetadataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/org/dataconservancy/apt/config/packageGenerationParameters b/src/main/resources/org/dataconservancy/apt/config/packageGenerationParameters
new file mode 100644
index 0000000..d2f940d
--- /dev/null
+++ b/src/main/resources/org/dataconservancy/apt/config/packageGenerationParameters
@@ -0,0 +1,32 @@
+# Copyright 2015 Johns Hopkins University
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#***************************************************
+# The following fields are REQUIRED to be supplied
+#***************************************************
+Package-Format-Id = BOREM
+BagIt-Profile-Identifier = http://dataconservancy.org/formats/data-conservancy-pkg-1.0
+
+#***************************************************
+# The following fields SHOULD be supplied
+#***************************************************
+#Options for Checksum algorimth are: md5, sha1
+Checksum-Algs = md5
+#Options for Archiving-format are: tar, zip, none
+Archiving-Format = tar
+#Options for Compression-format are: gz, none
+Compression-Format = gz
+#Options for ReM-Serialization-Format are: json, turtle, xml
+ReM-Serialization-Format = TURTLE
diff --git a/src/test/java/org/dataconservancy/packaging/tool/cli/RdfContentProviderTest.java b/src/test/java/org/dataconservancy/packaging/tool/cli/RdfContentProviderTest.java
index 1840b82..01334c8 100644
--- a/src/test/java/org/dataconservancy/packaging/tool/cli/RdfContentProviderTest.java
+++ b/src/test/java/org/dataconservancy/packaging/tool/cli/RdfContentProviderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Johns Hopkins University
+ * Copyright 2017 Johns Hopkins University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +20,21 @@
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
-import org.junit.Test;
import org.dataconservancy.packaging.shared.IpmPackager;
+import org.dataconservancy.packaging.tool.api.RulesEngine;
+import org.dataconservancy.packaging.tool.impl.RulesEngineImpl;
+import org.dataconservancy.packaging.tool.model.builder.xstream.JaxbPackageDescriptionRulesBuilder;
+import org.dataconservancy.packaging.tool.model.PackageDescriptionRulesBuilder;
+import org.dataconservancy.packaging.tool.model.rules.RulesSpec;
+import java.io.File;
import java.io.InputStream;
import java.net.URI;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
/**
@@ -41,16 +47,16 @@ public class RdfContentProviderTest {
// to pass to an IpmPackager to create a package.
// Compare the package contents to that of the original source.
@Test
- public void testCreateRdfPackage() throws Exception {
+ public void testCreateRdfPackageFromJenaFile() throws Exception {
final String dataResource = "/testCreateRdfPackage/";
final String jenaResource = dataResource + "state/DOMAIN_OBJECTS";
- final String bagResource = dataResource + "Hanh-test/data/bin";
+ final String bagResource = dataResource + "TestPackageForCLI/data/bin";
// Read Jena model from sample DOMAIN_OBJECTS file.
final String jenaFile = RdfContentProviderTest.class.getResource(jenaResource).getPath();
final Model jenaModel = ModelFactory.createDefaultModel();
RDFDataMgr.read(jenaModel, jenaFile, Lang.TTL);
- assertEquals(148, jenaModel.size());
+ assertEquals(63, jenaModel.size());
// Metadata
final InputStream metadataStream =
@@ -60,6 +66,7 @@ public void testCreateRdfPackage() throws Exception {
final InputStream paramStream =
RdfContentProviderTest.class.getResourceAsStream("/PackageGenerationParams.properties");
+ // Create content provider using local data path
String contentPath = RdfContentProviderTest.class.getResource(bagResource).getPath();
contentPath = contentPath.replaceFirst("^/(.:/)", "$1"); // Remove leading "/" on Windows
final URI contentURI = new URI(contentPath);
@@ -75,4 +82,52 @@ public void testCreateRdfPackage() throws Exception {
assertNotNull(pkg);
}
+
+ // Create a Jena model, package metadata and generation parameters
+ // to pass to an IpmPackager to create a package.
+ // Compare the package contents to that of the original source.
+ @Test
+ public void testCreateRdfPackageFromRules() throws Exception {
+ final String rootFolder = "/testCreateRdfPackage/narwhal";
+ final String dataResource = rootFolder + "/eloka-arctic.org";
+
+ // Rules engine creates Jena model from rules and local data
+ final InputStream rulesStream =
+ RdfContentProviderTest.class.getClassLoader()
+ .getResourceAsStream("default-engine-rules.xml");
+
+ final PackageDescriptionRulesBuilder builder = new JaxbPackageDescriptionRulesBuilder();
+ final RulesSpec rulesSpec = builder.buildPackageDescriptionRules(rulesStream);
+ final RulesEngine engine = new RulesEngineImpl(rulesSpec);
+
+ String dataPath = RdfContentProviderTest.class.getResource(dataResource).getPath();
+ dataPath = dataPath.replaceFirst("^/(.:/)", "$1"); // Remove leading "/" on Windows
+ final File dataFolder = new File(dataPath);
+ final Model jenaModel = engine.generateRdf(dataFolder);
+ assertEquals(610, jenaModel.size());
+
+ // Metadata
+ final InputStream metadataStream =
+ RdfContentProviderTest.class.getResourceAsStream("/metadata.properties");
+
+ // Read package generation parameters from a resource file.
+ final InputStream paramStream =
+ RdfContentProviderTest.class.getResourceAsStream("/PackageGenerationParams.properties");
+
+ // Create content provider using local data path
+ String rootPath = RdfContentProviderTest.class.getResource(rootFolder).getPath();
+ rootPath = rootPath.replaceFirst("^/(.:/)", "$1"); // Remove leading "/" on Windows
+ final URI contentURI = new URI(rootPath);
+
+ final RdfContentProvider contentProvider = new RdfContentProvider(jenaModel, contentURI);
+
+ // Create the package
+ final IpmPackager packager = new IpmPackager();
+ final org.dataconservancy.packaging.tool.api.Package pkg =
+ packager.buildPackage(contentProvider, metadataStream, paramStream);
+
+ // TODO - Test the package contents
+ assertNotNull(pkg);
+ }
+
}
diff --git a/src/test/resources/default-engine-rules.xml b/src/test/resources/default-engine-rules.xml
new file mode 100644
index 0000000..cb68311
--- /dev/null
+++ b/src/test/resources/default-engine-rules.xml
@@ -0,0 +1,367 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Collection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Collection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MetadataFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/PKG-INFO/ORE-REM/ORE-REM.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/PKG-INFO/ORE-REM/ORE-REM.ttl
deleted file mode 100644
index c8ba077..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/PKG-INFO/ORE-REM/ORE-REM.ttl
+++ /dev/null
@@ -1,7 +0,0 @@
-@prefix ore: .
-
-<> a ore:ResourceMap ;
- ore:describes <#Aggregation> .
-
-<#Aggregation> a ore:Aggregation ;
- ore:aggregates , , , , , , , , , , , , , , , .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/STATE/pkgState.bin b/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/STATE/pkgState.bin
deleted file mode 100644
index 30a519a..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/STATE/pkgState.bin and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/bag-info.txt b/src/test/resources/testCreateRdfPackage/Hanh-test/bag-info.txt
deleted file mode 100644
index a2321d7..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/bag-info.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Bag-Count: 1 of 1
-Bag-Size: 163 MB
-BagIt-Profile-Identifier: http://dataconservancy.org/formats/data-conservancy-pkg-1.0
-Bagging-Date: 2016-01-04
-Contact-Email: hanh@jhu.edu
-Contact-Name: Hanh vu
-Domain-Profile: http://dataconservancy.org/ptg-profiles/dcs-bo-1.0
-Package-Name: Hanh-test
-Payload-Oxum: 170692702.30
-Resource-Manifest: bag://Hanh-test/META-INF/org.dataconservancy.packaging/PKG-INFO/ORE-REM/ORE-REM.ttl
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0858.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0858.jpg
deleted file mode 100644
index 7cabca2..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0858.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0899.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0899.jpg
deleted file mode 100644
index e4fbda7..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0899.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0960.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0960.jpg
deleted file mode 100644
index 0d22afb..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_0960.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_1159.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_1159.jpg
deleted file mode 100644
index feb7304..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_1159.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9184.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9184.jpg
deleted file mode 100644
index 4ebd2d1..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9184.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9189.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9189.jpg
deleted file mode 100644
index e7f2bb4..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9189.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9202.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9202.jpg
deleted file mode 100644
index 4ea06de..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9202.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9248.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9248.jpg
deleted file mode 100644
index 2fce557..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9248.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9302.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9302.jpg
deleted file mode 100644
index 92c7aa3..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9302.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9313.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9313.jpg
deleted file mode 100644
index 3ac3d8f..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9313.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9321.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9321.jpg
deleted file mode 100644
index 8877bcc..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9321.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9342.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9342.jpg
deleted file mode 100644
index 4472540..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9342.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9380.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9380.jpg
deleted file mode 100644
index 16bf600..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9380.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9455.jpg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9455.jpg
deleted file mode 100644
index 2fce557..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/IMG_9455.jpg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/installers/DC Package Tool-1.0.2.dmg b/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/installers/DC Package Tool-1.0.2.dmg
deleted file mode 100644
index 29b69c9..0000000
Binary files a/src/test/resources/testCreateRdfPackage/Hanh-test/data/bin/To Print/installers/DC Package Tool-1.0.2.dmg and /dev/null differ
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print.ttl
deleted file mode 100644
index 5897e42..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-<> a bom:Collection ;
- bom:hasContact [ a ] ;
- bom:hasCreateDate "2014-09-10T04:00:00Z"^^ ;
- bom:hasCreator [ a ] ;
- bom:hasMember ;
- bom:hasMetadata , , , , , , , , , , , , ;
- bom:hasModifiedDate "2015-12-30T04:15:28Z"^^ ;
- bom:hasTitle "To Print" .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0858.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0858.jpg.ttl
deleted file mode 100644
index 4298b6c..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0858.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2014-09-10T17:41:45Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2014-09-10T17:41:46Z"^^ ;
- bom:hasSize "6437931"^^ ;
- bom:hasTitle "IMG_0858.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0899.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0899.jpg.ttl
deleted file mode 100644
index 18f1459..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0899.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2014-09-10T17:39:37Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2014-09-10T17:39:38Z"^^ ;
- bom:hasSize "5718363"^^ ;
- bom:hasTitle "IMG_0899.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0960.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0960.jpg.ttl
deleted file mode 100644
index c0fb413..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_0960.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2014-09-10T17:42:47Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2014-09-10T17:42:47Z"^^ ;
- bom:hasSize "8255112"^^ ;
- bom:hasTitle "IMG_0960.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_1159.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_1159.jpg.ttl
deleted file mode 100644
index 03a738a..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_1159.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2014-09-10T17:43:51Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2014-09-10T17:43:51Z"^^ ;
- bom:hasSize "4029906"^^ ;
- bom:hasTitle "IMG_1159.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9184.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9184.jpg.ttl
deleted file mode 100644
index 53ee7b0..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9184.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:20:35Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:20:35Z"^^ ;
- bom:hasSize "6565477"^^ ;
- bom:hasTitle "IMG_9184.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9189.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9189.jpg.ttl
deleted file mode 100644
index a676880..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9189.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:21:29Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:21:30Z"^^ ;
- bom:hasSize "4991733"^^ ;
- bom:hasTitle "IMG_9189.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9202.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9202.jpg.ttl
deleted file mode 100644
index 266a465..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9202.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:20:03Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:20:03Z"^^ ;
- bom:hasSize "5758095"^^ ;
- bom:hasTitle "IMG_9202.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9248.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9248.jpg.ttl
deleted file mode 100644
index db9e94b..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9248.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:15:38Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:15:39Z"^^ ;
- bom:hasSize "7294566"^^ ;
- bom:hasTitle "IMG_9455.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9302.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9302.jpg.ttl
deleted file mode 100644
index f68b8a8..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9302.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:18:28Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:18:28Z"^^ ;
- bom:hasSize "6022116"^^ ;
- bom:hasTitle "IMG_9302.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9313.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9313.jpg.ttl
deleted file mode 100644
index b7dbcef..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9313.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:18:01Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:18:01Z"^^ ;
- bom:hasSize "6247196"^^ ;
- bom:hasTitle "IMG_9313.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9321.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9321.jpg.ttl
deleted file mode 100644
index 2c17503..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9321.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:17:49Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:17:49Z"^^ ;
- bom:hasSize "4358654"^^ ;
- bom:hasTitle "IMG_9321.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9342.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9342.jpg.ttl
deleted file mode 100644
index 635ccee..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9342.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:17:16Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:17:16Z"^^ ;
- bom:hasSize "2839211"^^ ;
- bom:hasTitle "IMG_9342.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9380.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9380.jpg.ttl
deleted file mode 100644
index 4d33511..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9380.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:02:43Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:02:43Z"^^ ;
- bom:hasSize "4813513"^^ ;
- bom:hasTitle "IMG_9380.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9455.jpg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9455.jpg.ttl
deleted file mode 100644
index db9e94b..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/IMG_9455.jpg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:Metadata ;
- bom:hasCreateDate "2015-12-23T02:15:38Z"^^ ;
- bom:hasFormat "info:pronom/fmt/43" , "image/jpeg" ;
- bom:hasModifiedDate "2015-12-23T02:15:39Z"^^ ;
- bom:hasSize "7294566"^^ ;
- bom:hasTitle "IMG_9455.jpg" ;
- bom:metadataFor .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/installers.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/installers.ttl
deleted file mode 100644
index 0145b2e..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/installers.ttl
+++ /dev/null
@@ -1,8 +0,0 @@
-@prefix bom: .
-
-<> a bom:DataItem ;
- bom:hasCreateDate "2015-12-22T20:37:13Z"^^ ;
- bom:hasMember ;
- bom:hasModifiedDate "2015-12-22T20:37:25Z"^^ ;
- bom:hasTitle "installers" ;
- bom:isMemberOf .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/installers/DC Package Tool-1.0.2.dmg.ttl b/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/installers/DC Package Tool-1.0.2.dmg.ttl
deleted file mode 100644
index bb33ca0..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/data/obj/To Print/installers/DC Package Tool-1.0.2.dmg.ttl
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix bom: .
-
-
- a bom:File ;
- bom:hasCreateDate "2015-12-22T20:28:31Z"^^ ;
- bom:hasFormat "application/octet-stream" ;
- bom:hasModifiedDate "2015-12-22T20:28:37Z"^^ ;
- bom:hasSize "97350112"^^ ;
- bom:hasTitle "DC Package Tool-1.0.2.dmg" ;
- bom:isMemberOf .
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/manifest-md5.txt b/src/test/resources/testCreateRdfPackage/Hanh-test/manifest-md5.txt
deleted file mode 100644
index f80e240..0000000
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/manifest-md5.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-b6e1b57993d42adc152583eb754bf306 data/obj/To Print/IMG_0858.jpg.ttl
-22f519a5f364f4e140683c68d0308471 data/bin/To Print/IMG_9313.jpg
-0d1d19e02c3eeb98bb156776928515d2 data/bin/To Print/IMG_0858.jpg
-41d6c795547769a18cf34eaf5383e006 data/bin/To Print/IMG_9321.jpg
-bba18e142aa70656c22fbd629c917fa8 data/bin/To Print/IMG_1159.jpg
-0fdc4265d55834a60ca89b7d8c309295 data/obj/To Print/IMG_9313.jpg.ttl
-38e9b597759246b1a7f854cb9ebf408c data/bin/To Print/IMG_9202.jpg
-a10b9f296fc81625670149e6bc81dc75 data/bin/To Print/IMG_9342.jpg
-64aafec1e91a95920f1ef79b7815cdc8 data/obj/To Print/IMG_0960.jpg.ttl
-16e177a02698445a755b55001863a6b6 data/bin/To Print/IMG_9380.jpg
-587b30ebffba5fc3aafba5fc07c692cb data/bin/To Print/IMG_0960.jpg
-666d22817e8e2dab94fc6480397eee67 data/obj/To Print/IMG_0899.jpg.ttl
-075e29d9cc9e761da8c59c541966e434 data/bin/To Print/installers/DC Package Tool-1.0.2.dmg
-c9f84016369cb995d2a943af46272c24 data/obj/To Print/IMG_9380.jpg.ttl
-d45717407954496e4cee39f2e21f68e8 data/obj/To Print/IMG_9302.jpg.ttl
-76a06c6212089b6aac85e16a9f208565 data/obj/To Print/IMG_9455.jpg.ttl
-475355780b2415396bcfff5dec636a36 data/bin/To Print/IMG_0899.jpg
-8769ac673a739e5ba3b1c576e7799420 data/obj/To Print/IMG_9184.jpg.ttl
-810dc1c82add9c1d2feaa78bf6cdf386 data/bin/To Print/IMG_9302.jpg
-8f2fd86ac4a7510a19164cf7a0c2473e data/bin/To Print/IMG_9189.jpg
-89a71f8cde20994d94cc51f8d842b473 data/obj/To Print/IMG_9321.jpg.ttl
-2258e99295b8d5596e82a7d21e10a39c data/bin/To Print/IMG_9455.jpg
-6d953c203721bad0b97bf0759a52b67e data/obj/To Print.ttl
-40a443d234911ceee9201b8a510a6391 data/obj/To Print/installers.ttl
-3c9f230a8311006acadf99a8b10d23df data/bin/To Print/IMG_9184.jpg
-c2272f1b17bc7b6218761798e862599b data/obj/To Print/IMG_9202.jpg.ttl
-89f6c527ab2f344de3fb310308468c31 data/obj/To Print/IMG_9342.jpg.ttl
-1cf67a87f2563298cb0ccfe9216e73af data/obj/To Print/IMG_9189.jpg.ttl
-397f5c393cf8971ce867e981d7fd81e4 data/obj/To Print/IMG_1159.jpg.ttl
-32defb870951a6e9887d321af60fdee1 data/obj/To Print/installers/DC Package Tool-1.0.2.dmg.ttl
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcam.ttl b/src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcam.ttl
similarity index 100%
rename from src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcam.ttl
rename to src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcam.ttl
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcelements.ttl b/src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcelements.ttl
similarity index 100%
rename from src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcelements.ttl
rename to src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcelements.ttl
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcmitype.ttl b/src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcmitype.ttl
similarity index 100%
rename from src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcmitype.ttl
rename to src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcmitype.ttl
diff --git a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcs-bo.ttl b/src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcs-bo.ttl
similarity index 64%
rename from src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcs-bo.ttl
rename to src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcs-bo.ttl
index 34f7626..ca22dc7 100644
--- a/src/test/resources/testCreateRdfPackage/Hanh-test/META-INF/org.dataconservancy.packaging/ONT/dcs-bo.ttl
+++ b/src/test/resources/testCreateRdfPackage/TestPackageForCLI/META-INF/org.dataconservancy.packaging/ONT/dcs-bo.ttl
@@ -1,347 +1,328 @@
+@prefix bom: .
@prefix dcterms: .
+@prefix foaf: .
-_:b0 a ;
-
- "1"^^ ;
-
- .
-
-_:b1 a ;
-
- "0"^^ ;
-
- .
-
-
- a ;
+bom:hasPublisher a ;
"A data property specifying a publisher for a Project."@en ;
- ;
+ bom:Project ;
"has publisher"@en ;
.
-_:b2 a ;
-
- "1"^^ ;
-
- .
-
-_:b3 a ;
-
- "1"^^ ;
-
- .
-
-
- a ;
+bom:MetadataFile a ;
[ a ;
"0"^^ ;
-
+ bom:isMemberOf
] .
-_:b4 a ;
-
- "0"^^ ;
-
- .
-
-_:b5 a ;
-
- "1"^^ ;
-
- .
-
-
- a , ;
+bom:hasBusinessId a , ;
"A data property specifying a business identifier for the BusinessObject."@en ;
- ;
+ bom:BusinessObject ;
"has business id"@en ;
.
-
- a ;
+bom:hasTitle a ;
"A data property specifying a title for a Project, Collection, DataItem or File."@en ;
- ;
+ bom:ContentEntity ;
"has title"@en ;
.
-_:b6 a ;
-
- "1"^^ ;
+_:b0 a ;
+
+ bom:Collection ;
- .
+ bom:hasMember .
-
- a ;
+bom:ContentEntity a ;
[ a ;
- ( _:b6 _:b0 )
+ ( _:b1 _:b2 )
] .
-
- a ;
+bom:hasDescription a ;
"A data property specifying a description for a Project, Collection, DataItem or File."@en ;
- ;
+ bom:ContentEntity ;
"has description"@en ;