Skip to content

Commit

Permalink
Merge pull request #57 from kbss-cvut/development
Browse files Browse the repository at this point in the history
[0.13.0] Release
  • Loading branch information
ledsoft authored Jul 31, 2023
2 parents 009ffcb + 8528f91 commit 1d680ed
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
java-version: '11'
- name: Build with Maven
run: mvn -B package --file pom.xml
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# JB4JSON-LD Changelog

## 0.13.0 - 2023-07-31
- Make `BeanAnnotationProcessor.getAncestors` public.
- **Breaking change:** Set Java 11 as minimum Java version.

## 0.12.3 - 2023-04-06
- Support serializing individuals as string with an extended term definition in context (Enhancement #54).
- Fix serialization of types when parent context specifies term mapping.
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cz.cvut.kbss.jsonld</groupId>
<artifactId>jb4jsonld</artifactId>
<version>0.12.3</version>
<version>0.13.0</version>
<name>JB4JSON-LD</name>
<description>Java Binding for JSON-LD allows serialization and deserialization of Java POJOs to/from JSON-LD.
This is the core implementation, which has to be integrated with Jackson, Jersey etc.
Expand All @@ -15,16 +15,16 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

<cz.cvut.kbss.jopa.version>0.21.0</cz.cvut.kbss.jopa.version>
<cz.cvut.kbss.jopa.version>1.1.0</cz.cvut.kbss.jopa.version>

<com.github.jsonld-java.version>0.13.4</com.github.jsonld-java.version>
<org.junit.jupiter.version>5.9.2</org.junit.jupiter.version>
<org.mockito.version>4.11.0</org.mockito.version>
<ch.qos.logback.version>1.3.5</ch.qos.logback.version>
<org.eclipse.rdf4j.version>3.7.7</org.eclipse.rdf4j.version>
<org.eclipse.rdf4j.version>4.3.4</org.eclipse.rdf4j.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -87,13 +87,13 @@
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-model</artifactId>
<version>3.7.7</version>
<version>${org.eclipse.rdf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-rio-jsonld</artifactId>
<version>3.7.7</version>
<version>${org.eclipse.rdf4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public static String getOwlClass(Class<?> cls) {
}

/**
* Attempts to expand the specified IRI in case it is compacted (see {@link IdentifierUtil#isCompactIri(String)}) using JOPA namespace declarations.
* Attempts to expand the specified IRI in case it is compacted (see {@link IdentifierUtil#isCompactIri(String)})
* using JOPA namespace declarations.
* <p>
* If the IRI is not compact or no matching namespace is found, the original IRI is returned.
*
Expand All @@ -92,10 +93,12 @@ public static String expandIriIfNecessary(String iri, Class<?> declaringClass) {
}

/**
* Attempts to expand the specified compact IRI by finding a corresponding {@link Namespace} annotation in the specified class's ancestor hierarchy.
* Attempts to expand the specified compact IRI by finding a corresponding {@link Namespace} annotation in the
* specified class's ancestor hierarchy.
* <p>
* That is, it tries to find a {@link Namespace} annotation with matching prefix on the specified class or any of its ancestors. If such an annotation
* is found, its namespace is concatenated with the suffix from the specified {@code iri} to produce the expanded version of the IRI.
* That is, it tries to find a {@link Namespace} annotation with matching prefix on the specified class or any of
* its ancestors. If such an annotation is found, its namespace is concatenated with the suffix from the specified
* {@code iri} to produce the expanded version of the IRI.
* <p>
* If no matching {@link Namespace} annotation is found, an empty {@link Optional} is returned.
*
Expand Down Expand Up @@ -172,7 +175,15 @@ public static Set<String> getOwlClasses(Class<?> cls) {
return classes;
}

private static List<Class<?>> getAncestors(Class<?> cls) {
/**
* Resolves ancestors of the specified class, up to {@link Object}.
* <p>
* Ancestors are resolved using the {@link Class#getSuperclass()} method.
*
* @param cls Class whose ancestors to resolve
* @return List of ancestors, including the specified class
*/
public static List<Class<?>> getAncestors(Class<?> cls) {
final List<Class<?>> classes = new ArrayList<>();
Class<?> current = cls;
while (current != null && !current.equals(Object.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,6 @@ public static boolean isIndividualType(Class<?> cls) {
* @see PersistenceProperties#IDENTIFIER_TYPES
*/
public static boolean isIdentifierType(Class<?> cls) {
return PersistenceProperties.IDENTIFIER_TYPES.contains(cls);
return cls != null && PersistenceProperties.IDENTIFIER_TYPES.contains(cls);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public void processClasses(String scanPath) {
Enumeration<URL> resources = loader.getResources(".");
while (resources.hasMoreElements()) {
URL resourceURL = resources.nextElement();
if (isJar(resourceURL.toString()))
processJarFile(resourceURL, scanPath);
if (isJar(resourceURL.toString())) {processJarFile(resourceURL, scanPath);}
}
} catch (IOException e) {
throw new JsonLdException("Unable to scan packages.", e);
Expand Down Expand Up @@ -140,8 +139,9 @@ private void processClass(String className) {
try {
final Class<?> cls = Class.forName(className);
listener.accept(cls);
} catch (ClassNotFoundException | NoClassDefFoundError e) {
LOG.error("Unable to process class " + className, e);
} catch (Throwable e) {
LOG.debug("Skipping non-loadable class {}, got error {}: {}.", className, e.getClass()
.getName(), e.getMessage());
}
}

Expand Down

0 comments on commit 1d680ed

Please sign in to comment.