Skip to content

Commit

Permalink
Merge pull request #201 from kbss-cvut/development
Browse files Browse the repository at this point in the history
[1.1.2] Release
  • Loading branch information
ledsoft authored Sep 14, 2023
2 parents 28a9fcb + 6378158 commit 0f29d62
Show file tree
Hide file tree
Showing 27 changed files with 320 additions and 159 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# JOPA - Change Log

## 1.1.2 - 2023-09-14
- Fix missing processing of connection pool configuration in RDF4J driver.
- Disambiguate classes of the same name in OWL2Java using a default suffix (Bug #199).
- Modify JOPA Maven plugin parameter mapping so that it does not confuse IDEs (GH #198).
- Provide access to entity class namespace detection (Enhancement #196).
- Dependency updates: RDf4J 4.3.6.

## 1.1.1 - 2023-08-23
- Fix a possible deadlock in case RDF4J's HTTP client connection pool is exhausted by concurrent requests (Bug #191).
- Introduce a marker `@Property` annotation used on all OWL property mapping annotations.
Expand Down
2 changes: 1 addition & 1 deletion datatype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jopa-all</artifactId>
<groupId>cz.cvut.kbss.jopa</groupId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jopa-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public @interface OWLClass {

/**
* IIR of the ontological class
* IRI of the ontological class
*
* @return IRI of the referenced class
*/
Expand Down
2 changes: 1 addition & 1 deletion jopa-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jopa-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
/**
* Copyright (C) 2023 Czech Technical University in Prague
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
* <p>
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package cz.cvut.kbss.jopa.model.metamodel;

Expand All @@ -25,13 +23,14 @@
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

/**
* Utility methods for processing managed types for metamodel construction.
*/
class ManagedClassProcessor {
public class ManagedClassProcessor {

private ManagedClassProcessor() {
throw new AssertionError();
Expand All @@ -50,13 +49,42 @@ static <T> TypeBuilderContext<T> processManagedType(Class<T> cls) {
return new TypeBuilderContext<>(type, resolver);
}

private static <T> NamespaceResolver detectNamespaces(Class<T> cls) {
/**
* Detects namespace declarations relevant to the specified class.
* <p>
* This means namespaces declared on the class itself, namespaces it inherited from super types, as well as
* namespaces declared for the package that contains the specified class.
* <p>
* Namespaces declared directly by {@link Namespace} as well as in {@link Namespaces} are considered.
*
* @param cls Class to detect namespaces for
* @return Namespace resolver containing detected namespaces
*/
public static <T> NamespaceResolver detectNamespaces(Class<T> cls) {
final NamespaceResolver resolver = new NamespaceResolver();
detectNamespaces(cls, resolver);
return resolver;
}

/**
* Detects namespace declarations relevant to the specified class and registers them with the specified {@link
* NamespaceResolver}.
* <p>
* This means namespaces declared on the class itself, namespaces it inherited from super types, as well as
* namespaces declared for the package that contains the specified class.
* <p>
* Namespaces declared directly by {@link Namespace} as well as in {@link Namespaces} are considered.
*
* @param cls Class to detect namespaces for
* @param namespaceResolver Namespace resolver containing detected namespaces
*/
public static <T> void detectNamespaces(Class<T> cls, NamespaceResolver namespaceResolver) {
Objects.requireNonNull(cls);
Objects.requireNonNull(namespaceResolver);
if (cls.getPackage() != null) {
resolveNamespaces(cls.getPackage(), resolver);
resolveNamespaces(cls.getPackage(), namespaceResolver);
}
resolveNamespaces(cls, resolver);
return resolver;
resolveNamespaces(cls, namespaceResolver);
}

private static void resolveNamespaces(AnnotatedElement target, NamespaceResolver namespaceResolver) {
Expand Down Expand Up @@ -104,20 +132,47 @@ static <T> Class<? super T> getManagedSuperClass(Class<T> cls) {
}
return null;
}

public static <T> Set<Class<? super T>> getManagedSuperInterfaces(Class<T> cls) {
return Arrays.stream(cls.getInterfaces()).filter(ManagedClassProcessor::isManagedType)
.map(clazz -> (Class<? super T>) clazz)
.collect(Collectors.toSet());
return Arrays.stream(cls.getInterfaces()).filter(ManagedClassProcessor::isManagedType)
.map(clazz -> (Class<? super T>) clazz)
.collect(Collectors.toSet());
}
static boolean isManagedType(Class<?> cls) {

/**
* Checks whether the specified class is a managed type.
* <p>
* That is, if it is an entity type (annotated with {@link OWLClass}) or a mapped superclass (annotated with {@link
* MappedSuperclass}).
*
* @param cls Class to check
* @return {@code true} if the class is a managed type, {@code false} otherwise
*/
public static boolean isManagedType(Class<?> cls) {
return isEntityType(cls) || isMappedSuperclassType(cls);
}

private static boolean isEntityType(Class<?> cls) {
return cls.getDeclaredAnnotation(OWLClass.class) != null;
/**
* Checks whether the specified class is an entity type.
* <p>
* An entity is annotated with {@link OWLClass}.
*
* @param cls Class to check
* @return {@code true} if the class is an entity type, {@code false} otherwise
*/
public static boolean isEntityType(Class<?> cls) {
return cls != null && cls.getDeclaredAnnotation(OWLClass.class) != null;
}

private static boolean isMappedSuperclassType(Class<?> cls) {
return cls.getDeclaredAnnotation(MappedSuperclass.class) != null;
/**
* Checks whether the specified class is a managed superclass.
* <p>
* An entity is annotated with {@link MappedSuperclass}.
*
* @param cls Class to check
* @return {@code true} if the class is a mapped superclass, {@code false} otherwise
*/
public static boolean isMappedSuperclassType(Class<?> cls) {
return cls != null && cls.getDeclaredAnnotation(MappedSuperclass.class) != null;
}
}
2 changes: 1 addition & 1 deletion jopa-integration-tests-jena/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion jopa-integration-tests-owlapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion jopa-integration-tests-rdf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jopa-integration-tests-rdf4j</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jopa-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-all</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion jopa-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>jopa-all</artifactId>
<groupId>cz.cvut.kbss.jopa</groupId>
<version>1.1.1</version>
<version>1.1.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public class ModelGenMojo extends AbstractMojo {

@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
@Parameter(alias = OUTPUT_DIRECTORY_PARAM, defaultValue = "./target/generated-sources/static-metamodel")
@Parameter(name = OUTPUT_DIRECTORY_PARAM, defaultValue = "./target/generated-sources/static-metamodel")
private String outputDirectory;
@Parameter(alias = SOURCE_PACKAGE_PARAM)
@Parameter(name = SOURCE_PACKAGE_PARAM)
private String sourcePackage;
@Parameter(alias = DEBUG_PARAM, defaultValue = "false")
@Parameter(name = DEBUG_PARAM, defaultValue = "false")
private String debugOption;
@Parameter(alias = ADDITIONAL_SOURCES_PARAM)
@Parameter(name = ADDITIONAL_SOURCES_PARAM)
private String additionalSources;


Expand Down
Loading

0 comments on commit 0f29d62

Please sign in to comment.