Skip to content

Commit c85514f

Browse files
authored
Merge pull request #1 from protegeproject/add_entity_status_to_class_data
Added EntityStatus to OWLClassData. fixed github workflows.
2 parents 03dabdf + 86c88b6 commit c85514f

File tree

5 files changed

+122
-43
lines changed

5 files changed

+122
-43
lines changed

.github/workflows/ci.yaml

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

3-
on: [push]
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
- main-who
48

59
jobs:
610
build:
711
runs-on: ubuntu-latest
812

913
steps:
1014
- uses: actions/checkout@v3
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
1117
- name: Set up JDK 17
1218
uses: actions/setup-java@v3
1319
with:
1420
java-version: '17'
15-
distribution: 'temurin'
21+
distribution: 'adopt'
1622
- name: Build with Maven
17-
run: mvn --batch-mode --update-snapshots package
23+
run: mvn --batch-mode package

.github/workflows/pub.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/release.yaml

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

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.11</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)