Skip to content

Commit

Permalink
Merge pull request #89 from emanuelaepure10/feat/release510
Browse files Browse the repository at this point in the history
build: Updated application versions for 5.1.0 release
stempler authored Mar 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 269e38f + cc8a498 commit 3f1388b
Showing 30 changed files with 1,089 additions and 629 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -13,3 +13,4 @@

/logs/

.idea/*
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# Change Log

All notable changes to this project will be documented in this file.
See the [change log guidelines](http://keepachangelog.com/) for information on how to structure the file.

## [5.1.0]

### Added

- Upgrade hale dependencies to 5.1 and Java version to 17.
- Added support for specifying filters when loading data.

### Changed

- Always use the latest versions of hale offline resources like INSPIRE schemas.
- Include support for MS Access.

### Fixed

- Fixed a problem that lead to alignment migration failing if collection of statistics was not enabled.
- Fixed error when collecting merge statistics for an alignment with custom functions.

## [4.0.0]

## Added
@@ -111,6 +129,7 @@ Initial release based on hale studio 3.0.0.
- Command to generate JSON representations of hale alignments (`hale project alignment export-json`)
- Experimental command to filter to create a copy of a hale project with a filtered alignment (`hale project alignment filter`)

[5.1.0]: https://github.com/halestudio/hale-cli/compare/v4.0.0...v5.1.0
[4.0.0]: https://github.com/halestudio/hale-cli/compare/v3.5.0...v4.0.0
[3.5.0]: https://github.com/halestudio/hale-cli/compare/v3.4.0...v3.5.0
[3.4.0]: https://github.com/halestudio/hale-cli/compare/v3.3.2...v3.4.0
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ Build docker image:
Run
---

You can run the application using Gradle. However, there is no possibility to easily provide arguments.
You can run the application using Gradle.

```
./gradlew run
@@ -45,6 +45,12 @@ Alternatively, you can run the start script of the built application.
hale --version
```

You can provide arguments to run as string in `""` following the below syntax.
For example pass argument `help` to run command as below
```
./gradlew run --args="help"
```

If using `./gradlew installDist`, the start script can be found in `./build/install/hale/bin/`.

JVM parameters can be provided to the start script with the `HALE_OPTS` environment variable.
297 changes: 153 additions & 144 deletions build.gradle

Large diffs are not rendered by default.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
292 changes: 182 additions & 110 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,78 +1,129 @@
#!/usr/bin/env sh
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
#
# 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
#
# https://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.
#

##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum

warn () {
echo "$*"
}
} >&2

die () {
echo
echo "$*"
echo
exit 1
}
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,92 +132,113 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
i=$((i+1))
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
56 changes: 32 additions & 24 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
@if "%DEBUG%" == "" @echo off
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -9,19 +25,23 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,38 +65,26 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
46 changes: 10 additions & 36 deletions src/main/groovy/to/wetransform/halecli/data/RewriteCommand.groovy
Original file line number Diff line number Diff line change
@@ -15,50 +15,24 @@

package to.wetransform.halecli.data

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail
import static to.wetransform.halecli.util.HaleIOHelper.*

import java.io.File;
import java.util.Iterator;
import java.util.List
import java.util.concurrent.atomic.AtomicBoolean;

import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;

import com.google.common.io.Files

import eu.esdihumboldt.hale.app.transform.ConsoleProgressMonitor
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.Value;
import eu.esdihumboldt.hale.common.core.io.report.IOReport;
import eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier
import eu.esdihumboldt.hale.common.headless.transform.AbstractTransformationJob;
import eu.esdihumboldt.hale.common.instance.graph.reference.ReferenceGraph;
import eu.esdihumboldt.hale.common.instance.graph.reference.impl.XMLInspector
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.io.report.IOReport
import eu.esdihumboldt.hale.common.instance.io.InstanceWriter
import eu.esdihumboldt.hale.common.instance.model.DataSet;
import eu.esdihumboldt.hale.common.instance.model.Filter;
import eu.esdihumboldt.hale.common.instance.model.Instance;
import eu.esdihumboldt.hale.common.instance.model.DataSet
import eu.esdihumboldt.hale.common.instance.model.InstanceCollection
import eu.esdihumboldt.hale.common.instance.model.impl.FilteredInstanceCollection;
import eu.esdihumboldt.hale.common.instance.orient.OInstance;
import eu.esdihumboldt.hale.common.instance.orient.storage.BrowseOrientInstanceCollection;
import eu.esdihumboldt.hale.common.instance.orient.storage.BrowseOrientInstanceCollection
import eu.esdihumboldt.hale.common.instance.orient.storage.LocalOrientDB
import eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob;
import eu.esdihumboldt.hale.common.schema.model.Schema;
import eu.esdihumboldt.hale.common.schema.model.TypeIndex
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace
import eu.esdihumboldt.util.cli.CLIUtil;
import eu.esdihumboldt.util.cli.CLIUtil
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import groovy.cli.picocli.CliBuilder
import to.wetransform.halecli.util.InstanceCLI
import to.wetransform.halecli.util.SchemaCLI
import groovy.cli.picocli.OptionAccessor

import static to.wetransform.halecli.util.HaleIOHelper.guessSchema

/**
* Reads a source file and writes it.
43 changes: 12 additions & 31 deletions src/main/groovy/to/wetransform/halecli/data/SplitCommand.groovy
Original file line number Diff line number Diff line change
@@ -15,49 +15,30 @@

package to.wetransform.halecli.data

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail

import java.io.File;
import java.util.Iterator;
import java.util.List
import java.util.concurrent.atomic.AtomicBoolean;

import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;

import com.google.common.io.Files

import eu.esdihumboldt.hale.app.transform.ConsoleProgressMonitor
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.Value;
import eu.esdihumboldt.hale.common.core.io.report.IOReport;
import eu.esdihumboldt.hale.common.core.io.Value
import eu.esdihumboldt.hale.common.core.io.report.IOReport
import eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier
import eu.esdihumboldt.hale.common.core.report.ReportHandler
import eu.esdihumboldt.hale.common.headless.transform.AbstractTransformationJob;
import eu.esdihumboldt.hale.common.instance.graph.reference.ReferenceGraph;
import eu.esdihumboldt.hale.common.instance.graph.reference.ReferenceGraph
import eu.esdihumboldt.hale.common.instance.graph.reference.impl.XMLInspector
import eu.esdihumboldt.hale.common.instance.io.InstanceWriter
import eu.esdihumboldt.hale.common.instance.model.DataSet;
import eu.esdihumboldt.hale.common.instance.model.Filter;
import eu.esdihumboldt.hale.common.instance.model.Instance;
import eu.esdihumboldt.hale.common.instance.model.DataSet
import eu.esdihumboldt.hale.common.instance.model.InstanceCollection
import eu.esdihumboldt.hale.common.instance.model.impl.FilteredInstanceCollection;
import eu.esdihumboldt.hale.common.instance.orient.OInstance;
import eu.esdihumboldt.hale.common.instance.orient.storage.BrowseOrientInstanceCollection;
import eu.esdihumboldt.hale.common.instance.orient.storage.BrowseOrientInstanceCollection
import eu.esdihumboldt.hale.common.instance.orient.storage.LocalOrientDB
import eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob;
import eu.esdihumboldt.hale.common.schema.model.Schema;
import eu.esdihumboldt.hale.common.schema.model.TypeIndex
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace;
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.cli.picocli.CliBuilder
import groovy.transform.CompileStatic
import to.wetransform.halecli.util.InstanceCLI
import to.wetransform.halecli.util.SchemaCLI
import groovy.cli.picocli.OptionAccessor

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail

/**
* Splits a GML source file and creates multiple target files.
Original file line number Diff line number Diff line change
@@ -16,30 +16,24 @@

package to.wetransform.halecli.groovy

import java.util.List

import org.codehaus.groovy.tools.shell.AnsiDetector;
import eu.esdihumboldt.cst.functions.groovy.helper.HelperFunctions
import eu.esdihumboldt.hale.common.core.HalePlatform
import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.Value
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import groovyjarjarcommonscli.HelpFormatter
import org.codehaus.groovy.tools.shell.Groovysh
import org.codehaus.groovy.tools.shell.IO
import org.codehaus.groovy.tools.shell.Main;
import org.codehaus.groovy.tools.shell.util.HelpFormatter
import org.codehaus.groovy.tools.shell.Main
import org.codehaus.groovy.tools.shell.util.Logger
import org.codehaus.groovy.tools.shell.util.MessageSource
import org.codehaus.groovy.tools.shell.util.NoExitSecurityManager
import org.eclipse.core.runtime.IConfigurationElement
import org.eclipse.core.runtime.Platform;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.AnsiConsole

import eu.esdihumboldt.cst.functions.groovy.GroovyConstants
import eu.esdihumboldt.cst.functions.groovy.helper.HelperFunctions
import eu.esdihumboldt.hale.common.core.HalePlatform;
import eu.esdihumboldt.hale.common.core.io.HaleIO;
import eu.esdihumboldt.hale.common.core.io.Value;
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic;

import org.eclipse.core.runtime.Platform
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
/**
* Groovy shell command based on Groovy shell main class.
*
Original file line number Diff line number Diff line change
@@ -15,34 +15,17 @@

package to.wetransform.halecli.project

import org.eclipse.core.runtime.content.IContentType

import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.cli.project.AbstractProjectEnvironmentCommand
import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.extension.IOProviderDescriptor
import eu.esdihumboldt.hale.common.core.io.project.ComplexConfigurationService;
import eu.esdihumboldt.hale.common.core.io.project.ProjectIO;
import eu.esdihumboldt.hale.common.core.io.project.ProjectWriter
import eu.esdihumboldt.hale.common.core.io.project.extension.ProjectFileExtension
import eu.esdihumboldt.hale.common.core.io.project.extension.ProjectFileFactory;
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.core.io.project.model.Project;
import eu.esdihumboldt.hale.common.core.io.project.model.ProjectFile
import eu.esdihumboldt.hale.common.core.io.report.IOReport
import eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier;
import eu.esdihumboldt.hale.common.core.io.supplier.LocatableOutputSupplier
import eu.esdihumboldt.hale.common.core.report.ReportHandler;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider
import eu.esdihumboldt.hale.common.headless.HeadlessIO;
import eu.esdihumboldt.hale.common.headless.impl.HeadlessProjectAdvisor;
import eu.esdihumboldt.hale.common.core.io.project.ComplexConfigurationService
import eu.esdihumboldt.hale.common.core.io.project.ProjectIO
import eu.esdihumboldt.hale.common.core.io.project.model.Project
import eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier
import eu.esdihumboldt.hale.common.core.report.ReportHandler
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import eu.esdihumboldt.util.cli.CommandContext
import eu.esdihumboldt.util.io.OutputSupplier
import groovy.transform.CompileStatic;
import groovy.util.CliBuilder
import to.wetransform.halecli.project.advisor.SaveProjectAdvisor
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor

/**
* Base class for command creating derived projects.
Original file line number Diff line number Diff line change
@@ -15,29 +15,14 @@

package to.wetransform.halecli.project

import java.util.List

import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions;
import eu.esdihumboldt.hale.common.align.migrate.impl.DefaultAlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.impl.MigrationOptionsImpl
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.core.io.project.model.Project
import eu.esdihumboldt.hale.common.core.report.SimpleLog;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.instance.io.InstanceIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace;
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
import to.wetransform.halecli.util.HaleConnectCLI
import to.wetransform.halecli.util.ProjectCLI;;;;
import to.wetransform.halecli.util.ProjectCLI

/**
* Command exporting a project
Original file line number Diff line number Diff line change
@@ -15,42 +15,32 @@

package to.wetransform.halecli.project.alignment

import javax.xml.namespace.QName

import eu.esdihumboldt.cst.functions.groovy.GroovyJoin
import eu.esdihumboldt.hale.common.align.migrate.util.MigrationUtil;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.align.model.AlignmentUtil;
import eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell;
import eu.esdihumboldt.hale.common.align.model.Cell
import eu.esdihumboldt.hale.common.align.model.CellUtil;
import eu.esdihumboldt.hale.common.align.model.Entity
import eu.esdihumboldt.hale.common.align.model.ModifiableCell;
import eu.esdihumboldt.hale.common.align.model.MutableAlignment
import eu.esdihumboldt.hale.common.align.model.MutableCell
import eu.esdihumboldt.hale.common.align.model.TransformationMode;
import eu.esdihumboldt.hale.common.align.migrate.util.MigrationUtil
import eu.esdihumboldt.hale.common.align.model.*
import eu.esdihumboldt.hale.common.align.model.functions.JoinFunction
import eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter
import eu.esdihumboldt.hale.common.align.model.impl.DefaultAlignment
import eu.esdihumboldt.hale.common.align.model.impl.DefaultCell;
import eu.esdihumboldt.hale.common.core.io.ExportProvider;
import eu.esdihumboldt.hale.common.align.model.impl.DefaultCell
import eu.esdihumboldt.hale.common.core.io.ExportProvider
import eu.esdihumboldt.hale.common.core.io.Value
import eu.esdihumboldt.hale.common.core.io.ValueList;
import eu.esdihumboldt.hale.common.core.io.ValueList
import eu.esdihumboldt.hale.common.core.io.project.ComplexConfigurationService
import eu.esdihumboldt.hale.common.core.io.project.ProjectIO;
import eu.esdihumboldt.hale.common.core.io.project.ProjectIO
import eu.esdihumboldt.hale.common.core.io.project.model.Project
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.schema.SchemaSpaceID;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.SchemaSpaceID
import eu.esdihumboldt.hale.common.schema.io.SchemaIO
import eu.esdihumboldt.hale.common.schema.model.TypeDefinition
import eu.esdihumboldt.hale.io.xsd.constraint.XmlElements
import eu.esdihumboldt.hale.io.xsd.model.XmlElement;
import eu.esdihumboldt.hale.io.xsd.model.XmlElement
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
import groovy.json.JsonSlurper
import groovy.transform.CompileStatic;
import groovy.util.CliBuilder;
import groovy.util.OptionAccessor;
import groovy.transform.CompileStatic
import to.wetransform.halecli.project.AbstractDeriveProjectCommand
import to.wetransform.halecli.project.AbstractDeriveProjectCommand.DeriveProjectResult

import javax.xml.namespace.QName

/**
* Command creating a project with a filtered alignment.
Original file line number Diff line number Diff line change
@@ -15,21 +15,17 @@

package to.wetransform.halecli.project.match

import java.util.List

import eu.esdihumboldt.hale.common.align.model.Alignment;
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.core.io.project.model.Project
import eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier
import eu.esdihumboldt.hale.common.core.report.ReportHandler;
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace;
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import to.wetransform.halecli.project.ProjectHelper
import to.wetransform.halecli.project.match.postnas.PostNASSchemaMatcher
import to.wetransform.halecli.util.ProjectCLI;
import to.wetransform.halecli.util.SchemaCLI;
import groovy.cli.picocli.OptionAccessor
import to.wetransform.halecli.util.ProjectCLI
import to.wetransform.halecli.util.SchemaCLI
import groovy.cli.picocli.CliBuilder

abstract class MatchSchemasCommand implements Command {

Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@

package to.wetransform.halecli.project.match.postnas

import com.google.common.collect.ListMultimap
import eu.esdihumboldt.hale.common.align.model.Entity

import javax.xml.namespace.QName

import com.google.common.collect.ArrayListMultimap
@@ -286,11 +289,11 @@ class PostNASSchemaMatcher implements SchemaMatcher {

def sources = ArrayListMultimap.create()
sources.put(null, ref)
cell.source = sources
cell.source = sources as ListMultimap<String, ? extends Entity>

def targets = ArrayListMultimap.create()
targets.put(null, target)
cell.target = targets
cell.target = targets as ListMultimap<String, ? extends Entity>

cell.transformationIdentifier = functionId

Original file line number Diff line number Diff line change
@@ -15,31 +15,16 @@

package to.wetransform.halecli.project.merge

import java.util.List

import eu.esdihumboldt.hale.common.align.merge.impl.MatchingMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions;
import eu.esdihumboldt.hale.common.align.migrate.impl.DefaultAlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.impl.MigrationOptionsImpl
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.core.io.project.model.Project;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.align.merge.impl.MatchingMigration
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.core.service.ServiceProvider
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.instance.io.InstanceIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace;
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode;
import groovy.util.CliBuilder;
import groovy.util.OptionAccessor
import eu.esdihumboldt.hale.common.schema.io.SchemaIO
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import to.wetransform.halecli.project.migrate.AbstractMigratorCommand
import to.wetransform.halecli.util.ProjectCLI;;;;
import to.wetransform.halecli.util.ProjectCLI
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor

/**
* Command that migrates a project to a different schema.
Original file line number Diff line number Diff line change
@@ -186,13 +186,17 @@ protected Iterable<MutableCell> mergeCell(Cell originalCell, AlignmentMigration
* @param migrationAlignment if the alignment is the migration alignment
*/
private void collectAlignmentStatistics(Alignment alignment, boolean migrationAlignment) {
if (statistics == null) {
return;
}

alignment.getCells().forEach(cell -> {
String function = cell.getTransformationIdentifier();
FunctionDefinition<?> fun = FunctionUtil.getFunction(function, serviceProvider);

boolean noSource = cell.getSource() == null || cell.getSource().isEmpty();

statistics.addFunctionUse(fun, migrationAlignment, noSource);
statistics.addFunctionUse(function, fun, migrationAlignment, noSource);
});
}

Original file line number Diff line number Diff line change
@@ -152,21 +152,22 @@ class MergeStatistics {

/**
* Add the use of a specific function (in a cell).
* @param fun the function definition
* @param functionId the function ID
* @param fun the function definition if available
* @param migrationFunction if the function usage is from the migration alignment
*/
public void addFunctionUse(FunctionDefinition fun, boolean migrationFunction, boolean noSource) {
public void addFunctionUse(String functionId, FunctionDefinition fun, boolean migrationFunction, boolean noSource) {
def map = migrationFunction ? migrationFunctions : functions

String name = fun.displayName
String name = fun?.displayName ?: functionId

def entry = map[name]
if (entry == null) {
entry = [
count: 1,
id: fun.id,
id: functionId,
noSource: 0,
augmenation: fun.augmentation
augmentation: fun?.augmentation
]
map[name] = entry
}
Original file line number Diff line number Diff line change
@@ -15,28 +15,13 @@

package to.wetransform.halecli.project.migrate

import java.util.List

import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration
import eu.esdihumboldt.hale.common.align.migrate.impl.DefaultAlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.impl.MigrationOptionsImpl
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.core.io.project.model.Project;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.instance.io.InstanceIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace;
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import groovy.util.OptionAccessor;
import to.wetransform.halecli.util.ProjectCLI;;;;

import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.core.service.ServiceProvider
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
/**
* Base class for commands migrating a project to a different schema.
*
Original file line number Diff line number Diff line change
@@ -15,28 +15,26 @@

package to.wetransform.halecli.project.migrate

import java.util.List

import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions;
import eu.esdihumboldt.hale.common.align.migrate.impl.DefaultAlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions
import eu.esdihumboldt.hale.common.align.migrate.impl.MigrationOptionsImpl
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping;
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.core.io.project.model.Project
import eu.esdihumboldt.hale.common.core.report.SimpleLog;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.core.report.SimpleLog
import eu.esdihumboldt.hale.common.core.service.ServiceProvider
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.instance.io.InstanceIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace;
import eu.esdihumboldt.hale.common.instance.io.InstanceIO
import eu.esdihumboldt.hale.common.schema.io.SchemaIO
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import to.wetransform.halecli.util.ProjectCLI;;;;
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
import to.wetransform.halecli.util.ProjectCLI

/**
* Base class for commands migrating a project to a different schema.
Original file line number Diff line number Diff line change
@@ -15,31 +15,14 @@

package to.wetransform.halecli.project.migrate

import java.util.List

import eu.esdihumboldt.hale.common.align.merge.impl.MatchingMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions;
import eu.esdihumboldt.hale.common.align.migrate.impl.DefaultAlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.impl.MigrationOptionsImpl
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.core.io.project.model.Project;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.align.merge.impl.MatchingMigration
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.instance.io.InstanceIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace;
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode;
import groovy.util.CliBuilder;
import groovy.util.OptionAccessor;
import to.wetransform.halecli.util.ProjectCLI;;;;

import eu.esdihumboldt.hale.common.schema.io.SchemaIO
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import groovy.cli.picocli.CliBuilder
import to.wetransform.halecli.util.ProjectCLI
import groovy.cli.picocli.OptionAccessor
/**
* Command that migrates a project to a different schema.
*
Original file line number Diff line number Diff line change
@@ -15,33 +15,15 @@

package to.wetransform.halecli.project.migrate

import java.util.List

import eu.esdihumboldt.hale.common.align.merge.impl.DefaultSchemaMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration;
import eu.esdihumboldt.hale.common.align.migrate.AlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.MigrationOptions;
import eu.esdihumboldt.hale.common.align.migrate.impl.DefaultAlignmentMigrator
import eu.esdihumboldt.hale.common.align.migrate.impl.MigrationOptionsImpl
import eu.esdihumboldt.hale.common.align.migrate.util.EffectiveMapping;
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.core.io.project.model.Project;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.instance.io.InstanceIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO
import eu.esdihumboldt.hale.common.schema.model.Schema;
import eu.esdihumboldt.hale.common.align.merge.impl.DefaultSchemaMigration
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace;
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace
import groovy.cli.picocli.CliBuilder
import groovy.transform.CompileStatic
import groovy.util.CliBuilder;
import groovy.util.OptionAccessor;
import to.wetransform.halecli.util.ProjectCLI
import to.wetransform.halecli.util.SchemaCLI;;;;;

import to.wetransform.halecli.util.SchemaCLI
import groovy.cli.picocli.OptionAccessor
/**
* Command that migrates a project to a different schema.
*
@@ -52,7 +34,7 @@ class ReplaceSourceCommand extends AbstractMigrationCommand<DefaultSchemaMigrati

@Override
protected void addOptions(CliBuilder cli) {
// options for loading new source schema
// options for loading new source schema
SchemaCLI.loadSchemaOptions(cli, 'schema', 'The new source schema for the project')
}

Original file line number Diff line number Diff line change
@@ -15,14 +15,13 @@

package to.wetransform.halecli.schema

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail
import static to.wetransform.halecli.util.HaleIOHelper.*
import to.wetransform.halecli.util.SchemaCLI
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.util.cli.Command
import eu.esdihumboldt.util.cli.CommandContext

import groovy.cli.picocli.CliBuilder
import to.wetransform.halecli.util.SchemaCLI
import groovy.cli.picocli.OptionAccessor
/**
* Reads a schema and writes it.
*
Original file line number Diff line number Diff line change
@@ -15,13 +15,13 @@

package to.wetransform.halecli.util

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.HalePlatform
import eu.esdihumboldt.hale.common.core.service.ServiceProvider
import eu.esdihumboldt.hale.io.haleconnect.HaleConnectService
import eu.esdihumboldt.util.cli.CLIUtil
import groovy.transform.CompileStatic
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail

/**
* Common utility functions for configuring a hale connect connection.
115 changes: 86 additions & 29 deletions src/main/groovy/to/wetransform/halecli/util/InstanceCLI.groovy
Original file line number Diff line number Diff line change
@@ -15,41 +15,30 @@

package to.wetransform.halecli.util

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail;
import static to.wetransform.halecli.util.HaleIOHelper.*

import java.io.InputStream
import java.io.OutputStream;
import java.net.URI;
import java.util.Map

import org.eclipse.core.runtime.jobs.Job;

import com.google.common.io.Files

import eu.esdihumboldt.hale.app.transform.ConsoleProgressMonitor
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator
import eu.esdihumboldt.hale.common.core.io.report.IOReport;
import eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier;
import eu.esdihumboldt.hale.common.core.io.supplier.LocatableInputSupplier
import eu.esdihumboldt.hale.common.core.io.supplier.LocatableOutputSupplier
import eu.esdihumboldt.hale.common.core.report.ReportHandler;
import eu.esdihumboldt.hale.common.core.service.ServiceProvider;
import eu.esdihumboldt.hale.common.core.io.report.IOReport
import eu.esdihumboldt.hale.common.core.report.ReportHandler
import eu.esdihumboldt.hale.common.core.service.ServiceProvider
import eu.esdihumboldt.hale.common.headless.transform.filter.InstanceFilterDefinition
import eu.esdihumboldt.hale.common.instance.io.InstanceReader
import eu.esdihumboldt.hale.common.instance.io.InstanceWriter;
import eu.esdihumboldt.hale.common.instance.io.InstanceWriter
import eu.esdihumboldt.hale.common.instance.model.InstanceCollection
import eu.esdihumboldt.hale.common.instance.orient.storage.LocalOrientDB
import eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob;
import eu.esdihumboldt.hale.common.schema.io.SchemaReader;
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import eu.esdihumboldt.hale.common.schema.model.TypeIndex
import eu.esdihumboldt.util.Pair;
import eu.esdihumboldt.util.Pair
import eu.esdihumboldt.util.cli.CLIUtil
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
import groovy.transform.CompileStatic
import groovy.util.OptionAccessor
import org.eclipse.core.runtime.jobs.Job

import static to.wetransform.halecli.util.HaleIOHelper.prepareReader
import static to.wetransform.halecli.util.HaleIOHelper.prepareWriter

/**
* Common utility functions for setting up a CliBuilder for loading/saving instances.
@@ -58,12 +47,72 @@ import groovy.util.OptionAccessor
*/
class InstanceCLI {

static void loadOptions(CliBuilder cli, String argName = 'data', String descr = 'Data to load') {
static void loadOptions(CliBuilder cli, String argName = 'data', String descr = 'Data to load', boolean allowFilter = true) {
cli._(longOpt: argName, args:1, argName:'file-or-URL', descr)
cli._(longOpt: argName + '-setting', args:2, valueSeparator:'=', argName:'setting=value',
'Setting for instance reader (optional, repeatable)')
cli._(longOpt: argName + '-reader', args:1, argName: 'provider-id',
'Identifier of instance reader to use (otherwise auto-detect)')

// filter options
if (allowFilter) {
filterOptions(cli, argName)
}
}

static void filterOptions(CliBuilder cli, String argName) {
def prefix = argName ? argName + '-' : ''
cli._(longOpt: prefix + 'filter', args: 1, argName: 'filter',
'Filter expression that is checked against all objects read from the source. The filter language can be specified at the beginning of the filter expression, followed by a colon. If no language is provided explicitly, the expression is assumed to be CQL. If multiple filters are provided an object must only match one of them.')
cli._(longOpt: prefix + 'exclude', args: 1, argName: 'filter',
'All objects matching the filter will be exlcuded.')
cli._(longOpt: prefix + 'filter-on', args: 2, valueSeparator:'=', argName: 'type=filter',
'Filter on a specific type only. You can specify the type\'s name with or without namespace. If you want to specify the namespace, wrap it in curly braces and prepend it to the type name.')
cli._(longOpt: prefix + 'exclude-type', args: 1, argName: 'type',
'Exclude a specific type')
}

static InstanceFilterDefinition createFilter(OptionAccessor options, String argName) {
def prefix = argName ? argName + '-' : ''
InstanceFilterDefinition res = null

def filter = options."${prefix}filters" // magic "s" at the end yields a list
if (filter) {
if (!res) res = new InstanceFilterDefinition();

filter.each {
res.addUnconditionalFilter(it)
}
}

filter = options."${prefix}excludes"
if (filter) {
if (!res) res = new InstanceFilterDefinition();

filter.each {
res.addExcludeFilter(it)
}
}

filter = options."${prefix}filter-ons"
if (filter) {
if (!res) res = new InstanceFilterDefinition();

filter.toSpreadMap().each { key, value ->
res.addTypeFilter(key, value)
}
}

filter = options."${prefix}exclude-types"
if (filter) {
if (!res) res = new InstanceFilterDefinition();

filter.each {
res.addExcludedType(it)
}
}

return res
}

static InstanceCollection load(OptionAccessor options, TypeIndex schema, String argName = 'data') {
@@ -78,7 +127,9 @@ class InstanceCLI {

String customProvider = options."${argName}-reader" ?: null

return load(loc, settings, customProvider, schema, reports)
InstanceFilterDefinition filter = createFilter(options, argName)

return load(loc, settings, customProvider, schema, reports, filter)
}
else {
return null
@@ -87,7 +138,7 @@ class InstanceCLI {

@CompileStatic
static InstanceCollection load(URI loc, Map<String, String> settings, String customProvider,
TypeIndex schema, ReportHandler reports) {
TypeIndex schema, ReportHandler reports, InstanceFilterDefinition filter = null) {

Pair<InstanceReader, String> readerInfo = prepareReader(loc, InstanceReader, settings, customProvider)
InstanceReader instanceReader = readerInfo.first
@@ -99,7 +150,13 @@ class InstanceCLI {
IOReport report = instanceReader.execute(null)
reports?.publishReport(report)

instanceReader.getInstances()
InstanceCollection result = instanceReader.getInstances()

if (filter) {
result = result.select(filter)
}

return result
}

// save data
8 changes: 5 additions & 3 deletions src/main/groovy/to/wetransform/halecli/util/ProjectCLI.groovy
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@

package to.wetransform.halecli.util

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail
import to.wetransform.halecli.project.ProjectHelper
import eu.esdihumboldt.hale.common.align.model.Alignment
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.io.HaleIO
@@ -25,15 +23,19 @@ import eu.esdihumboldt.hale.common.core.io.project.ProjectWriter
import eu.esdihumboldt.hale.common.core.io.project.model.Project
import eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier
import eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier
import eu.esdihumboldt.hale.common.core.io.supplier.LocatableOutputSupplier;
import eu.esdihumboldt.hale.common.core.io.supplier.NoStreamOutputSupplier
import eu.esdihumboldt.hale.common.core.report.ReportHandler
import eu.esdihumboldt.hale.common.headless.impl.ProjectTransformationEnvironment
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import eu.esdihumboldt.hale.io.haleconnect.HaleConnectUrnBuilder
import eu.esdihumboldt.hale.io.haleconnect.project.HaleConnectProjectWriter
import eu.esdihumboldt.util.cli.CLIUtil
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
import groovy.transform.CompileStatic
import to.wetransform.halecli.project.ProjectHelper

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail

/**
* Common utility functions for setting up a CliBuilder for loading and saving a project.
36 changes: 12 additions & 24 deletions src/main/groovy/to/wetransform/halecli/util/SchemaCLI.groovy
Original file line number Diff line number Diff line change
@@ -15,36 +15,24 @@

package to.wetransform.halecli.util

import static eu.esdihumboldt.hale.app.transform.ExecUtil.fail;
import static to.wetransform.halecli.util.HaleIOHelper.*

import java.io.InputStream
import java.net.URI;
import java.util.Map

import eu.esdihumboldt.hale.common.cli.HaleCLIUtil;
import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.Value
import eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator;
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration;
import eu.esdihumboldt.hale.common.core.io.report.IOReport;
import eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier;
import eu.esdihumboldt.hale.common.core.io.supplier.LocatableInputSupplier;
import eu.esdihumboldt.hale.common.cli.HaleCLIUtil
import eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator
import eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration
import eu.esdihumboldt.hale.common.core.io.report.IOReport
import eu.esdihumboldt.hale.common.core.report.ReportHandler
import eu.esdihumboldt.hale.common.instance.io.InstanceReader
import eu.esdihumboldt.hale.common.instance.io.InstanceWriter;
import eu.esdihumboldt.hale.common.instance.model.InstanceCollection;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO;
import eu.esdihumboldt.hale.common.schema.io.SchemaIO
import eu.esdihumboldt.hale.common.schema.io.SchemaReader
import eu.esdihumboldt.hale.common.schema.io.SchemaWriter;
import eu.esdihumboldt.hale.common.schema.io.SchemaWriter
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace;
import eu.esdihumboldt.hale.common.schema.model.SchemaSpace
import eu.esdihumboldt.hale.common.schema.model.impl.DefaultSchemaSpace
import eu.esdihumboldt.util.Pair;
import eu.esdihumboldt.util.Pair
import eu.esdihumboldt.util.cli.CLIUtil
import groovy.cli.picocli.CliBuilder
import groovy.transform.CompileStatic
import groovy.util.CliBuilder
import groovy.util.OptionAccessor;;;;
import groovy.cli.picocli.OptionAccessor
import static to.wetransform.halecli.util.HaleIOHelper.prepareReader
import static to.wetransform.halecli.util.HaleIOHelper.prepareWriter

/**
* Common utility functions for setting up a CliBuilder for loading a schema.
277 changes: 272 additions & 5 deletions src/test/groovy/to/wetransform/halecli/data/RewriteCommandTest.groovy
Original file line number Diff line number Diff line change
@@ -15,16 +15,16 @@

package to.wetransform.halecli.data

import static org.junit.Assert.*

import eu.esdihumboldt.util.cli.Runner
import org.junit.BeforeClass
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.contrib.java.lang.system.SystemOutRule

import to.wetransform.halecli.internal.Init
import eu.esdihumboldt.hale.common.core.HalePlatform
import eu.esdihumboldt.util.cli.Runner

import static org.junit.Assert.assertEquals
import static org.junit.Assert.assertTrue

/**
* Tests for rewrite command.
@@ -139,4 +139,271 @@ class RewriteCommandTest {
}
}

@Test
void testRewriteFilter() {

def args = ['data', 'rewrite'];

args << '--data'
args << getClass().getClassLoader().getResource("testdata/inspire2.gml")

args << '--data-filter'
args << "CQL:id = 'A1'"

def targetFile = File.createTempFile('rewrite', '.gml')
args << '--target'
args << targetFile.absolutePath
args << '--target-writer'
args << 'eu.esdihumboldt.hale.io.gml.writer'
args << '--target-setting'
args << 'xml.pretty=true'

try {
int code = new Runner('hale').run(args as String[])

// expecting a successful execution
assertEquals(0, code)

assertTrue(targetFile.exists())
assertTrue(targetFile.size() > 0)

def xml = new XmlSlurper().parse(targetFile)
def objects = xml.featureMember

assertEquals(1, objects.size())
} finally {
targetFile.delete()
}
}

@Test
void testRewriteFilterList() {

def args = ['data', 'rewrite'];

args << '--data'
args << getClass().getClassLoader().getResource("testdata/inspire2.gml")

args << '--data-filter'
args << "CQL:id = 'SW1'"

args << '--data-filter'
args << "CQL:id = 'A1'"

def targetFile = File.createTempFile('rewrite', '.gml')
args << '--target'
args << targetFile.absolutePath
args << '--target-writer'
args << 'eu.esdihumboldt.hale.io.gml.writer'
args << '--target-setting'
args << 'xml.pretty=true'

try {
int code = new Runner('hale').run(args as String[])

// expecting a successful execution
assertEquals(0, code)

assertTrue(targetFile.exists())
assertTrue(targetFile.size() > 0)

def xml = new XmlSlurper().parse(targetFile)
def objects = xml.featureMember

assertEquals(2, objects.size())
def wcs = objects.Watercourse
assertEquals(1, wcs.size())
def sws = objects.StandingWater
assertEquals(1, sws.size())
} finally {
targetFile.delete()
}
}

@Test
void testRewriteExcludeType() {

def args = ['data', 'rewrite'];

args << '--data'
args << getClass().getClassLoader().getResource("testdata/inspire2.gml")

args << '--data-exclude-type'
args << 'Watercourse'

def targetFile = File.createTempFile('rewrite', '.gml')
args << '--target'
args << targetFile.absolutePath
args << '--target-writer'
args << 'eu.esdihumboldt.hale.io.gml.writer'
args << '--target-setting'
args << 'xml.pretty=true'

try {
int code = new Runner('hale').run(args as String[])

// expecting a successful execution
assertEquals(0, code)

assertTrue(targetFile.exists())
assertTrue(targetFile.size() > 0)

def xml = new XmlSlurper().parse(targetFile)
def objects = xml.featureMember

assertEquals(1, objects.size())
def wcs = objects.Watercourse
assertEquals(0, wcs.size())
def sws = objects.StandingWater
assertEquals(1, sws.size())
} finally {
targetFile.delete()
}
}

@Ignore('Does not succeed due to bug in hale InstanceFilterDefinition - exclude is ignored if no other filter is present')
@Test
void testRewriteExclude() {

def args = ['data', 'rewrite'];

args << '--data'
args << getClass().getClassLoader().getResource("testdata/inspire2.gml")

args << '--data-exclude'
args << "\"id\" = 'A2'"

def targetFile = File.createTempFile('rewrite', '.gml')
args << '--target'
args << targetFile.absolutePath
args << '--target-writer'
args << 'eu.esdihumboldt.hale.io.gml.writer'
args << '--target-setting'
args << 'xml.pretty=true'

try {
int code = new Runner('hale').run(args as String[])

// expecting a successful execution
assertEquals(0, code)

assertTrue(targetFile.exists())
assertTrue(targetFile.size() > 0)

def xml = new XmlSlurper().parse(targetFile)
def objects = xml.featureMember

assertEquals(3, objects.size())
def wcs = objects.Watercourse
assertEquals(2, wcs.size())
def sws = objects.StandingWater
assertEquals(1, sws.size())
} finally {
targetFile.delete()
}
}

@Test
void testRewriteExcludeWorkaround() {

def args = ['data', 'rewrite'];

args << '--data'
args << getClass().getClassLoader().getResource("testdata/inspire2.gml")

args << '--data-exclude'
args << "\"id\" = 'A2'"

args << '--data-exclude-type'
args << 'DoesNotExist'

def targetFile = File.createTempFile('rewrite', '.gml')
args << '--target'
args << targetFile.absolutePath
args << '--target-writer'
args << 'eu.esdihumboldt.hale.io.gml.writer'
args << '--target-setting'
args << 'xml.pretty=true'

try {
int code = new Runner('hale').run(args as String[])

// expecting a successful execution
assertEquals(0, code)

assertTrue(targetFile.exists())
assertTrue(targetFile.size() > 0)

def xml = new XmlSlurper().parse(targetFile)
def objects = xml.featureMember

assertEquals(3, objects.size())
def wcs = objects.Watercourse
assertEquals(2, wcs.size())
def sws = objects.StandingWater
assertEquals(1, sws.size())
} finally {
targetFile.delete()
}
}

@Test
void testRewriteFilterContext() {

def args = ['data', 'rewrite'];

args << '--data'
args << getClass().getClassLoader().getResource("testdata/inspire2.gml")

args << '--data-filter'
args << '''groovy:
def type = instance.definition.name
boolean rejected = false
if (type) {
withContext { c ->
def typeMap = c.typeCounts
if (!typeMap) {
typeMap = [:]
c.typeCounts = typeMap
}
def count = typeMap[type] ?: 0
if (count >= 2) { // only keep max 2 per type
rejected = true
}
typeMap[type] = count + 1
}
}
!rejected
'''

def targetFile = File.createTempFile('rewrite', '.gml')
args << '--target'
args << targetFile.absolutePath
args << '--target-writer'
args << 'eu.esdihumboldt.hale.io.gml.writer'
args << '--target-setting'
args << 'xml.pretty=true'

try {
int code = new Runner('hale').run(args as String[])

// expecting a successful execution
assertEquals(0, code)

assertTrue(targetFile.exists())
assertTrue(targetFile.size() > 0)

def xml = new XmlSlurper().parse(targetFile)
def objects = xml.featureMember

assertEquals(3, objects.size())
def wcs = objects.Watercourse
assertEquals(2, wcs.size())
def sws = objects.StandingWater
assertEquals(1, sws.size())
} finally {
targetFile.delete()
}
}

}
187 changes: 187 additions & 0 deletions src/test/resources/testdata/inspire2.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0" ?>
<gml:FeatureCollection xmlns:net="http://inspire.ec.europa.eu/schemas/net/4.0" xmlns:hy-n="http://inspire.ec.europa.eu/schemas/hy-n/4.0" xmlns:sc="http://www.interactive-instruments.de/ShapeChange/AppInfo" xmlns:hy="http://inspire.ec.europa.eu/schemas/hy/4.0" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:om="http://www.opengis.net/om/2.0" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ns1="http://www.w3.org/1999/xhtml" xmlns:base="http://inspire.ec.europa.eu/schemas/base/3.3" xmlns:gn="http://inspire.ec.europa.eu/schemas/gn/4.0" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:sr="http://inspire.ec.europa.eu/schemas/sr/4.0" xmlns:hy-p="http://inspire.ec.europa.eu/schemas/hy-p/4.0" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:omor="http://inspire.ec.europa.eu/schemas/omor/3.0" xmlns:omop="http://inspire.ec.europa.eu/schemas/omop/3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" gml:id="_6e6edc1a-158d-4415-8994-c4c003dbe755" xsi:schemaLocation="http://inspire.ec.europa.eu/schemas/hy-p/4.0 http://inspire.ec.europa.eu/schemas/hy-p/4.0/HydroPhysicalWaters.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/deprecatedTypes.xsd">
<gml:featureMember>
<hy-p:Watercourse gml:id="A1">
<gml:description>Contains Ordnance Survey data © Crown copyright and database right 2011</gml:description>
<gml:name></gml:name>
<hy-p:geographicalName>
<gn:GeographicalName>
<gn:language>eng</gn:language>
<gn:nativeness xlink:href="http://inspire.ec.europa.eu/codelist/NativenessValue/endonym"></gn:nativeness>
<gn:nameStatus xlink:href="http://inspire.ec.europa.eu/codelist/NameStatusValue/official"></gn:nameStatus>
<gn:sourceOfName nilReason="other:unpopulated" xsi:nil="true"></gn:sourceOfName>
<gn:pronunciation nilReason="other:unpopulated" xsi:nil="true"></gn:pronunciation>
<gn:spelling>
<gn:SpellingOfName>
<gn:text></gn:text>
<gn:script>Latn</gn:script>
</gn:SpellingOfName>
</gn:spelling>
</gn:GeographicalName>
</hy-p:geographicalName>
<hy-p:beginLifespanVersion xsi:nil="true"/>
<hy-p:geometry>
<gml:Polygon gml:id="_f579f3ca-90f9-4da9-b3e2-e4c8af9a4f84" srsName="http://www.opengis.net/def/crs/EPSG/0/25832" srsDimension="2">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-207345.13554061973 6188201.421230434 -207088.75251305848 6188170.108745712 -207079.05134511134 6188169.882136189 -207069.49237461493 6188171.552484499 -207060.44294713344 6188175.05559922 -207052.25082646974 6188180.2568569295 -207045.2308303879 6188186.95637582 -207039.65273247706 6188194.896697085 -207035.7308950388 6188203.772678946 -207033.6160314005 6188213.243223019 -207033.38941418834 6188222.944382441 -207035.0597521289 6188232.503348024 -207038.56285538268 6188241.552774954 -207043.7641022785 6188249.7448995095 -207050.46361265122 6188256.764903343 -207058.4039289998 6188262.343011683 -207067.27991029166 6188266.264860648 -207076.75045823038 6188268.379735156 -207346.58189882734 6188301.335158737 -207355.3819901311 6188301.621076353 -207364.09352927096 6188300.34339694 -207372.44090120192 6188297.5425429335 -207520.13910204603 6188232.858446235 -207724.51641284954 6188199.20473434 -207902.52683724207 6188237.357314383 -207912.1689432416 6188238.451134508 -207921.83917418402 6188237.642855512 -207931.16590836574 6188234.963538198 -207939.79072413384 6188230.516146437 -207947.38217390387 6188224.471590458 -207953.64852161508 6188217.06215895 -207958.34895412554 6188208.572592365 -207961.3028356639 6188199.3291404685 -207962.39664967917 6188189.6870246865 -207961.58836130193 6188180.016787026 -207958.9090327518 6188170.69005021 -207954.46162961132 6188162.06523629 -207948.41706384148 6188154.473792566 -207941.00762561732 6188148.207454177 -207932.5180564077 6188143.507032843 -207923.27460638422 6188140.553162624 -207736.09752724937 6188100.436239479 -207726.90991634503 6188099.35125106 -207717.68087491766 6188099.994804791 -207497.92639998137 6188136.180968051 -207486.11116307578 6188139.681000924 -207345.13554061973 6188201.421230434</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</hy-p:geometry>
<hy-p:inspireId>
<base:Identifier>
<base:localId>_d1a6215e-3185-429f-b9b1-f160437e4f99</base:localId>
<base:namespace>_example</base:namespace>
</base:Identifier>
</hy-p:inspireId>
<hy-p:origin xsi:nil="true"/>
<hy-p:persistence xsi:nil="true"/>
<hy-p:tidal xsi:nil="true"/>
<hy-p:drainsBasin xsi:nil="true"/>
<hy-p:delineationKnown xsi:nil="true"/>
<hy-p:length uom="m" xsi:nil="true"></hy-p:length>
<hy-p:level xsi:nil="true"/>
<hy-p:width>
<hy-p:WidthRange>
<hy-p:lower uom="m">4.573170731707317</hy-p:lower>
<hy-p:upper uom="m">4.573170731707317</hy-p:upper>
</hy-p:WidthRange>
</hy-p:width>
</hy-p:Watercourse>
</gml:featureMember>
<gml:featureMember>
<hy-p:Watercourse gml:id="A2">
<gml:description>Contains Ordnance Survey data © Crown copyright and database right 2011</gml:description>
<gml:name></gml:name>
<hy-p:geographicalName>
<gn:GeographicalName>
<gn:language>eng</gn:language>
<gn:nativeness xlink:href="http://inspire.ec.europa.eu/codelist/NativenessValue/endonym"></gn:nativeness>
<gn:nameStatus xlink:href="http://inspire.ec.europa.eu/codelist/NameStatusValue/official"></gn:nameStatus>
<gn:sourceOfName nilReason="other:unpopulated" xsi:nil="true"></gn:sourceOfName>
<gn:pronunciation nilReason="other:unpopulated" xsi:nil="true"></gn:pronunciation>
<gn:spelling>
<gn:SpellingOfName>
<gn:text></gn:text>
<gn:script>Latn</gn:script>
</gn:SpellingOfName>
</gn:spelling>
</gn:GeographicalName>
</hy-p:geographicalName>
<hy-p:beginLifespanVersion xsi:nil="true"/>
<hy-p:geometry>
<gml:Polygon gml:id="_f579f3ca-90f9-4da9-b3e2-e4c8af9a4f84" srsName="http://www.opengis.net/def/crs/EPSG/0/25832" srsDimension="2">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-207345.13554061973 6188201.421230434 -207088.75251305848 6188170.108745712 -207079.05134511134 6188169.882136189 -207069.49237461493 6188171.552484499 -207060.44294713344 6188175.05559922 -207052.25082646974 6188180.2568569295 -207045.2308303879 6188186.95637582 -207039.65273247706 6188194.896697085 -207035.7308950388 6188203.772678946 -207033.6160314005 6188213.243223019 -207033.38941418834 6188222.944382441 -207035.0597521289 6188232.503348024 -207038.56285538268 6188241.552774954 -207043.7641022785 6188249.7448995095 -207050.46361265122 6188256.764903343 -207058.4039289998 6188262.343011683 -207067.27991029166 6188266.264860648 -207076.75045823038 6188268.379735156 -207346.58189882734 6188301.335158737 -207355.3819901311 6188301.621076353 -207364.09352927096 6188300.34339694 -207372.44090120192 6188297.5425429335 -207520.13910204603 6188232.858446235 -207724.51641284954 6188199.20473434 -207902.52683724207 6188237.357314383 -207912.1689432416 6188238.451134508 -207921.83917418402 6188237.642855512 -207931.16590836574 6188234.963538198 -207939.79072413384 6188230.516146437 -207947.38217390387 6188224.471590458 -207953.64852161508 6188217.06215895 -207958.34895412554 6188208.572592365 -207961.3028356639 6188199.3291404685 -207962.39664967917 6188189.6870246865 -207961.58836130193 6188180.016787026 -207958.9090327518 6188170.69005021 -207954.46162961132 6188162.06523629 -207948.41706384148 6188154.473792566 -207941.00762561732 6188148.207454177 -207932.5180564077 6188143.507032843 -207923.27460638422 6188140.553162624 -207736.09752724937 6188100.436239479 -207726.90991634503 6188099.35125106 -207717.68087491766 6188099.994804791 -207497.92639998137 6188136.180968051 -207486.11116307578 6188139.681000924 -207345.13554061973 6188201.421230434</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</hy-p:geometry>
<hy-p:inspireId>
<base:Identifier>
<base:localId>_d1a6215e-3185-429f-b9b1-f160437e4f99</base:localId>
<base:namespace>_example</base:namespace>
</base:Identifier>
</hy-p:inspireId>
<hy-p:origin xsi:nil="true"/>
<hy-p:persistence xsi:nil="true"/>
<hy-p:tidal xsi:nil="true"/>
<hy-p:drainsBasin xsi:nil="true"/>
<hy-p:delineationKnown xsi:nil="true"/>
<hy-p:length uom="m" xsi:nil="true"></hy-p:length>
<hy-p:level xsi:nil="true"/>
<hy-p:width>
<hy-p:WidthRange>
<hy-p:lower uom="m">4.573170731707317</hy-p:lower>
<hy-p:upper uom="m">4.573170731707317</hy-p:upper>
</hy-p:WidthRange>
</hy-p:width>
</hy-p:Watercourse>
</gml:featureMember>
<gml:featureMember>
<hy-p:Watercourse gml:id="A3">
<gml:description>Contains Ordnance Survey data © Crown copyright and database right 2011</gml:description>
<gml:name></gml:name>
<hy-p:geographicalName>
<gn:GeographicalName>
<gn:language>eng</gn:language>
<gn:nativeness xlink:href="http://inspire.ec.europa.eu/codelist/NativenessValue/endonym"></gn:nativeness>
<gn:nameStatus xlink:href="http://inspire.ec.europa.eu/codelist/NameStatusValue/official"></gn:nameStatus>
<gn:sourceOfName nilReason="other:unpopulated" xsi:nil="true"></gn:sourceOfName>
<gn:pronunciation nilReason="other:unpopulated" xsi:nil="true"></gn:pronunciation>
<gn:spelling>
<gn:SpellingOfName>
<gn:text></gn:text>
<gn:script>Latn</gn:script>
</gn:SpellingOfName>
</gn:spelling>
</gn:GeographicalName>
</hy-p:geographicalName>
<hy-p:beginLifespanVersion xsi:nil="true"/>
<hy-p:geometry>
<gml:Polygon gml:id="_f579f3ca-90f9-4da9-b3e2-e4c8af9a4f84" srsName="http://www.opengis.net/def/crs/EPSG/0/25832" srsDimension="2">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-207345.13554061973 6188201.421230434 -207088.75251305848 6188170.108745712 -207079.05134511134 6188169.882136189 -207069.49237461493 6188171.552484499 -207060.44294713344 6188175.05559922 -207052.25082646974 6188180.2568569295 -207045.2308303879 6188186.95637582 -207039.65273247706 6188194.896697085 -207035.7308950388 6188203.772678946 -207033.6160314005 6188213.243223019 -207033.38941418834 6188222.944382441 -207035.0597521289 6188232.503348024 -207038.56285538268 6188241.552774954 -207043.7641022785 6188249.7448995095 -207050.46361265122 6188256.764903343 -207058.4039289998 6188262.343011683 -207067.27991029166 6188266.264860648 -207076.75045823038 6188268.379735156 -207346.58189882734 6188301.335158737 -207355.3819901311 6188301.621076353 -207364.09352927096 6188300.34339694 -207372.44090120192 6188297.5425429335 -207520.13910204603 6188232.858446235 -207724.51641284954 6188199.20473434 -207902.52683724207 6188237.357314383 -207912.1689432416 6188238.451134508 -207921.83917418402 6188237.642855512 -207931.16590836574 6188234.963538198 -207939.79072413384 6188230.516146437 -207947.38217390387 6188224.471590458 -207953.64852161508 6188217.06215895 -207958.34895412554 6188208.572592365 -207961.3028356639 6188199.3291404685 -207962.39664967917 6188189.6870246865 -207961.58836130193 6188180.016787026 -207958.9090327518 6188170.69005021 -207954.46162961132 6188162.06523629 -207948.41706384148 6188154.473792566 -207941.00762561732 6188148.207454177 -207932.5180564077 6188143.507032843 -207923.27460638422 6188140.553162624 -207736.09752724937 6188100.436239479 -207726.90991634503 6188099.35125106 -207717.68087491766 6188099.994804791 -207497.92639998137 6188136.180968051 -207486.11116307578 6188139.681000924 -207345.13554061973 6188201.421230434</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</hy-p:geometry>
<hy-p:inspireId>
<base:Identifier>
<base:localId>_d1a6215e-3185-429f-b9b1-f160437e4f99</base:localId>
<base:namespace>_example</base:namespace>
</base:Identifier>
</hy-p:inspireId>
<hy-p:origin xsi:nil="true"/>
<hy-p:persistence xsi:nil="true"/>
<hy-p:tidal xsi:nil="true"/>
<hy-p:drainsBasin xsi:nil="true"/>
<hy-p:delineationKnown xsi:nil="true"/>
<hy-p:length uom="m" xsi:nil="true"></hy-p:length>
<hy-p:level xsi:nil="true"/>
<hy-p:width>
<hy-p:WidthRange>
<hy-p:lower uom="m">4.573170731707317</hy-p:lower>
<hy-p:upper uom="m">4.573170731707317</hy-p:upper>
</hy-p:WidthRange>
</hy-p:width>
</hy-p:Watercourse>
</gml:featureMember>
<gml:featureMember>
<hy-p:StandingWater gml:id="SW1">
<hy-p:geographicalName>
<gn:GeographicalName>
<gn:language xsi:nil="true"/>
<gn:nativeness xsi:nil="true"/>
<gn:nameStatus xsi:nil="true"/>
<gn:sourceOfName xsi:nil="true"/>
<gn:pronunciation xsi:nil="true"/>
<gn:spelling>
<gn:SpellingOfName>
<gn:text>some water</gn:text>
<gn:script xsi:nil="true"/>
</gn:SpellingOfName>
</gn:spelling>
</gn:GeographicalName>
</hy-p:geographicalName>
<hy-p:beginLifespanVersion xsi:nil="true"/>
<hy-p:geometry/>
<hy-p:inspireId>
<base:Identifier>
<base:localId>SW1</base:localId>
<base:namespace>some value</base:namespace>
</base:Identifier>
</hy-p:inspireId>
<hy-p:origin xsi:nil="true"/>
<hy-p:persistence xsi:nil="true"/>
<hy-p:tidal xsi:nil="true"/>
<hy-p:drainsBasin xsi:nil="true"/>
<hy-p:elevation xsi:nil="true"/>
<hy-p:meanDepth xsi:nil="true"/>
<hy-p:surfaceArea xsi:nil="true"/>
</hy-p:StandingWater>
</gml:featureMember>
</gml:FeatureCollection>

0 comments on commit 3f1388b

Please sign in to comment.