Skip to content

build: make the Enterprise Architect module optional via the 'ea' profile - #1

Open
jdsika wants to merge 5 commits into
nextfrom
build/optional-ea-module
Open

build: make the Enterprise Architect module optional via the 'ea' profile#1
jdsika wants to merge 5 commits into
nextfrom
build/optional-ea-module

Conversation

@jdsika

@jdsika jdsika commented Jul 30, 2026

Copy link
Copy Markdown

Draft for internal review in this fork, not yet proposed upstream. Targeted at next
here so the approach can be agreed before anything goes to ShapeChange/ShapeChange.
Both build paths are now verified — see Verification.

Problem

shapechange-app declares a compile-scope dependency on shapechange-ea, which compiles
against org.sparx:eaapi. That artifact ships inside an Enterprise Architect installation
and is on no public repository, so a machine or CI runner without EA cannot build the app
module at all
:

Could not resolve dependencies for project net.shapechange:shapechange-ea:jar:4.1.0-SNAPSHOT
dependency: org.sparx:eaapi:jar:17.0.1704 (compile)
Could not find artifact org.sparx:eaapi:jar:17.0.1704 in central

This blocks contributors and any CI for input types that have nothing to do with EA — SCXML
in particular, which is the path this project's own updateOrCreateScxmlResources mechanism
exists to enable.

Why the code doesn't need it

The architecture already treats EA as pluggable. DefaultModelProvider resolves the model
reader by class name:

} else if (modelTypeIn.equalsIgnoreCase("ea7")) {
    modelType = "de.interactive_instruments.shapechange.ea.model.EADocument";
...
theClass = Class.forName(modelType);

SqlDdl does the same for DatabaseModelWriterEA. Neither shapechange-core nor
shapechange-app holds a compile-time reference to any EA type — shapechange-app is a
single source file (Main.java) with no org.sparx import anywhere. Only the Maven
wiring forces EA on everyone.

Change

  • Root POMshapechange-ea moves into an ea profile, activated by the absence of
    the skipEa property, so the default reactor is byte-for-byte the same as before.
  • shapechange-app/pom.xml — the shapechange-ea dependency and the EA-only resource
    copy move into the same profile.
  • BasicTest — the single EA type in the test sources (EAModelDiff, used by the
    private similarEaRepo helper for .qea comparisons) is resolved by class name, mirroring
    how the main code loads EA classes. Without the module those comparisons now fail with a
    message naming the cause, instead of the whole test tree failing to compile.

mvn -DskipEa … produces a distribution supporting every non-EA input type (SCXML, XMI,
GCSR). Selecting inputModelType=EA7 in such a build fails at model load, where the lookup
happens.

Verification

Ubuntu 24.04 (WSL2), OpenJDK 21.0.11, Maven 3.9.16 — run both with Enterprise Architect
17 installed (its eaapi.jar registered locally via install:install-file) and without it:

Check Default (EA) -DskipEa
Reactor 4 modules, incl. shapechange-ea — unchanged ShapeChange, shapechange-core, shapechange-app
mvn install SUCCESS (all three modules) SUCCESS
OntologyTest#testQualifiedCardinalityRestrictions 1 run, 0 failures 1 run, 0 failures
Full suite 255 run, 14 failures, 78 errors, 34 skipped identical: 255 / 14 / 78 / 34

The full-suite numbers are the same on both paths, so this change alters no test outcome.

The regression-test row matters beyond this PR: it backs ShapeChange#756, and without this
change that command cannot be executed at all on a machine without EA.

Accounting for every failure, on both paths

Cause Count Evidence
Pre-existing Saxon test-classpath exclusion in this module's surefire config (classpathDependencyExcludesnet.sf.saxon:Saxon-HE) 78 errors + 12 failures With the exclusion lifted: CodelistsTest 3/3, FeatureCatalogueTest 16/16, OutputProcessingTest 2/2 pass
External sqldiff binary absent 2 failures Cannot run program "sqldiff" in the GeoPackage tests
This change 0 Identical counts with and without EA

The skipped tests

34 tests skip, the same classes on both paths, including the EA-backed ones
(TaggedValueEaInputTransformerTest, SQLDatabaseModelTest, UmlModelTest,
ArcGISWorkspaceTest). EA's native COM layer is not reachable from a Linux JVM, so they
skip whether or not the module is built — no EA test starts failing silently under
-DskipEa. A reviewer on Windows with EA should confirm those still run there.

Noted, deliberately not fixed here

The Saxon exclusion makes every XSLT-producing target fail under mvn test, with or without
EA. That looks worth a separate look; it is out of scope for this change and untouched.

jdsika and others added 4 commits July 29, 2026 15:44
…rictions

The OWLISO19150 ontology target emitted owl:onClass for every qualified
cardinality restriction, including restrictions on datatype properties.

Per the W3C OWL 2 specification, a qualified cardinality restriction on a
data property MUST use owl:onDataRange pointing at a data range
(Structural Specification and Functional-Style Syntax, Sec. 8.5 "Data
Property Cardinality Restrictions"; Mapping to RDF Graphs, Sec. 3.2).
owl:onClass is reserved for object property cardinality restrictions
(Sec. 8.3). Emitting owl:onClass with an XSD datatype (e.g.
`owl:onClass xsd:double`) is invalid OWL 2 DL and breaks OWL reasoners
and downstream OWL-to-SHACL tooling.

createQCardinalityRestriction, createQMinCardinalityRestriction and
createQMaxCardinalityRestriction now select the linking predicate via a
new helper, qualifiedRestrictionOnPredicate(p), which returns
owl:onDataRange for datatype properties and owl:onClass for object
properties.

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
Adds a pure SCXML integration test (no Enterprise Architect model
required) covering rule-owl-prop-multiplicityAsQualifiedCardinalityRestriction:

- datatype properties with exact/min/max qualified cardinality use
  owl:onDataRange (xsd:double, xsd:integer)
- object properties use owl:onClass

The reference model is verified against the fixed OntologyModel. Without
the fix the test fails, because owl:onClass is emitted for XSD datatypes
(invalid OWL 2 DL).

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
…CXML

Replace the hand-written SCXML model of the qualifiedCardinalityRestrictions
integration test with an Enterprise Architect repository as the original model,
plus the SCXML resources derived from it via the standard mechanism
(updateOrCreateScxmlResources=true), as requested in the review of PR ShapeChange#756.

- Add test_qualifiedCardinalityRestrictions.qea: minimal EA model (Test Schema
  with Road/Lane feature types) exercising both branches of
  rule-owl-prop-multiplicityAsQualifiedCardinalityRestriction: datatype
  properties (length Real[1], width Real[1..*], speedLimit Integer[0..1]) ->
  owl:onDataRange, and the object property (lane Lane[1]) -> owl:onClass.
- Add the EA-derived SCXML resources (test_qualifiedCardinalityRestrictions.zip)
  and the derived testEA_..._runWithSCXML.xml configuration.
- Add the original EA configuration testEA_owl_qualifiedCardinalityRestrictions.xml
  (inputModelType=EA7) and point OntologyTest at it.
- Remove the previous hand-written scxml.xml and testSCXML_... configuration.

The reference OWL output is unchanged, so the EA-derived model reproduces the
exact expected result; the test still runs on 64bit Java without EA using the
committed SCXML resources.

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
…dinality-ondatarange

fix(owl): use owl:onDataRange for datatype qualified cardinality restrictions
@jdsika
jdsika force-pushed the build/optional-ea-module branch from f5ccfb7 to 8030540 Compare July 30, 2026 09:06
…file

shapechange-app declares a compile-scope dependency on shapechange-ea, which
compiles against org.sparx:eaapi. That artifact ships inside an Enterprise
Architect installation and is on no public repository, so a machine or CI runner
without EA cannot build the app module at all:

    Could not resolve dependencies for project net.shapechange:shapechange-ea
    dependency: org.sparx:eaapi:jar:17.0.1704 (compile)
    Could not find artifact org.sparx:eaapi:jar:17.0.1704 in central

The code does not need it. DefaultModelProvider resolves the EA model reader by
class name (Class.forName("...shapechange.ea.model.EADocument")) and SqlDdl does
the same for DatabaseModelWriterEA, so shapechange-core and shapechange-app hold
no compile-time reference to any EA type - only the Maven wiring forces it.

- Root POM: shapechange-ea moves into an 'ea' profile, activated by the absence
  of the skipEa property, so the default reactor is exactly as before.
- shapechange-app: the shapechange-ea dependency and the EA-only resource copy
  move into the same profile.
- BasicTest: the one EA type in the test sources, EAModelDiff, is resolved by
  class name in the private similarEaRepo helper, mirroring how the main code
  loads EA classes. Only .qea comparisons touch it, and without the module they
  now fail with a message naming the cause instead of failing to compile.

Building with -DskipEa yields a distribution supporting every non-EA input type
(SCXML, XMI, GCSR). Selecting inputModelType=EA7 in such a build fails at model
load, where the class is looked up.

Verified on Ubuntu 24.04 (WSL2), OpenJDK 21.0.11, Maven 3.9.16, against both
paths - with Enterprise Architect 17 installed and its eaapi.jar registered in
the local repository, and without it:

- default: reactor unchanged, four modules; mvn install builds shapechange-core,
  shapechange-ea and shapechange-app successfully
- -DskipEa: reactor is ShapeChange, shapechange-core, shapechange-app; builds
- the OWL regression test passes on both paths:
      mvn [-DskipEa] -pl shapechange-app -am \
          -Dtest=OntologyTest#testQualifiedCardinalityRestrictions test
  Tests run: 1, Failures: 0, Errors: 0. Without this change that command cannot
  run at all on a machine without EA.
- full suite, both paths: Tests run: 255, Failures: 14, Errors: 78, Skipped: 34.
  Identical numbers with and without EA, so this change alters no test outcome.

None of those 92 failures relates to this change, and all are EA-independent:

- 78 errors and 12 failures come from the unconditional Saxon exclusion in this
  module's surefire configuration (classpathDependencyExcludes,
  net.sf.saxon:Saxon-HE). Lifting it makes CodelistsTest 3/3,
  FeatureCatalogueTest 16/16 and OutputProcessingTest 2/2 pass.
- 2 failures are GeoPackage tests needing the external sqldiff binary, absent
  here.

The 34 skipped tests are the same classes on both paths, the EA-backed ones
among them (TaggedValueEaInputTransformerTest, SQLDatabaseModelTest,
UmlModelTest, ArcGISWorkspaceTest): EA's native COM layer is not reachable from
a Linux JVM, so they skip whether or not the module is built. No EA test starts
failing silently under -DskipEa.

Out of scope, but noted while testing: the Saxon exclusion makes any
XSLT-producing target fail under mvn test, with or without EA. Worth a separate
look; deliberately not touched here.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@jdsika
jdsika force-pushed the build/optional-ea-module branch from 8030540 to 093d03e Compare July 30, 2026 11:07
@jdsika

jdsika commented Jul 30, 2026

Copy link
Copy Markdown
Author

Filed upstream as ShapeChange#757, rebased onto current upstream/next so it is a single commit on a current base (ShapeChange#756 having landed in the meantime). Both paths were re-verified on the rebased commit before filing — default (EA installed): all three modules build, regression test green; -DskipEa: two modules build, same test green; full suite identical on both paths (255/14/78/34).

Keeping this fork PR open as the internal record until ShapeChange#757 is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants