Skip to content

Commit

Permalink
Enable java class generation from newest ontologies (#21)
Browse files Browse the repository at this point in the history
* All java POJOs for DataModel, API and CoreCodeLists are now generated on build
  • Loading branch information
kSchmengler authored May 14, 2024
1 parent 7a474df commit 7a9425d
Show file tree
Hide file tree
Showing 9 changed files with 21,637 additions and 47 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ jobs:
uses: actions/checkout@v4

- name: Set up JDK with Dependency Caching
id: java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
java-version: '21'
cache: 'maven'

- name: execute a keytool import function
shell: bash
run: sudo keytool -importcert -noprompt -trustcacerts -v -alias onerecord -file src/main/resources/onerecord.iata.org.cer -keystore ${{ steps.java.outputs.path }}/lib/security/cacerts -storepass changeit

- name: Build and test
run: ./mvnw clean package
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
java-version: '21'
cache: 'maven'

- name: Get tag version
Expand Down
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository contains **Java POJO classes for IATA ONE Record** (1R) data mod
official IATA Ontology on GitHub at https://github.com/IATA-Cargo/ONE-Record.

Note that the deliverable of this project contains POJO classes from the
Ontologies for "Data-Model" _only_, excluding the "API" part.
Ontologies for "Data-Model", "API" and the "CoreCodeLists" part.

### Codelists and Utility
This repository additionally contains some assisting classes e.g.,
Expand Down Expand Up @@ -36,24 +36,17 @@ is not published on Maven Central Repository.

### Related projects

See also https://github.com/riege/one-record-ontologymodel, a predecessor of
this repository, which covers DataModel- plus API-Ontology.
<br>
Public projects like [IATA one-record-server-java](https://github.com/IATA-Cargo/one-record-server-java)
or [NE:ONE ONE Record server](https://git.openlogisticsfoundation.org/digital-air-cargo/ne-one)
use similar approaches with embedded Java POJOs.

### Comparison [one-record-ontologydatamodel](https://github.com/riege/one-record-ontologydatamodel) and [one-record-ontologymodel](https://github.com/riege/one-record-ontologymodel)

| | [one-record-ontologydatamodel](https://github.com/riege/one-record-ontologydatamodel) | [one-record-ontologymodel](https://github.com/riege/one-record-ontologymodel) |
|----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Ontology 1.1 / 2021-June](https://github.com/IATA-Cargo/ONE-Record/tree/master/June-2021-standard-COTB-endorsed) | not available (Note 1) | Yes (Release 1.1.x) |
| [Ontology 2.0 / 2022-May](https://github.com/IATA-Cargo/ONE-Record/tree/master/May-2022-standard-forCOTBendorsement) | not available (Note 1) | Yes (Release 2.0.x) |
| [Ontology 2.1 / 2022-December](https://github.com/IATA-Cargo/ONE-Record/tree/master/December-2022-standard) | Yes | not available |
| Scope | DataModel Ontology only | API + DataModel Ontology |
| 3rd party Java annotations | none (clean API) | [Jackson](https://github.com/FasterXML/jackson), [Swagger IO](https://github.com/swagger-api/swagger.io), [Spring Framework](https://github.com/spring-projects/spring-framework) |
### Versioning

Note 1: Not released but can be build manually by replacing Ontology file and building manually within project.
Since we aim to keep the version numbers in relation to the used ontology version we decided to use a slightly different pattern for the versioning.
The most recent version of the DataModel Ontology is: **3.0.0** (as of 07-05-2024). The next release of this project will therefore get the version: **3.0.0000**.
An internal bugfix would then result in the release version **3.0.0001** and if a new ontology is used e.g. version **3.0.1** for the DataModel,
this would then result in the release of **3.0.1000**.

### Building

Expand All @@ -73,20 +66,25 @@ which will generate `target/one-record-cargo-1.2.3.jar`

### Generation from (a new) Ontology

Updating with a new Ontology works by updating content in directory `src/main/resources`, the TTL file and adopt the `mapping` file.
Updating with a new Ontology works by updating content in directory `src/main/resources`. Please replace the TTL file(s) and adopt the `mapping` file.

## Used Ontology / Data model version

In general, the official IATA Ontology determines the 1R data model. The IATA Ontology is available in various versions at GitHub.
The IATA [Cargo Operations and Technology Board, COTB](https://www.iata.org/en/programs/workgroups/cotb)
approved various Ontology versions.

This project aims to keep its releases and versioning in synchronization with the IATA Ontologies, starting with IATA ONE Record Ontology version 2.1.
<!--
| IATA Ontology version / endorsement | ONE.Record Ontology-Model Library version |
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------|
| 2.1.x / [2022-Dec](https://github.com/IATA-Cargo/ONE-Record/tree/master/December-2022-standard) | 2.1.x see [2.1.3](../../releases/tag/2.1.3) |
-->
This project aims to keep its releases and versioning in synchronization with the IATA Ontologies, starting with IATA ONE Record Ontology versions:

DataModel: 3.0.0 (as of 03-11-2023)

API: 2.0.0 (as of 02-05-2023)

CoreCodeLists: 1.0.0 (as of 23-10-2023)

### Older releases of this project

[Ontology 2.1 / 2022-December](https://github.com/IATA-Cargo/ONE-Record/tree/master/2022-12-standard) - Release version: 0.2.5, contains DataModel classes only! Used ontology version: 2.1.3 (as of 01-03-2023)

## Question and Feedback

Expand Down
53 changes: 29 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@
based on (https://github.com/IATA-Cargo/ONE-Record).
</description>
<properties>
<revision>1.0.0-SNAPSHOT</revision>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<cz.cvut.kbss.jopa.version>0.22.2</cz.cvut.kbss.jopa.version>
<revision>3.0.0000-SNAPSHOT</revision>
<cz.cvut.kbss.jopa.version>1.2.2</cz.cvut.kbss.jopa.version>
</properties>
<dependencies>
<dependency>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-maven-plugin</artifactId>
<version>${cz.cvut.kbss.jopa.version}</version>
<!-- only used internally, not require when this jar is used -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>ontodriver-rdf4j</artifactId>
<version>${cz.cvut.kbss.jopa.version}</version>
</dependency>
<dependency>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-api</artifactId>
Expand All @@ -49,13 +51,15 @@
<excludes>
<exclude>*.ttl</exclude>
<exclude>mapping</exclude>
<exclude>*.cer</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -73,18 +77,19 @@
<configuration>
<mapping-file>${project.basedir}/src/main/resources/mapping</mapping-file>
<output-directory>${project.build.directory}/generated-sources</output-directory>
<vocabulary-only>false</vocabulary-only>
<package>org.iata.onerecord.cargo</package>
</configuration>
<executions>
<execution>
<id>id_for_cargo_ontology</id>
<id>CARGO</id>
<phase>generate-sources</phase>
<goals>
<goal>owl2java-transform</goal>
</goals>
<configuration>
<package>org.iata.onerecord.cargo</package>
<ontology-iri>https://onerecord.iata.org/cargo</ontology-iri>
<ontology-iri>https://onerecord.iata.org/ns/cargo/ontology.ttl</ontology-iri>
<ignore-failed-imports>true</ignore-failed-imports>
<!-- config options are :
String mapping-file - see above
String package - see above
Expand All @@ -101,30 +106,30 @@
-->
</configuration>
</execution>
<!--
API model is a bit broken because there is
https://onerecord.iata.org/api/Branch
https://onerecord.iata.org/api/Company
plus
https://onerecord.iata.org/Branch
https://onerecord.iata.org/Company
which causes 2 toString methods to be produced... WTF?
<execution>
<id>we_need_an_id_this_is_api</id>
<id>API</id>
<phase>generate-sources</phase>
<goals>
<goal>owl2java-transform</goal>
</goals>
<configuration>
<package>org.iata.onerecord.api</package>
<ontology-iri>https://onerecord.iata.org/ns/api/ontology.ttl</ontology-iri>
<ignore-failed-imports>true</ignore-failed-imports>
</configuration>
</execution>
<execution>
<id>CoreCodeLists</id>
<phase>generate-sources</phase>
<goals>
<goal>owl2java-transform</goal>
</goals>
<configuration>
<package>org.iata.onerecord.api</package>
<ontology-iri>https://onerecord.iata.org/api</ontology-iri>
<package>org.iata.onerecord.ccl</package>
<ontology-iri>https://onerecord.iata.org/ns/coreCodeLists/ontology.ttl</ontology-iri>
<ignore-failed-imports>true</ignore-failed-imports>
</configuration>
</execution>
-->
</executions>
</plugin>
<!-- Add generated sources to classpath for maven -->
Expand Down
Loading

0 comments on commit 7a9425d

Please sign in to comment.