Skip to content

Commit

Permalink
Merge pull request #239 from kbss-cvut/development
Browse files Browse the repository at this point in the history
[2.0.0] Release
  • Loading branch information
ledsoft authored May 27, 2024
2 parents ca1036a + 18a01d4 commit b551f41
Show file tree
Hide file tree
Showing 531 changed files with 12,449 additions and 8,612 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master, development ]
branches: [ master, development, release/** ]

jobs:
build:
Expand All @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17
- name: Build with Maven
run: mvn -B package --file pom.xml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# JOPA - Change Log

## 2.0.0 - 2024-05-27
- Move internal API from `jopa-api` to the `jopa-impl` module (Enhancement #146).
- Modify name resolution in OWL2Java, support prefixes so that terms are better disambiguated without appending the useless `_A` suffix if possible (Enhancement #85).
- Remove dependency on AspectJ by rewriting object change tracking and lazy loading (Enhancement #145, #231). See the [wiki](https://github.com/kbss-cvut/jopa/wiki/Change-Tracking-and-Lazy-Loading) for details.
- Add support for RDF collections (Enhancement #51).
- Update dependencies (Jena 5.0.0, RDF4J 4.3.11).
- Require Java 17.

## 1.2.2 - 2024-01-30
- Modify `DefaultClasspathScanner` to handle Spring Boot nested JAR introduced in 3.2.0 (Bug #227).

Expand Down
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The library architecture and API is similar to JPA (see [2]) so that Java develo
* Explicit access to inferred knowledge
* Access to unmapped properties and individual's types
* Transactions
* Multilingual strings
* Separate storage access layer - Jena, OWLAPI, RDF4J drivers are available

#### Object-ontological Mapping Based on Integrity Constraints
Expand All @@ -23,13 +24,13 @@ Similarly to object-relational mapping (ORM), OOM enables to map ontological con

More specifically, OOM in JOPA maps (using the JLS [3] terminology):

| Ontology | OO Language |
|---------------------|------------------------------------------|
| OWL Class | Reference type |
| Object property | Reference type member |
| Data property | Primitive type member (+ String, Date) |
| Annotation property | Reference or primitive type member |
| Class assertions | Reference type instance or @Types record |
| Ontology | OO Language |
|---------------------|------------------------------------------------------------|
| OWL Class | Reference type |
| Object property | Reference type member |
| Data property | Primitive type member (+ String, Date, MultilingualString) |
| Annotation property | Reference or primitive type member |
| Class assertions | Reference type instance or @Types record |

All this means that individuals belonging to an OWL class can be retrieved as instances of a (Java) class.

Expand Down Expand Up @@ -101,15 +102,6 @@ Supported storages:
* [OWLAPI](https://github.com/owlcs/owlapi)
* [RDF4J](https://rdf4j.org/)

### Not Supported, yet

JOPA currently does not support referential integrity. This, for example, means that removing an instance that is referenced
by another instance is possible even though it should not.
Such feature is vital for object-oriented application, but not compatible with
the open-world nature of ontologies. Design possibilities and their implications are currently being studied.

Other missing/planned stuff can be found in the GitHub issue tracker and in [TODO.md](TODO.md).

## Modules

The whole framework consists of several modules:
Expand Down Expand Up @@ -141,14 +133,14 @@ JOPA examples can be found in a separate repository at [https://github.com/kbss-

A real-world, up-to-date project using JOPA is [TermIt](https://github.com/kbss-cvut/termit) - a SKOS-compatible vocabulary manager.

Note that JOPA requires **Java 11** or later.
Note that JOPA requires **Java 17** or later.

## Getting JOPA

There are two ways of getting JOPA for a project:

* Clone repository/download zip and build it with Maven,
* Use a Maven dependency from the [Maven central repository](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22cz.cvut.kbss.jopa%22).
* Use a Maven/Gradle dependency from the [Maven central repository](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22cz.cvut.kbss.jopa%22).

Basically, the _jopa-impl_ module and one of the OntoDriver implementations is all that is needed:

Expand All @@ -169,7 +161,7 @@ Basically, the _jopa-impl_ module and one of the OntoDriver implementations is a

## More Info

More information about JOPA can be found for example in articles [4], [5], [6] and on the GitHub [Wiki](https://github.com/kbss-cvut/jopa/wiki).
More information about JOPA can be found, for example, in articles [4], [5], [6] and on the GitHub [Wiki](https://github.com/kbss-cvut/jopa/wiki).

JOPA build status and code metrics can be found at:

Expand All @@ -195,6 +187,7 @@ Some related libraries:

Notable changes:

* **2.0.0** - Major rewrite of change tracking and lazy loading, remove internal API from the `jopa-api` module etc.
* **1.0.0** - Support for static metamodel generation and mapping multiple inheritance via Java interfaces.
* **0.20.0** - Allow editing inferred attributes (See the [wiki](https://github.com/kbss-cvut/jopa/wiki) for more details). Support `IN`, `NOT LIKE`, `<>` operators in SOQL.
* **0.19.0** - Add RDF4J driver (renaming of Sesame driver, which has been deprecated and will be removed in the future)
Expand Down
17 changes: 0 additions & 17 deletions TODO.md

This file was deleted.

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.2.2</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
21 changes: 1 addition & 20 deletions datatype/src/main/java/cz/cvut/kbss/jopa/datatype/util/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,11 @@
*/
package cz.cvut.kbss.jopa.datatype.util;

import java.util.AbstractMap;

/**
* Represents an ordered pair of values.
*
* @param <F> Type of the first value in the pair
* @param <S> Type of the second value in the pair
*/
public final class Pair<F, S> extends AbstractMap.SimpleEntry<F, S> {

public Pair(F first, S second) {
super(first, second);
}

public F getFirst() {
return getKey();
}

public S getSecond() {
return getValue();
}

@Override
public String toString() {
return "(" + getFirst() + ", " + getSecond() + ")";
}
public record Pair<F, S>(F first, S second) {
}
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.2.2</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jopa-api/src/main/java/cz/cvut/kbss/jopa/NonJPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package cz.cvut.kbss.jopa;

/**
* Denotes class/member that is not present in JPA 2.0
* Denotes class/member that is not present in JPA (Jakarta Persistence)
*/
public @interface NonJPA {
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,8 @@
*/
public class InvalidAssertionIdentifierException extends OWLPersistenceException {

public InvalidAssertionIdentifierException(String message) {
super(message);
}

public InvalidAssertionIdentifierException(String message, Throwable cause) {
super(message, cause);
}

public InvalidAssertionIdentifierException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
*/
public class NoResultException extends OWLPersistenceException {

private static final long serialVersionUID = -1891852675684320722L;

public NoResultException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
*/
public class NoUniqueResultException extends OWLPersistenceException {

private static final long serialVersionUID = -6340735954399074847L;

public NoUniqueResultException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
public class OWLEntityExistsException extends OWLPersistenceException {

private static final long serialVersionUID = 453666323423782580L;

public OWLEntityExistsException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
public class RollbackException extends OWLPersistenceException {

private static final long serialVersionUID = 8371285315001388603L;

public RollbackException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
public class StorageAccessException extends OWLPersistenceException {

private static final long serialVersionUID = 4661531292404254252L;

public StorageAccessException(String message) {
super(message);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package cz.cvut.kbss.jopa.sessions;
package cz.cvut.kbss.jopa.model;

import cz.cvut.kbss.jopa.model.descriptors.Descriptor;

Expand All @@ -26,8 +26,6 @@
* <p>
* If a cache is not in use, the methods of this interface have no effect, except for contains, which
* returns false.
* <p>
* Taken from JPA 2.
*/
public interface Cache {

Expand Down
46 changes: 3 additions & 43 deletions jopa-api/src/main/java/cz/cvut/kbss/jopa/model/EntityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
import cz.cvut.kbss.jopa.model.query.Query;
import cz.cvut.kbss.jopa.model.query.TypedQuery;
import cz.cvut.kbss.jopa.model.query.criteria.CriteriaQuery;
import cz.cvut.kbss.jopa.sessions.CriteriaBuilder;
import cz.cvut.kbss.jopa.model.query.criteria.CriteriaBuilder;
import cz.cvut.kbss.jopa.transactions.EntityTransaction;

import java.net.URI;
import java.util.List;
import java.util.Map;

public interface EntityManager {
public interface EntityManager extends AutoCloseable {

/**
* Make an instance managed and persistent.
Expand Down Expand Up @@ -140,14 +140,7 @@ public interface EntityManager {
* null}
* @see #getContexts()
*/
<T> T find(final Class<T> entityClass, final Object identifier,
final Descriptor descriptor);

// TODO JPA 2.0 find with properties

// TODO JPA 2.0 find with lock mode

// TODO JPA 2.0 find with lock mode and properties
<T> T find(final Class<T> entityClass, final Object identifier, final Descriptor descriptor);

/**
* Get an instance, whose state may be lazily fetched.
Expand Down Expand Up @@ -192,33 +185,6 @@ <T> T find(final Class<T> entityClass, final Object identifier,
*/
void flush();

// /**
// * Set the flush mode that applies to all objects contained in the
// * persistence context.
// *
// * @param flushMode
// */
// public void setFlushMode(FlushModeType flushMode);

// TODO JPA 2.0 getFlushMode

// /**
// * Set the lock mode for an entity object contained in the persistence
// * context.
// *
// * @param entity
// * @param lockMode
// * @throws PersistenceException
// * if an unsupported lock call is made
// * @throws IllegalArgumentException
// * if the instance is not an entity or is a detached entity
// * @throws TransactionRequiredException
// * if there is no transaction
// */
// public void lock(Object entity, LockModeType lockMode);

// TODO JPA 2.0 lock with lock mode and properties

/**
* Refresh the state of the instance from the data source, overwriting changes made to the entity, if any.
*
Expand All @@ -229,10 +195,6 @@ <T> T find(final Class<T> entityClass, final Object identifier,
*/
void refresh(final Object entity);

// TODO JPA 2.0 refresh with lock mode
// TODO JPA 2.0 refresh with properties
// TODO JPA 2.0 refresh with lock mode and properties

/**
* Clear the persistence context, causing all managed entities to become detached. Changes made to entities that
* have not been flushed to the database will not be persisted.
Expand Down Expand Up @@ -285,8 +247,6 @@ <T> T find(final Class<T> entityClass, final Object identifier,
*/
<T> boolean isInferred(T entity, FieldSpecification<? super T, ?> attribute, Object value);

// TODO JPA 2.0 public LockModeType getLockMode(Object entity)

/**
* Get the properties and hints and associated values that are in effect for the entity manager.
* <p>
Expand Down
Loading

0 comments on commit b551f41

Please sign in to comment.