Skip to content

Commit d351764

Browse files
committed
[who-icatx/icatx-project#67]: Added EntityStatus to OWLClassData. fixed github workflows.
1 parent 03dabdf commit d351764

File tree

4 files changed

+107
-30
lines changed

4 files changed

+107
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
name: Java CI
1+
name: Verify
22

3-
on: [push]
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
47

58
jobs:
69
build:
710
runs-on: ubuntu-latest
811

912
steps:
1013
- uses: actions/checkout@v3
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}
1116
- name: Set up JDK 17
1217
uses: actions/setup-java@v3
1318
with:
1419
java-version: '17'
15-
distribution: 'temurin'
20+
distribution: 'adopt'
1621
- name: Build with Maven
17-
run: mvn --batch-mode --update-snapshots package
22+
run: mvn --batch-mode package

.github/workflows/pub.yaml

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,84 @@
1-
name: Publish package to the Maven Central Repository
1+
name: Release
2+
23
on:
3-
release:
4-
types: [released]
4+
push:
5+
branches:
6+
- main
7+
- main-who
58

69
jobs:
7-
publish:
10+
build:
811
runs-on: ubuntu-latest
12+
if: ${{ github.actor != 'protegeproject-bot[bot]' }}
913
steps:
1014
- uses: actions/checkout@v3
15+
1116
- name: Set up Maven Central Repository
1217
uses: actions/setup-java@v3
1318
with:
1419
java-version: '17'
1520
distribution: 'adopt'
1621
server-id: ossrh
17-
server-username: OSSRH_USERNAME
18-
server-password: OSSRH_TOKEN
19-
gpg-private-key: ${{secrets.GPG_PRIVATE_KEY}}
20-
gpg-passphrase: GPG_PASSPHRASE
21-
- name: Publish package
22-
run: mvn --batch-mode -Prelease deploy
22+
server-username: ${{ secrets.OSSRH_USERNAME }}
23+
server-password: ${{ secrets.OSSRH_TOKEN }}
24+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
25+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
26+
27+
- name: Get current version
28+
id: get-version
29+
run: |
30+
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
31+
echo "Current version: $current_version"
32+
echo "::set-output name=current_version::$current_version"
33+
34+
- name: Bump version
35+
id: bump
36+
run: |
37+
current_version=${{ steps.get-version.outputs.current_version }}
38+
branch=${GITHUB_REF##*/}
39+
echo "Current branch: $branch"
40+
41+
# Extract the base version without any suffix
42+
base_version=$(echo $current_version | sed -E 's/(-.*)?$//')
43+
44+
# Increment the patch version (assuming semantic versioning: major.minor.patch)
45+
IFS='.' read -r -a version_parts <<< "$base_version"
46+
version_parts[2]=$((version_parts[2] + 1))
47+
new_base_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
48+
49+
if [[ "$branch" == "main-who" ]]; then
50+
new_version="${new_base_version}-who"
51+
else
52+
new_version="$new_base_version"
53+
fi
54+
55+
echo "New version: $new_version"
56+
mvn versions:set -DnewVersion=$new_version -DgenerateBackupPoms=false
57+
echo "::set-output name=new_version::$new_version"
58+
59+
- name: Commit new version
60+
run: |
61+
git config --global user.name "github-actions[bot]"
62+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
63+
git add pom.xml
64+
git commit -m "Bump version to ${{ steps.bump.outputs.new_version }}"
65+
git tag ${{ steps.bump.outputs.new_version }}
66+
git push origin HEAD:${GITHUB_REF##*/}
67+
git push origin ${{ steps.bump.outputs.new_version }}
68+
69+
- name: Build and Publish package
70+
run: mvn --batch-mode package install
71+
72+
- name: Release
73+
uses: softprops/action-gh-release@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
tag_name: ${{ steps.bump.outputs.new_version }}
78+
generate_release_notes: true
79+
2380
env:
24-
GPG_PASSPHRASE: ${{secrets.GPG_PASSPHRASE}}
25-
OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}}
26-
OSSRH_TOKEN: ${{secrets.OSSRH_TOKEN}}
81+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
82+
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
83+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
84+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>edu.stanford.protege</groupId>
1212
<artifactId>webprotege-entity-data</artifactId>
13-
<version>0.9.4-SNAPSHOT</version>
13+
<version>0.9.4</version>
1414
<name>webprotege-entity-data</name>
1515
<properties>
1616
<java.version>16</java.version>
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>edu.stanford.protege</groupId>
4242
<artifactId>webprotege-common</artifactId>
43-
<version>0.9.4</version>
43+
<version>0.9.7</version>
4444
</dependency>
4545
<dependency>
4646
<groupId>edu.stanford.protege</groupId>

src/main/java/edu/stanford/protege/webprotege/entity/OWLClassData.java

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
import com.fasterxml.jackson.annotation.JsonProperty;
66
import com.fasterxml.jackson.annotation.JsonTypeName;
77
import com.google.auto.value.AutoValue;
8-
import com.google.common.collect.ImmutableList;
9-
import com.google.common.collect.ImmutableMap;
10-
import edu.stanford.protege.webprotege.common.DictionaryLanguage;
11-
import edu.stanford.protege.webprotege.common.ShortForm;
8+
import com.google.common.collect.*;
9+
import edu.stanford.protege.webprotege.common.*;
1210
import org.semanticweb.owlapi.model.IRI;
1311
import org.semanticweb.owlapi.model.OWLClass;
1412
import org.semanticweb.owlapi.model.OWLEntityVisitorEx;
@@ -32,19 +30,27 @@ public abstract class OWLClassData extends OWLEntityData {
3230

3331
public static OWLClassData get(@Nonnull OWLClass cls,
3432
@Nonnull ImmutableMap<DictionaryLanguage, String> shortForms) {
35-
return get(cls, shortForms, false);
33+
return get(cls, shortForms, false, ImmutableSet.of());
3634
}
3735

3836
public static OWLClassData get(@Nonnull OWLClass cls,
3937
@Nonnull ImmutableMap<DictionaryLanguage, String> shortForms,
4038
boolean deprecated) {
41-
return get(cls, toShortFormList(shortForms), deprecated);
39+
return get(cls, toShortFormList(shortForms), deprecated, ImmutableSet.of());
40+
}
41+
42+
public static OWLClassData get(@Nonnull OWLClass cls,
43+
@Nonnull ImmutableMap<DictionaryLanguage, String> shortForms,
44+
boolean deprecated,
45+
ImmutableSet<EntityStatus> statuses) {
46+
return get(cls, toShortFormList(shortForms), deprecated, statuses);
4247
}
4348

4449
public static OWLClassData get(@JsonProperty("entity") @Nonnull OWLClass cls,
4550
@JsonProperty("shortForms") @Nonnull ImmutableList<ShortForm> shortForms,
46-
@JsonProperty("deprecated") boolean deprecated) {
47-
return new AutoValue_OWLClassData(shortForms, deprecated, cls);
51+
@JsonProperty("deprecated") boolean deprecated,
52+
@JsonProperty("statuses") ImmutableSet<EntityStatus> statuses) {
53+
return new AutoValue_OWLClassData(shortForms, deprecated, cls, statuses);
4854
}
4955

5056
/**
@@ -56,9 +62,14 @@ public static OWLClassData get(@JsonProperty("entity") @Nonnull OWLClass cls,
5662
*/
5763
@JsonCreator
5864
protected static OWLClassData get(@JsonProperty("iri") @Nonnull String iri,
59-
@JsonProperty(value = "shortForms") @Nullable ImmutableList<ShortForm> shortForms,
60-
@JsonProperty("deprecated") boolean deprecated) {
61-
return new AutoValue_OWLClassData(Objects.requireNonNullElse(shortForms, ImmutableList.of()), deprecated, new OWLClassImpl(IRI.create(iri)));
65+
@JsonProperty(value = "shortForms") @Nullable ImmutableList<ShortForm> shortForms,
66+
@JsonProperty("deprecated") boolean deprecated,
67+
@JsonProperty("statuses") ImmutableSet<EntityStatus> statuses) {
68+
return new AutoValue_OWLClassData(
69+
Objects.requireNonNullElse(shortForms, ImmutableList.of()),
70+
deprecated,
71+
new OWLClassImpl(IRI.create(iri)),
72+
Objects.requireNonNullElse(statuses, ImmutableSet.of()));
6273
}
6374

6475
@JsonIgnore
@@ -85,6 +96,9 @@ public PrimitiveType getType() {
8596
return PrimitiveType.CLASS;
8697
}
8798

99+
@Nonnull
100+
public abstract ImmutableSet<EntityStatus> getStatuses();
101+
88102
@Override
89103
public <R, E extends Throwable> R accept(OWLPrimitiveDataVisitor<R, E> visitor) throws E {
90104
return visitor.visit(this);

0 commit comments

Comments
 (0)