Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# JOPA - Change Log

### 2.9.4 - 2026-04-17

- Change return type of `CriteriaBuilder.langMatches` to `Predicate` to allow including it in predicate lists.
- Fix an issue with instances of subclasses of parents containing inferred attributes not being evicted from cache after
transaction commit.
- Dependency updates: RDF4J 5.3.0.

### 2.9.3 - 2026-03-16

- Fix driver-level transaction not being started when JOPA transaction starts with a query (Bug #426).
Expand Down Expand Up @@ -53,8 +60,10 @@

- Support entity classes with subclasses by the entity loading optimizer (Enhancement #357).
- Support entity loading optimization in query result stream (Enhancement #357).
- Always resolve the most specific entity classes for instantiation (instead of preferring class exactly matching the requested type).
- Eagerly generate lazy loading entity proxy classes for entity classes that are actually referenced by attributes with fetchType=LAZY in the model (Enhancement #380).
- Always resolve the most specific entity classes for instantiation (instead of preferring class exactly matching the
requested type).
- Eagerly generate lazy loading entity proxy classes for entity classes that are actually referenced by attributes with
fetchType=LAZY in the model (Enhancement #380).
- Dependency updates: Jena 5.6.0.

### 2.6.3 - 2025-10-07
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>2.9.3</version>
<version>2.9.4</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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public interface CriteriaBuilder extends PredicateFactory {
* @param range Language range expression
* @return Function call expression
*/
Expression<Boolean> langMatches(Expression<String> value, Expression<String> range);
Predicate langMatches(Expression<String> value, Expression<String> range);

/**
* Creates an expression for checking if the specified value matches the specified language range.
Expand All @@ -147,7 +147,7 @@ public interface CriteriaBuilder extends PredicateFactory {
* @param range Language range literal
* @return Function call expression
*/
Expression<Boolean> langMatches(Expression<String> value, String range);
Predicate langMatches(Expression<String> value, String range);

/**
* Create an ordering by the ascending value of the expression.
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>2.9.3</version>
<version>2.9.4</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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,13 @@ private <X> void processManagedType(TypeBuilderContext<X> context) {
fieldProcessor.processField(f);
}

if (!type.isAbstract()) {
try {
type.getIdentifier();
} catch (IllegalArgumentException e) {
throw new MetamodelInitializationException("Missing identifier field in entity " + cls);
}
}

verifyIdentifierPresence(type);
if (type.getPersistenceType() == Type.PersistenceType.ENTITY) {
resolveInheritanceType((IdentifiableEntityType<X>) type);
}
if (supertypes.stream().anyMatch(st -> inferredClasses.contains(st.getJavaType()))) {
addInferredClass(cls);
}

queryProcessor.processClass(cls);
}
Expand Down Expand Up @@ -195,6 +191,16 @@ private <X> Set<AbstractIdentifiableType<? super X>> processSupertypes(Class<X>
return superTypes;
}

private static <X> void verifyIdentifierPresence(AbstractIdentifiableType<X> type) {
if (!type.isAbstract()) {
try {
type.getIdentifier();
} catch (IllegalArgumentException e) {
throw new MetamodelInitializationException("Missing identifier field in entity " + type.getJavaType());
}
}
}

private static <X> boolean canDeclareInheritanceStrategy(IdentifiableType<X> et) {
return et.getSupertypes() == null || et.getSupertypes()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ public Expression<String> lang(Path<String> x) {
}

@Override
public Expression<Boolean> langMatches(Expression<String> value, Expression<String> range) {
return new LangMatchesFunction(this, (AbstractExpression<String>) value, (AbstractExpression<String>) range);
public Predicate langMatches(Expression<String> value, Expression<String> range) {
return new SimplePredicateImpl(new LangMatchesFunction(this, (AbstractExpression<String>) value, (AbstractExpression<String>) range), this);
}

@Override
public Expression<Boolean> langMatches(Expression<String> value, String range) {
public Predicate langMatches(Expression<String> value, String range) {
return langMatches(value, new ExpressionLiteralImpl<>(range, this));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

import static org.hamcrest.CoreMatchers.containsStringIgnoringCase;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand Down Expand Up @@ -757,4 +758,27 @@ public static class ClassWithLazySingularAttribute {
@OWLObjectProperty(iri = Vocabulary.ATTRIBUTE_BASE + "lazyAttribute", fetch = FetchType.LAZY)
private OWLClassA lazyAttribute;
}

@Test
void buildMetamodelIncludesSubtypesOfMappedSuperclassWithInferredAttributeInInferredClasses() {
when(finderMock.getEntities()).thenReturn(Set.of(MappedSuperclassWithInferredAttribute.class, SubClassWithInferredParent.class));
builder.buildMetamodel(finderMock);
assertThat(builder.getInferredClasses(), hasItems(MappedSuperclassWithInferredAttribute.class, SubClassWithInferredParent.class));
}

@TestLocal
@MappedSuperclass
public static class MappedSuperclassWithInferredAttribute {
@Id
private URI id;

@Inferred
@OWLObjectProperty(iri = Vocabulary.ATTRIBUTE_BASE + "parentInferredAttribute")
private URI parentInferredAttribute;
}

@TestLocal
@OWLClass(iri = Vocabulary.CLASS_BASE + "SubClassWithInferredParent")
public static class SubClassWithInferredParent extends MappedSuperclassWithInferredAttribute {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ void translateQuerySupportsLangMatches() {
assertEquals(expectedSoqlQuery, generatedSoqlQuery);
}

@Test
void translateQuerySupportsLangMatchesInListOfRestrictions() {
CriteriaQueryImpl<OWLClassA> query = cb.createQuery(OWLClassA.class);
Root<OWLClassA> root = query.from(OWLClassA.class);
final List<Predicate> restrictions = List.of(cb.langMatches(root.getAttr("stringAttribute"), "en"));
query.select(root).where(restrictions);

final String generatedSoqlQuery = query.translateQuery(criteriaParameterFiller);
final String expectedSoqlQuery = "SELECT owlclassa FROM OWLClassA owlclassa WHERE LANGMATCHES(owlclassa.stringAttribute, :generatedName0)";
assertEquals(expectedSoqlQuery, generatedSoqlQuery);
}

@Test
void translateQuerySupportsSelectionByIdentifierInParameter() {
CriteriaQueryImpl<OWLClassM> query = cb.createQuery(OWLClassM.class);
Expand Down
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>2.9.3</version>
<version>2.9.4</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>2.9.3</version>
<version>2.9.4</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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jopa-integration-tests-rdf4j</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jopa-integration-tests-virtuoso/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>2.9.3</version>
<version>2.9.4</version>
</parent>

<artifactId>jopa-integration-tests-virtuoso</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>2.9.3</version>
<version>2.9.4</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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion jopa-owl2java/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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jopa-owlapi-utils/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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modelgen/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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ontodriver-api/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>2.9.3</version>
<version>2.9.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

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

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

Expand Down
4 changes: 2 additions & 2 deletions ontodriver-rdf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<parent>
<artifactId>jopa-all</artifactId>
<groupId>cz.cvut.kbss.jopa</groupId>
<version>2.9.3</version>
<version>2.9.4</version>
</parent>

<properties>
<rdf4j.version>5.2.2</rdf4j.version>
<rdf4j.version>5.3.0</rdf4j.version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion ontodriver-virtuoso/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>2.9.3</version>
<version>2.9.4</version>
</parent>

<artifactId>ontodriver-virtuoso</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>cz.cvut.kbss.jopa</groupId>
<version>2.9.3</version>
<version>2.9.4</version>
<artifactId>jopa-all</artifactId>
<packaging>pom</packaging>
<name>JOPA</name>
Expand Down Expand Up @@ -44,7 +44,7 @@
<org.slf4j.version>2.0.17</org.slf4j.version>
<org.junit.jupiter.version>6.0.2</org.junit.jupiter.version>
<org.mockito.version>5.21.0</org.mockito.version>
<ch.qos.logback.version>1.5.26</ch.qos.logback.version>
<ch.qos.logback.version>1.5.32</ch.qos.logback.version>

<!-- We use OWLAPI in multiple modules, so let's keep them in sync -->
<net.sourceforge.owlapi.version>5.5.1</net.sourceforge.owlapi.version>
Expand Down