diff --git a/.gitignore b/.gitignore index 2faeee7..7aff408 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /logs/ +.idea/* diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c7e53..5f0f429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 9473662..24d245e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.gradle b/build.gradle index c4d2f1d..e6eb7fe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,33 +1,36 @@ buildscript { repositories { - jcenter() + mavenCentral() } dependencies { - classpath 'org.standardout:gradle-eclipseconfig:1.0.0' + classpath 'org.standardout:gradle-eclipseconfig:1.1.1' } } plugins { id 'groovy' id 'application' - id 'maven' - id 'osgi' - id 'com.bmuschko.docker-java-application' version '3.6.2' - id "nebula.ospackage-application" version "3.6.1" + id 'maven-publish' + //id 'osgi' // discontinued - do we need it? + id 'com.bmuschko.docker-java-application' version '9.3.1' + id "nebula.ospackage-application" version "9.1.1" id 'org.ajoberstar.grgit' version '1.5.0' } apply plugin: 'org.standardout.eclipseconfig' -sourceCompatibility = '1.8' +// update to java 17 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 group = 'to.wetransform' project.ext { - haleVersion = '4.0.0' + haleVersion = '5.1.0' + groovyVersion = '2.5.19' } -version = '4.0.1-SNAPSHOT' +version = '5.1.0' /* * Dependencies @@ -36,11 +39,13 @@ version = '4.0.1-SNAPSHOT' repositories { // mavenLocal() //XXX for testing + // merge both snapshot and release repositories to virtual repository named local + // because gradle was reporting error if it encountered dependencies from snapshots + // but libs-release-local was placed before snapshots here in the hierarchy and also + // vice-versa case when dependencies were encountered from release but snapshots + // was placed before release maven { // wetransform release repository (HALE releases and Eclipse dependencies) - url 'https://artifactory.wetransform.to/artifactory/libs-release-local' - } - maven { // wetransform snapshot repository (HALE snapshots) - url 'https://artifactory.wetransform.to/artifactory/libs-snapshot-local' + url 'https://artifactory.wetransform.to/artifactory/local' } // this needs to be defined before jcenter/MavenCentral for retrieving JAI @@ -48,140 +53,137 @@ repositories { url 'https://repo.osgeo.org/repository/release/' } - maven { // HALE artifactory (dependencies for HALE) - url 'https://artifactory.wetransform.to/artifactory/ext-release-local' - } - - jcenter() + mavenCentral() } configurations { // exclude Saxon9 custom dependency by schema-utils (schematron validation) - compile.exclude group: 'org.opengis.cite.saxon', module: 'saxon9' + implementation.exclude group: 'org.opengis.cite.saxon', module: 'saxon9' } dependencies { // HALE // CLI API, utilities and default commands - compile "eu.esdihumboldt.hale:eu.esdihumboldt.util.cli:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.cli:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.cli.commands:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.util.cli:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.cli:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.cli.commands:$haleVersion" + + implementation "org.codehaus.groovy:groovy-all:$groovyVersion" // core - compile 'eu.esdihumboldt.unpuzzled:org.eclipse.equinox.nonosgi.registry:1.0.0' - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.core:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.align.groovy:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.align.merge:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.referencing:$haleVersion" + implementation 'eu.esdihumboldt.unpuzzled:org.eclipse.equinox.nonosgi.registry:1.0.0' + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.core:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.align.groovy:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.align.merge:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.referencing:$haleVersion" // transformation - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.transform:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.transform:$haleVersion" // needed to run successfully: - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.headless.orient:$haleVersion" // reiterable transformation sink (for WFS FeatureCollection) - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.propertyaccessor:$haleVersion" // for CQL filters to work + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.headless.orient:$haleVersion" // reiterable transformation sink (for WFS FeatureCollection) + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.propertyaccessor:$haleVersion" // for CQL filters to work // transformation functions: - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.core:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.inspire:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.geometric:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.groovy:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.groovy.helpers:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.numeric:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.string:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.custom:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.collector:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.core:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.inspire:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.geometric:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.groovy:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.groovy.helpers:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.numeric:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.string:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.custom:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.collector:$haleVersion" // formats - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xml:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xsd:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.gml:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.shp:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.csv:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.wfs:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.json:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xls:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.geopackage:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.html.svg:$haleVersion" - + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xml:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xsd:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.gml:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.shp:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.csv:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.wfs:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.json:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xls:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.geopackage:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.html.svg:$haleVersion" + // database support - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.postgresql:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.mssql:$haleVersion" - + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.postgresql:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.mssql:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.msaccess:$haleVersion" + // hale connect - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.haleconnect:$haleVersion" - + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.haleconnect:$haleVersion" + // code list formats - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.codelist.xml:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.codelist.xml:$haleVersion" // Schematron validation - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.schematron:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.schematron:$haleVersion" // replacement for omitted Saxon dependency // tested w/ schematron validation in https://github.com/wetransform/exp-schematron/tree/exp/saxon-he - compile 'net.sf.saxon:Saxon-HE:9.7.0-20' + implementation 'net.sf.saxon:Saxon-HE:9.7.0-20' // converters - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.convert.core:$haleVersion" - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.convert.wkt:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.convert.core:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.convert.wkt:$haleVersion" // Groovy meta extensions - compile "eu.esdihumboldt.hale:eu.esdihumboldt.util.groovy.meta.extension:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.util.groovy.meta.extension:$haleVersion" // logging - compile(group: 'eu.esdihumboldt.unpuzzled', name: 'de.fhg.igd.slf4jplus.logback.appender', version: '1.2.0.201503311443') - compile 'org.slf4j:jul-to-slf4j:1.7.21' + implementation(group: 'eu.esdihumboldt.unpuzzled', name: 'de.fhg.igd.slf4jplus.logback.appender', version: '1.2.0.201503311443') + implementation 'org.slf4j:jul-to-slf4j:1.7.21' // resource cache - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource', version: haleVersion) - def resourcesVersion = '2018.8.7' + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource', version: haleVersion) + def resourcesVersion = '2023.10.28' // OpenGIS schemas, INSPIRE schemas, W3C schemas, etc. - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.opengis.net', version: resourcesVersion) - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.inspire', version: resourcesVersion) - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.portele.de', version: resourcesVersion) - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.w3.org', version: resourcesVersion) + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.opengis.net', version: resourcesVersion) + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.inspire', version: resourcesVersion) + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.portele.de', version: resourcesVersion) + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.w3.org', version: resourcesVersion) // INSPIRE code lists and feature concepts - compile(group: 'eu.esdihumboldt.hale', + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.codelists.inspire', version: resourcesVersion) - compile(group: 'eu.esdihumboldt.hale', + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.codelists.inspire.accept-xml', version: resourcesVersion) - compile(group: 'eu.esdihumboldt.hale', + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.featureconcepts.inspire', version: resourcesVersion) - - // More resources with different version - resourcesVersion = '2020.6.29' - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.adv-online.de', version: resourcesVersion) - compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.xplanung.de', version: resourcesVersion) + // More resources + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.adv-online.de', version: resourcesVersion) + implementation(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.xplanung.de', version: resourcesVersion) // user / customer specific - compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.adv.merge:$haleVersion" + implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.adv.merge:$haleVersion" // CLI - compile 'commons-cli:commons-cli:1.3.1' + implementation 'commons-cli:commons-cli:1.5.0' // Groovy Shell - compile 'jline:jline:2.13' + implementation 'jline:jline:2.13' // Testing - testCompile 'junit:junit:4.12' - testCompile 'com.github.stefanbirkner:system-rules:1.16.0' + testImplementation 'junit:junit:4.12' + testImplementation 'com.github.stefanbirkner:system-rules:1.16.0' } configurations.all { // ensure SNAPSHOTs are updated every time if needed resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } - +def defaultJvmArgs = ['-Dcache.level1.enabled=false', + '-Dcache.level1.size=0', + '-Dcache.level2.enabled=false', + '-Dcache.level2.size=0', + '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED', + '--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED'] mainClassName = 'to.wetransform.halecli.CLI' applicationName = 'hale' -applicationDefaultJvmArgs = [ - '-Dcache.level1.enabled=false', - '-Dcache.level1.size=0', - '-Dcache.level2.enabled=false', - '-Dcache.level2.size=0' -] +applicationDefaultJvmArgs = defaultJvmArgs /* * plugin.xml and OSGi manifest @@ -193,8 +195,8 @@ applicationDefaultJvmArgs = [ */ jar { manifest { - symbolicName = 'to.wetransform.halecli;singleton:=true' - instruction 'Bundle-Vendor', 'wetransform GmbH' + attributes 'Bundle-SymbolicName': 'to.wetransform.halecli;singleton:=true', + 'Bundle-Vendor': 'wetransform GmbH' } } @@ -230,9 +232,14 @@ distributions { docker { javaApplication { - baseImage = 'openjdk:8-jre-slim' + // https://bmuschko.github.io/gradle-docker-plugin/current/user-guide/#extension_2 + // switching to jre-jammy as the use pf Alpine as the OS of the hale-cli image breaks derived images that expect Ubuntu + baseImage = 'eclipse-temurin:17-jre-jammy' maintainer = 'Simon Templer "simon@wetransform.to"' - tag = "wetransform/${project.name}:${project.version}" + images = ["wetransform/${project.name}:${project.version}", "wetransform/${project.name}:latest"] + // apply JAVA_OPTS to docker plugin as the default args configured in build does not apply to docker plugin + jvmArgs = defaultJvmArgs + } url = project.hasProperty('dockerHost') ? dockerHost : 'http://localdocker:2375' @@ -245,31 +252,14 @@ docker { } } -dockerPushImage { - // workaround for wrong image name used when pushing to docker hub - imageName = project.tasks.dockerBuildImage.getTag().split(':')[0] - tag = project.tasks.dockerBuildImage.getTag().split(':')[1] -} - -dockerDistTar { +dockerCreateDockerfile { def buildTime = java.time.ZonedDateTime.now().format(java.time.format.DateTimeFormatter.ISO_INSTANT); label('git.sha': grgit.head().id, 'git.branch': grgit.branch.current.name, 'build.version': version, 'build.time': buildTime) + instruction 'COPY hale /hale/' } -// "latest" tag - -task dockerTagLatest(type: com.bmuschko.gradle.docker.tasks.image.DockerTagImage, - dependsOn: dockerBuildImage) { - imageId = "wetransform/${project.name}:${project.version}" - repository = "wetransform/${project.name}" - tag = 'latest' -} - -task dockerPushLatest(type: com.bmuschko.gradle.docker.tasks.image.DockerPushImage, - dependsOn: dockerTagLatest) { - imageName = "wetransform/${project.name}" - tag = 'latest' -} +task dockerTagLatest(dependsOn: dockerBuildImage) {} +task dockerPushLatest(dependsOn: dockerPushImage) {} /* * Packaging and publishing @@ -292,58 +282,77 @@ dependencies { jansi 'org.fusesource.jansi:jansi:1.11' } +task dockerCopyDistResources(type: Copy) { + description "Copies the distribution resources to a temporary directory for image creation." + dependsOn installDist + from installDist.destinationDir.parentFile + into dockerCreateDockerfile.destFile.get().asFile.parentFile + exclude "**/lib/${jar.archiveFileName}" + into("app-lib") { + from jar + } +} + +tasks.dockerSyncBuildContext { + finalizedBy dockerCopyDistResources +} + +tasks.dockerBuildImage { + dependsOn dockerCopyDistResources +} + // package source into a jar file task packageSources(type: Jar) { from sourceSets.main.allSource classifier = 'sources' } -// define artifacts for upload -artifacts { - archives jar - archives packageJavadoc - archives packageSources -} - -// exclude distZip ands distTar artifacts -configurations.archives.with { - artifacts.remove artifacts.find { it.archiveTask.is distZip } - artifacts.remove artifacts.find { it.archiveTask.is distTar } -} +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact packageSources + artifact packageJavadoc + } + } -uploadArchives { repositories { - mavenDeployer { - - // upload to wetransform artifactory - repository(url: 'https://artifactory.wetransform.to/artifactory/libs-release-local') { - authentication(userName: project.hasProperty('wetfArtifactoryUser') ? wetfArtifactoryUser : '', - password: project.hasProperty('wetfArtifactoryPassword') ? wetfArtifactoryPassword : '') - } - snapshotRepository(url: 'https://artifactory.wetransform.to/artifactory/libs-snapshot-local') { - authentication(userName: project.hasProperty('wetfArtifactoryUser') ? wetfArtifactoryUser : '', - password: project.hasProperty('wetfArtifactoryPassword') ? wetfArtifactoryPassword : '') + maven { + url = project.version.endsWith('-SNAPSHOT') ? + 'https://artifactory.wetransform.to/artifactory/libs-snapshot-local' : + 'https://artifactory.wetransform.to/artifactory/libs-release-local' + credentials { + username project.hasProperty('wetfArtifactoryUser') ? wetfArtifactoryUser : '' + password project.hasProperty('wetfArtifactoryPassword') ? wetfArtifactoryPassword : '' } - } } } +// exclude distZip ands distTar artifacts +configurations.archives.with { + artifacts.remove artifacts.find { it.file == 'zip' } + artifacts.remove artifacts.find { it.file == 'tar' } +} + // Workaround for gradle application plugin 'the input line is too long' error on Windows // see https://gist.github.com/jlmelville/2bfe9277e9e2c0ff79b6 tasks.withType(CreateStartScripts).each { task -> task.doLast { - String text = task.windowsScript.text - text = text.replaceFirst(/(set CLASSPATH=%APP_HOME%\\lib\\).*/, { "${it[1]}*" }) - task.windowsScript.write text + String text = task.windowsScript.text + text = text.replaceFirst(/(set CLASSPATH=%APP_HOME%\\lib\\).*/, { "${it[1]}*" }) + task.windowsScript.write text } } +task uploadArchives { + dependsOn 'publish' +} /* * Gradle wrapper */ wrapper { - gradleVersion = '3.5' + gradleVersion = '7.6.1' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d9b7505..943f0cb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 27fc706..5083229 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew index cccdd3d..65dcd68 100755 --- a/gradlew +++ b/gradlew @@ -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,7 +132,7 @@ 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 @@ -89,84 +140,105 @@ 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" "$@" diff --git a/gradlew.bat b/gradlew.bat index f955316..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -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 diff --git a/src/main/groovy/to/wetransform/halecli/data/RewriteCommand.groovy b/src/main/groovy/to/wetransform/halecli/data/RewriteCommand.groovy index a3c1a1a..19b6ee2 100644 --- a/src/main/groovy/to/wetransform/halecli/data/RewriteCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/data/RewriteCommand.groovy @@ -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. diff --git a/src/main/groovy/to/wetransform/halecli/data/SplitCommand.groovy b/src/main/groovy/to/wetransform/halecli/data/SplitCommand.groovy index 0a57375..eca8cae 100644 --- a/src/main/groovy/to/wetransform/halecli/data/SplitCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/data/SplitCommand.groovy @@ -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. diff --git a/src/main/groovy/to/wetransform/halecli/groovy/GroovyShellCommand.groovy b/src/main/groovy/to/wetransform/halecli/groovy/GroovyShellCommand.groovy index e8e3eb7..0faa513 100644 --- a/src/main/groovy/to/wetransform/halecli/groovy/GroovyShellCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/groovy/GroovyShellCommand.groovy @@ -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. * diff --git a/src/main/groovy/to/wetransform/halecli/project/AbstractDeriveProjectCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/AbstractDeriveProjectCommand.groovy index 8c6b646..5093cd5 100644 --- a/src/main/groovy/to/wetransform/halecli/project/AbstractDeriveProjectCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/AbstractDeriveProjectCommand.groovy @@ -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. diff --git a/src/main/groovy/to/wetransform/halecli/project/ExportProjectCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/ExportProjectCommand.groovy index 1a2f517..5942bd0 100644 --- a/src/main/groovy/to/wetransform/halecli/project/ExportProjectCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/ExportProjectCommand.groovy @@ -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 diff --git a/src/main/groovy/to/wetransform/halecli/project/alignment/FilterAlignmentCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/alignment/FilterAlignmentCommand.groovy index 1cff05e..2e4d079 100644 --- a/src/main/groovy/to/wetransform/halecli/project/alignment/FilterAlignmentCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/alignment/FilterAlignmentCommand.groovy @@ -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. diff --git a/src/main/groovy/to/wetransform/halecli/project/match/MatchSchemasCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/match/MatchSchemasCommand.groovy index 490c143..c1f4f2f 100644 --- a/src/main/groovy/to/wetransform/halecli/project/match/MatchSchemasCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/match/MatchSchemasCommand.groovy @@ -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 { diff --git a/src/main/groovy/to/wetransform/halecli/project/match/postnas/PostNASSchemaMatcher.groovy b/src/main/groovy/to/wetransform/halecli/project/match/postnas/PostNASSchemaMatcher.groovy index 6429afe..e760215 100644 --- a/src/main/groovy/to/wetransform/halecli/project/match/postnas/PostNASSchemaMatcher.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/match/postnas/PostNASSchemaMatcher.groovy @@ -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 def targets = ArrayListMultimap.create() targets.put(null, target) - cell.target = targets + cell.target = targets as ListMultimap cell.transformationIdentifier = functionId diff --git a/src/main/groovy/to/wetransform/halecli/project/merge/MergeCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/merge/MergeCommand.groovy index bfc3c5c..5f52d66 100644 --- a/src/main/groovy/to/wetransform/halecli/project/merge/MergeCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/merge/MergeCommand.groovy @@ -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. diff --git a/src/main/groovy/to/wetransform/halecli/project/merge/MergeMigrator.java b/src/main/groovy/to/wetransform/halecli/project/merge/MergeMigrator.java index f2b4b59..7bfa392 100644 --- a/src/main/groovy/to/wetransform/halecli/project/merge/MergeMigrator.java +++ b/src/main/groovy/to/wetransform/halecli/project/merge/MergeMigrator.java @@ -186,13 +186,17 @@ protected Iterable 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); }); } diff --git a/src/main/groovy/to/wetransform/halecli/project/merge/MergeStatistics.groovy b/src/main/groovy/to/wetransform/halecli/project/merge/MergeStatistics.groovy index b9c2203..65644b1 100644 --- a/src/main/groovy/to/wetransform/halecli/project/merge/MergeStatistics.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/merge/MergeStatistics.groovy @@ -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 } diff --git a/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigrationCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigrationCommand.groovy index d9dcdbd..bb6d171 100644 --- a/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigrationCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigrationCommand.groovy @@ -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. * diff --git a/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigratorCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigratorCommand.groovy index 9c637ec..79aeeee 100644 --- a/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigratorCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/migrate/AbstractMigratorCommand.groovy @@ -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. diff --git a/src/main/groovy/to/wetransform/halecli/project/migrate/MigrateMatchingCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/migrate/MigrateMatchingCommand.groovy index d8b0ff1..fbe31db 100644 --- a/src/main/groovy/to/wetransform/halecli/project/migrate/MigrateMatchingCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/migrate/MigrateMatchingCommand.groovy @@ -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. * diff --git a/src/main/groovy/to/wetransform/halecli/project/migrate/ReplaceSourceCommand.groovy b/src/main/groovy/to/wetransform/halecli/project/migrate/ReplaceSourceCommand.groovy index 9d9dfe5..ea46528 100644 --- a/src/main/groovy/to/wetransform/halecli/project/migrate/ReplaceSourceCommand.groovy +++ b/src/main/groovy/to/wetransform/halecli/project/migrate/ReplaceSourceCommand.groovy @@ -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 + 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 settings, String customProvider, - TypeIndex schema, ReportHandler reports) { + TypeIndex schema, ReportHandler reports, InstanceFilterDefinition filter = null) { Pair 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 diff --git a/src/main/groovy/to/wetransform/halecli/util/ProjectCLI.groovy b/src/main/groovy/to/wetransform/halecli/util/ProjectCLI.groovy index 1b98c15..978bc94 100644 --- a/src/main/groovy/to/wetransform/halecli/util/ProjectCLI.groovy +++ b/src/main/groovy/to/wetransform/halecli/util/ProjectCLI.groovy @@ -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,7 +23,6 @@ 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 @@ -33,7 +30,12 @@ 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. diff --git a/src/main/groovy/to/wetransform/halecli/util/SchemaCLI.groovy b/src/main/groovy/to/wetransform/halecli/util/SchemaCLI.groovy index d52ba6b..3542545 100644 --- a/src/main/groovy/to/wetransform/halecli/util/SchemaCLI.groovy +++ b/src/main/groovy/to/wetransform/halecli/util/SchemaCLI.groovy @@ -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. diff --git a/src/test/groovy/to/wetransform/halecli/data/RewriteCommandTest.groovy b/src/test/groovy/to/wetransform/halecli/data/RewriteCommandTest.groovy index 00642c4..4494225 100644 --- a/src/test/groovy/to/wetransform/halecli/data/RewriteCommandTest.groovy +++ b/src/test/groovy/to/wetransform/halecli/data/RewriteCommandTest.groovy @@ -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() + } + } + } diff --git a/src/test/resources/testdata/inspire2.gml b/src/test/resources/testdata/inspire2.gml new file mode 100644 index 0000000..773067e --- /dev/null +++ b/src/test/resources/testdata/inspire2.gml @@ -0,0 +1,187 @@ + + + + + Contains Ordnance Survey data © Crown copyright and database right 2011 + + + + eng + + + + + + + + Latn + + + + + + + + + + -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 + + + + + + + _d1a6215e-3185-429f-b9b1-f160437e4f99 + _example + + + + + + + + + + + + 4.573170731707317 + 4.573170731707317 + + + + + + + Contains Ordnance Survey data © Crown copyright and database right 2011 + + + + eng + + + + + + + + Latn + + + + + + + + + + -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 + + + + + + + _d1a6215e-3185-429f-b9b1-f160437e4f99 + _example + + + + + + + + + + + + 4.573170731707317 + 4.573170731707317 + + + + + + + Contains Ordnance Survey data © Crown copyright and database right 2011 + + + + eng + + + + + + + + Latn + + + + + + + + + + -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 + + + + + + + _d1a6215e-3185-429f-b9b1-f160437e4f99 + _example + + + + + + + + + + + + 4.573170731707317 + 4.573170731707317 + + + + + + + + + + + + + + + + some water + + + + + + + + + + SW1 + some value + + + + + + + + + + + +