diff --git a/CHANGELOG.md b/CHANGELOG.md index 9155f64df..479105f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # JOPA - Change Log +### 2.10.1 - 2026-06-30 + +- Allow ordering by entity identifier in SOQL (Bug #439). +- Dependency updates: RDF4J 5.3.2. + ### 2.10.0 - 2026-05-29 - Support optimizing entity loading from query result by using [fetch graphs](https://github.com/kbss-cvut/jopa/wiki/Performance#fetch-graph-based-entity-loading) (Enhancement #425, #431, #434). @@ -131,7 +136,7 @@ ### 2.5.1 - 2025-08-21 -- Fix an issue with translating SOQL to SPARQL when referencing a RDF container attribute (Bug #366). +- Fix an issue with translating SOQL to SPARQL when referencing an RDF container attribute (Bug #366). ### 2.5.0 - 2025-08-18 @@ -689,7 +694,7 @@ - Fixed bug SPARQL query parser which prevent the use of property paths together with variables. - Added support for setting the in-memory storage in Jena and RDF4J driver (Enhancement #32). -- Working on Github Wiki. +- Working on GitHub Wiki. ## 0.10.1 - 2018-05-20 @@ -731,7 +736,7 @@ ## 0.9.12 - 2017-12-04 -- Rewrote em.refresh to correspond to JPA behavior (Issue #17). +- Rewrote `em.refresh` to correspond to JPA behavior (Issue #17). - Upgraded to the latest RDF4J (2.2.4). - Generate class names compliant with Java naming conventions (OWL2Java). - Added support for untyped query parameters to Query API (necessary for `LIMIT` and `OFFSET` support). @@ -880,7 +885,7 @@ - Implemented support for `EntityManager.unwrap`. Using unwrap, it is possible to get a hold of for example the Sesame in-memory repository used by the Sesame driver (which is otherwise, due to the Sesame API architecture, inaccessible - through the `RepositoryProvider`. + through the `RepositoryProvider`). ## 0.7.7 - 2016-05-11 diff --git a/datatype/pom.xml b/datatype/pom.xml index 7471a4449..c729a0529 100644 --- a/datatype/pom.xml +++ b/datatype/pom.xml @@ -6,7 +6,7 @@ jopa-all cz.cvut.kbss.jopa - 2.10.0 + 2.10.1 ../pom.xml diff --git a/datatype/src/main/java/cz/cvut/kbss/jopa/datatype/DatatypeTransformer.java b/datatype/src/main/java/cz/cvut/kbss/jopa/datatype/DatatypeTransformer.java index 17ad70427..414158646 100644 --- a/datatype/src/main/java/cz/cvut/kbss/jopa/datatype/DatatypeTransformer.java +++ b/datatype/src/main/java/cz/cvut/kbss/jopa/datatype/DatatypeTransformer.java @@ -92,8 +92,8 @@ private DatatypeTransformer() { /** * Converts the specified wrapper class to its corresponding primitive class. *

- * If the class parameter is a wrapper type, the equivalent primitive type will be returned (e.g., int.class for - * Integer.class) In all other cases, the return value is null. + * If the class parameter is a wrapper type, the equivalent primitive type will be returned (e.g., {@code int.class} for + * {@code Integer.class}) In all other cases, the return value is null. * * @param cls - the class to convert * @return Optional containing the primitive type, or empty if the specified class is not a wrapper type diff --git a/jopa-api/pom.xml b/jopa-api/pom.xml index de6e3cb80..26e12414a 100644 --- a/jopa-api/pom.xml +++ b/jopa-api/pom.xml @@ -6,7 +6,7 @@ cz.cvut.kbss.jopa jopa-all - 2.10.0 + 2.10.1 ../pom.xml diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/ProviderUtil.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/ProviderUtil.java index 8aa1364ec..427ff8f78 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/ProviderUtil.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/ProviderUtil.java @@ -29,7 +29,7 @@ public interface ProviderUtil { *

* If the provider determines that the entity has been provided by itself and that either entity attributes with * FetchType EAGER have not been loaded or that the state of the specified attribute has not been loaded, this - * methods returns LoadState.NOT_LOADED. + * method returns LoadState.NOT_LOADED. *

* If the provider cannot determine the load state, this method returns LoadState.UNKNOWN. *

@@ -48,7 +48,7 @@ public interface ProviderUtil { *

* If the provider determines that the entity has been provided by itself and that either entity attributes with * FetchType EAGER have not been loaded or that the state of the specified attribute has not been loaded, this - * methods returns LoadState.NOT_LOADED. + * method returns LoadState.NOT_LOADED. *

* If the provider cannot determine the load state, this method returns LoadState.UNKNOWN. *

diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/annotations/OWLObjectProperty.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/annotations/OWLObjectProperty.java index 6e29678a5..125a4adfe 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/annotations/OWLObjectProperty.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/annotations/OWLObjectProperty.java @@ -49,7 +49,7 @@ /** * (Optional) The operations that must be cascaded to the target of the association. *

- * By default no operations are cascaded. + * By default, no operations are cascaded. * * @return Cascading setting for the annotated attribute */ diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/ManagedType.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/ManagedType.java index 8982b7a57..ea50772b6 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/ManagedType.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/ManagedType.java @@ -171,16 +171,16 @@ public interface ManagedType extends Type { MapAttribute getDeclaredMap(String name, Class keyType, Class valueType); /** - * Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) of the managed type. - * Returns empty set if the managed type has no multi-valued attributes. + * Return all multivalued attributes (Collection-, Set-, List-, and Map-valued attributes) of the managed type. + * Returns empty set if the managed type has no multivalued attributes. * * @return Collection-, Set-, List-, and Map-valued attributes */ Set> getPluralAttributes(); /** - * Return all multi-valued attributes (Collection-, Set-, List-, and Map-valued attributes) declared by the managed - * type. Returns empty set if the managed type has no declared multi-valued attributes. + * Return all multivalued attributes (Collection-, Set-, List-, and Map-valued attributes) declared by the managed + * type. Returns empty set if the managed type has no declared multivalued attributes. * * @return declared Collection-, Set-, List-, and Map-valued attributes */ diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/Metamodel.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/Metamodel.java index f28c7dbb0..dff995016 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/Metamodel.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/Metamodel.java @@ -23,8 +23,7 @@ import java.util.Set; /** - * Provides access to the metamodel of persistent entities in the persistence - * unit. + * Provides access to the metamodel of persistent entities in the persistence unit. */ public interface Metamodel { /** @@ -63,9 +62,8 @@ public interface Metamodel { Set> getEntities(); /** - * Get the set of classes that contain inferred attributes. These classes - * are handled specially since inferred attributes can be influenced by - * changes to any other attributes in any other entity. + * Get the set of classes that contain inferred attributes. These classes are handled specially since inferred + * attributes can be influenced by changes to any other attributes in any other entity. * * @return The set of classes with inferred attributes. */ @@ -85,11 +83,9 @@ public interface Metamodel { /** * Adds the specified URI to the module extraction signature. *

- * Note that a module including the specified URI will be created when a new - * resource level transaction is started. When that will be is - * implementation dependent. However it must be guaranteed that all - * subsequent connections provided by OntoDriver will include the URI in - * extracted modules. + * Note that a module including the specified URI will be created when a new resource level transaction is started. + * When that will be is implementation dependent. However, it must be guaranteed that all subsequent connections + * provided by OntoDriver will include the URI in extracted modules. * * @param uri The URI to add * @throws NullPointerException If {@code uri} is {@code null} diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/PluralAttribute.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/PluralAttribute.java index d7e106492..e38a375ba 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/PluralAttribute.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/metamodel/PluralAttribute.java @@ -52,7 +52,7 @@ public interface PluralAttribute extends Attribute, Bindable { default boolean isRdfContainer() {return false;} /** - * Whether this list represents a RDF + * Whether this list represents an RDF * collection. * * @return {@code true} when this list attribute is an RDF collection, {@code false} otherwise diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/Query.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/Query.java index fb5ecc8ea..da0190529 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/Query.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/Query.java @@ -54,7 +54,7 @@ public interface Query { /** * Execute a SELECT query and return the query results as an untyped java.util.stream.Stream. *

- * By default this method delegates to getResultList().stream(), however persistence provider may choose to override + * By default, this method delegates to getResultList().stream(), however persistence provider may choose to override * this method to provide additional capabilities. * * @return a stream of the results diff --git a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/criteria/CriteriaQuery.java b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/criteria/CriteriaQuery.java index 71f2121d7..667288b7d 100644 --- a/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/criteria/CriteriaQuery.java +++ b/jopa-api/src/main/java/cz/cvut/kbss/jopa/model/query/criteria/CriteriaQuery.java @@ -45,7 +45,8 @@ public interface CriteriaQuery { Root from(EntityType entity); /** - * Specify the item that is to be returned in the query result. Replaces the previously specified selection(s), if any. + * Specify the item that is to be returned in the query result. Replaces the previously specified selection(s), if + * any. * * @param selection - selection specifying the item that is to be returned in the query result * @return the modified query @@ -53,7 +54,8 @@ public interface CriteriaQuery { CriteriaQuery select(Selection selection); /** - * Modify the query to restrict the query result according to the specified boolean expression. Replaces the previously added restriction(s), if any. + * Modify the query to restrict the query result according to the specified boolean expression. Replaces the + * previously added restriction(s), if any. * * @param expression - a simple or compound boolean expression * @return the modified query @@ -61,7 +63,9 @@ public interface CriteriaQuery { CriteriaQuery where(Expression expression); /** - * Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. + * Modify the query to restrict the query result according to the conjunction of the specified restriction + * predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any + * previously added restrictions are simply removed. * * @param predicates - zero or more restriction predicates * @return the modified query @@ -69,7 +73,9 @@ public interface CriteriaQuery { CriteriaQuery where(Predicate... predicates); /** - * Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. + * Modify the query to restrict the query result according to the conjunction of the specified restriction + * predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any + * previously added restrictions are simply removed. * * @param predicates - list of predicates * @return the modified query @@ -79,9 +85,12 @@ public interface CriteriaQuery { Class getResultType(); /** - * Specify whether duplicate query results will be eliminated. A true value will cause duplicates to be eliminated. A false value will cause duplicates to be retained. If distinct has not been specified, duplicate results must be retained. + * Specify whether duplicate query results will be eliminated. A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. If distinct has not been specified, duplicate results must be + * retained. * - * @param distinct - boolean value specifying whether duplicate results must be eliminated from the query result or whether they must be retained + * @param distinct - boolean value specifying whether duplicate results must be eliminated from the query result or + * whether they must be retained * @return the modified query */ CriteriaQuery distinct(boolean distinct); @@ -108,14 +117,17 @@ public interface CriteriaQuery { Selection getSelection(); /** - * Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified. + * Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been + * specified. * * @return where clause predicate */ Predicate getRestriction(); /** - * Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. + * Specify the expressions that are used to form groups over the query results. Replaces the previous specified + * grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions + * are simply removed. * * @param grouping zero or more grouping expressions * @return the modified query @@ -123,7 +135,9 @@ public interface CriteriaQuery { CriteriaQuery groupBy(Expression... grouping); /** - * Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. + * Specify the expressions that are used to form groups over the query results. Replaces the previous specified + * grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions + * are simply removed. * * @param grouping list of zero or more grouping expressions * @return the modified query @@ -131,7 +145,10 @@ public interface CriteriaQuery { CriteriaQuery groupBy(List> grouping); /** - * Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence. + * Specify the ordering expressions that are used to order the query results. Replaces the previous ordering + * expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, + * and results will be returned in no particular order. The left-to-right sequence of the ordering expressions + * determines the precedence, whereby the leftmost has the highest precedence. * * @param o list of zero or more ordering expressions * @return the modified query @@ -139,7 +156,10 @@ public interface CriteriaQuery { CriteriaQuery orderBy(List o); /** - * Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence. + * Specify the ordering expressions that are used to order the query results. Replaces the previous ordering + * expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, + * and results will be returned in no particular order. The left-to-right sequence of the ordering expressions + * determines the precedence, whereby the leftmost has the highest precedence. * * @param o zero or more ordering expressions * @return the modified query @@ -148,7 +168,8 @@ public interface CriteriaQuery { /** - * Return the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been specified. + * Return the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been + * specified. * * @return the list of ordering expressions */ @@ -163,7 +184,9 @@ public interface CriteriaQuery { CriteriaQuery having(Expression restriction); /** - * Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously added having restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. + * Specify restrictions over the groups of the query according the conjunction of the specified restriction + * predicates. Replaces the previously added having restriction(s), if any. If no restrictions are specified, any + * previously added restrictions are simply removed. * * @param restrictions zero or more restriction predicates * @return the modified query diff --git a/jopa-distribution/pom.xml b/jopa-distribution/pom.xml index a3a98f345..e1294828b 100644 --- a/jopa-distribution/pom.xml +++ b/jopa-distribution/pom.xml @@ -6,7 +6,7 @@ cz.cvut.kbss.jopa jopa-all - 2.10.0 + 2.10.1 ../pom.xml diff --git a/jopa-impl/pom.xml b/jopa-impl/pom.xml index c8a8b6fce..4912214e2 100644 --- a/jopa-impl/pom.xml +++ b/jopa-impl/pom.xml @@ -6,7 +6,7 @@ cz.cvut.kbss.jopa jopa-all - 2.10.0 + 2.10.1 ../pom.xml diff --git a/jopa-impl/src/main/antlr4/cz/cvut/kbss/jopa/query/soql/Soql.g4 b/jopa-impl/src/main/antlr4/cz/cvut/kbss/jopa/query/soql/Soql.g4 index 6a8b53349..8091af490 100644 --- a/jopa-impl/src/main/antlr4/cz/cvut/kbss/jopa/query/soql/Soql.g4 +++ b/jopa-impl/src/main/antlr4/cz/cvut/kbss/jopa/query/soql/Soql.g4 @@ -133,7 +133,7 @@ functionsReturningBoolean orderByClause: ORDER BY orderByItem (',' orderByItem)* ; -orderByItem: singleValuedObjectPathExpression (ASC | DESC)? ; +orderByItem: (singleValuedObjectPathExpression | simpleSubpath) (ASC | DESC)? ; groupByClause: GROUP BY groupByItem (',' groupByItem)* ; diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/AmbiguousAttributeException.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/AmbiguousAttributeException.java deleted file mode 100644 index f1181fe3d..000000000 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/AmbiguousAttributeException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * JOPA - * Copyright (C) 2026 Czech Technical University in Prague - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. - */ -package cz.cvut.kbss.jopa.exception; - -import cz.cvut.kbss.jopa.exceptions.OWLPersistenceException; - -public class AmbiguousAttributeException extends OWLPersistenceException { - public AmbiguousAttributeException(String message, Throwable cause) { - super(message, cause); - } - - public AmbiguousAttributeException(String message) { - super(message); - } - - public AmbiguousAttributeException(Throwable cause) { - super(cause); - } -} diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IdentifierNotSetException.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IdentifierNotSetException.java index 4a6d4e6b9..75a4b11a6 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IdentifierNotSetException.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IdentifierNotSetException.java @@ -20,7 +20,7 @@ import cz.cvut.kbss.jopa.exceptions.OWLPersistenceException; /** - * Thrown when an entity is missing an identifier and it cannot be generated. + * Thrown when an entity is missing an identifier, and it cannot be generated. */ public class IdentifierNotSetException extends OWLPersistenceException { diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IncompatibleDatatypeException.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IncompatibleDatatypeException.java deleted file mode 100644 index 431fba05d..000000000 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/exception/IncompatibleDatatypeException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * JOPA - * Copyright (C) 2026 Czech Technical University in Prague - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. - */ -package cz.cvut.kbss.jopa.exception; - -import cz.cvut.kbss.jopa.exceptions.OWLPersistenceException; - -/** - * Indicates that an unexpected datatype has been provided for a value. - */ -public class IncompatibleDatatypeException extends OWLPersistenceException { - - public IncompatibleDatatypeException(String message) { - super(message); - } -} diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/loaders/PersistenceUnitClassFinder.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/loaders/PersistenceUnitClassFinder.java index 049ca4349..787cc63ff 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/loaders/PersistenceUnitClassFinder.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/loaders/PersistenceUnitClassFinder.java @@ -51,7 +51,7 @@ public class PersistenceUnitClassFinder { * These classes include: *

* diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/oom/exception/EntityReconstructionException.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/oom/exception/EntityReconstructionException.java index 7747a36dc..f69100def 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/oom/exception/EntityReconstructionException.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/oom/exception/EntityReconstructionException.java @@ -21,14 +21,6 @@ public class EntityReconstructionException extends OWLPersistenceException { - public EntityReconstructionException(String message, Throwable cause) { - super(message, cause); - } - - public EntityReconstructionException(String message) { - super(message); - } - public EntityReconstructionException(Throwable cause) { super(cause); } diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/criteria/CriteriaBuilderImpl.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/criteria/CriteriaBuilderImpl.java index 34cc8b744..a6139c56f 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/criteria/CriteriaBuilderImpl.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/criteria/CriteriaBuilderImpl.java @@ -348,7 +348,7 @@ public > Predicate lessThanOrEqual(Expression expression = factory.get("attributeName");} Looks like boolean expression but in * fact it is not boolean expression, so we need to fix this. diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlOrderParameter.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlOrderParameter.java index c14ee85a8..55b5aa6c6 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlOrderParameter.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlOrderParameter.java @@ -37,6 +37,10 @@ public void setAttribute(SoqlAttribute attribute) { } public String getOrderByPart(String rootVariable) { + if (getAsParam(rootVariable).equals(rootVariable)) { + // Ordering by the entity identifier + return SoqlConstants.ASC.equals(orderingBy) ? rootVariable + " " : orderingBy + "(" + rootVariable + ") "; + } String param = attribute.requiresFilter() ? getAsParam(rootVariable).substring(1) : attribute.getValue().substring(1); return orderingBy + "(?" + param + ") "; } diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlQueryListener.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlQueryListener.java index 0d258636b..f7a5dd759 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlQueryListener.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/soql/SoqlQueryListener.java @@ -437,7 +437,9 @@ private SoqlNode linkObjectPathExpression(ParserRuleContext ctx) { } setIris(firstNode); if (currentNode.getIri().isEmpty()) { - currentNode.getParent().clearChildren(); + if (currentNode.getParent() != null) { + currentNode.getParent().clearChildren(); + } this.isInObjectIdentifierExpression = true; } return firstNode; diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/CollectionInstanceBuilder.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/CollectionInstanceBuilder.java index 969008df1..88f763bd0 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/CollectionInstanceBuilder.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/CollectionInstanceBuilder.java @@ -41,7 +41,7 @@ import java.util.Set; /** - * Special class for cloning collections. Introduced because some Java collection have no no-argument constructor and + * Special class for cloning collections. Introduced because some Java collection have no no-argument constructor, and * thus they must be cloned specially. NOTE: This class may be removed in case a better cloning mechanisms (namely * database mappings and copy policies) is introduced. */ @@ -89,7 +89,7 @@ Object buildClone(Object cloneOwner, Field field, Object collection, CloneConfig /** * Clones the specified collection using its default zero argument constructor. If the specified collection has none - * (e. g. like SingletonList), this method returns null. + * (e.g. like SingletonList), this method returns null. * * @param container The collection to clone. * @return cloned collection diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/CacheManager.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/CacheManager.java index 3d0718939..6ae12b7d6 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/CacheManager.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/CacheManager.java @@ -43,7 +43,7 @@ public interface CacheManager extends Cache { /** * Gets entity with the specified identifier from the cache. *

- * The entity is searched for in the context specified by {@code descriptor}. Thus all three conditions - class, + * The entity is searched for in the context specified by {@code descriptor}. Thus, all three conditions - class, * identifier and descriptor must match to return a result. * * @param cls Class of the entity diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/TtlCacheManager.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/TtlCacheManager.java index 3c61e5e1b..70ae6267a 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/TtlCacheManager.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/cache/TtlCacheManager.java @@ -67,7 +67,7 @@ public class TtlCacheManager implements CacheManager { private TtlCache cache; - // Each repository can have its own lock and they could be acquired by this + // Each repository can have its own lock, and they could be acquired by this // instance itself, no need to pass this burden to callers private final Lock readLock; private final Lock writeLock; diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/change/CollectionChangeDetector.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/change/CollectionChangeDetector.java index 32ab3bfbb..599d9a6dd 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/change/CollectionChangeDetector.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/sessions/change/CollectionChangeDetector.java @@ -23,7 +23,7 @@ import java.util.*; /** - * Checks for changes in a collection. By changes it is understood: + * Checks for changes in a collection. By changes, it is understood: *

  *