Skip to content

Commit

Permalink
Add command line script
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Nov 20, 2022
1 parent eaa0922 commit bd7e66c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ digital collections.
* [Using an experimental version](#using-an-experimental-version)
* [More info](#more-info)


## Quality dimensions

The framework measures the following features:
Expand Down Expand Up @@ -83,8 +84,22 @@ above these there are some helper calculators:

## Running as command-line application

Go to the project https://github.com/viaacode/metadata-quality-assessment to
run this framework as a CLI.
usage:

```
./mqa -i <file> -s <file> -m <file>
[-f <format>] [-h <arg>] [-o <file>] [-r <path>] [-v <format>] [-w <format>] [-z]
```
* `-i,--input <file>` Input file.
* `-s,--schema <file>` Schema file describing the metadata structure to run assessment against.
* `-v,--schemaFormat <format>` Format of schema file: json, yaml. Default: based on file extension, else json.
* `-m,--measurements <file>` Configuration file for measurements.
* `-w,--measurementsFormat <format>` Format of measurements config file: json, yaml. Default: based on file extension, else json.
* `-o,--output <file>` Output file.
* `-f,--outputFormat <format>` Format of the output: json, ndjson (new line delimited JSON), csv, csvjson (json encoded in csv; useful for RDB bulk loading). Default: ndjson.
* `-r,--recordAddress <path>` An XPath or JSONPath expression to separate individual records in an XML or JSON files.
* `-z,--gzip` Flag to indicate that input is gzipped.
* `-h,--headers <arg>` Headers to copy from source

## Using the library

Expand Down
6 changes: 6 additions & 0 deletions mqa
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#-----------------------------------------------------------------------
# Command line interface for the Metadata Quality Assessment Framework -
#-----------------------------------------------------------------------
export VERSION=0.9.0
java -jar $(dirname $(readlink -f $0))/target/metadata-qa-api-${VERSION}-shaded.jar $@
16 changes: 8 additions & 8 deletions src/main/java/de/gwdg/metadataqa/api/cli/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,55 +156,55 @@ private static Options buildOptions() {

Option inputOption = Option.builder("i")
.numberOfArgs(1)
.argName("input file")
.argName("file")
.required(true)
.longOpt(INPUT_FILE)
.desc("Input file.")
.build();

Option outputOption = Option.builder("o")
.numberOfArgs(1)
.argName("output file")
.argName("file")
.required(false)
.longOpt(OUTPUT_FILE)
.desc("Output file.")
.build();

Option outputFormatOption = Option.builder("f")
.numberOfArgs(1)
.argName("output format")
.argName("format")
.required(false)
.longOpt(OUTPUT_FORMAT)
.desc("Format of the output: json, ndjson (new line delimited JSON), csv, csvjson (json encoded in csv; useful for RDB bulk loading). Default: ndjson.")
.build();

Option schemaConfigOption = Option.builder("s")
.numberOfArgs(1)
.argName("schema configuration")
.argName("file")
.required(true)
.longOpt(SCHEMA_CONFIG)
.desc("Schema file to run assessment against.")
.build();

Option schemaFormatOption = Option.builder("v")
.numberOfArgs(1)
.argName("schema format")
.argName("format")
.required(false)
.longOpt(SCHEMA_FORMAT)
.desc("Format of schema file: json, yaml. Default: based on file extension, else json.")
.build();

Option measurementsConfigOption = Option.builder("m")
.numberOfArgs(1)
.argName("measurement configuration")
.argName("file")
.required(true)
.longOpt(MEASUREMENTS_CONFIG)
.desc("Configuration file for measurements.")
.build();

Option measurementsFormatOption = Option.builder("w")
.numberOfArgs(1)
.argName("measurement format")
.argName("format")
.required(false)
.longOpt(MEASUREMENTS_FORMAT)
.desc("Format of measurements config file: json, yaml. Default: based on file extension, else json.")
Expand All @@ -226,7 +226,7 @@ private static Options buildOptions() {

Option recordAddressOption = Option.builder("r")
.numberOfArgs(1)
.argName("record address")
.argName("path")
.required(false)
.longOpt(RECORD_ADDRESS)
.desc("An XPath or JSONPath expression to separate individual records in an XML or JSON files.")
Expand Down

0 comments on commit bd7e66c

Please sign in to comment.