Skip to content

Commit

Permalink
[#308] Migrate jopa from 0.18.7 to 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Feb 21, 2025
1 parent 577f6fd commit 89bfaf7
Show file tree
Hide file tree
Showing 18 changed files with 774 additions and 868 deletions.
56 changes: 7 additions & 49 deletions s-pipes-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,20 @@
<dependency>
<groupId>com.intellij</groupId>
<artifactId>annotations</artifactId>
<version>9.0.4</version>
</dependency>
<dependency>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-impl</artifactId>
</dependency>
<dependency>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>ontodriver-sesame</artifactId>
<artifactId>ontodriver-rdf4j</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
<scope>compile</scope>
</dependency>

</dependencies>
Expand All @@ -135,53 +140,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-impl</artifactId>
</aspectLibrary>
</aspectLibraries>
<complianceLevel>${jdk.version}</complianceLevel>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<showWeaveInfo>true</showWeaveInfo>
<sources>
<source>
<basedir>${basedir}/src/main/java</basedir>
<includes>
<include>**/LoggingAspect.java</include>
</includes>
</source>
</sources>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${org.aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
<!-- use this goal to weave all your main classes -->
<goal>test-compile</goal>
<!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
<testResources>
<testResource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public class AdvancedLoggingProgressListener implements ProgressListener {
private static final Map<String, EntityManager> entityManagerMap = new HashMap<>();
private static final Map<Long, Path> logDir = new HashMap<>();
private static final String P_HAS_PART =
Vocabulary.ONTOLOGY_IRI_dataset_descriptor + "/has-part";
Vocabulary.ONTOLOGY_IRI_DATASET_DESCRIPTOR + "/has-part";
private static final String P_HAS_NEXT =
Vocabulary.ONTOLOGY_IRI_dataset_descriptor + "/has-next";
Vocabulary.ONTOLOGY_IRI_DATASET_DESCRIPTOR + "/has-next";
private static final String P_HAS_INPUT_BINDDING =
Vocabulary.ONTOLOGY_IRI_dataset_descriptor + "/has-input-binding";
Vocabulary.ONTOLOGY_IRI_DATASET_DESCRIPTOR + "/has-input-binding";
private static final String LOCAL_NAME = "advanced-logging-progress-listener";
private static final String PREFIX_IRI = SPIPES.uri + LOCAL_NAME + "/";
static final Property P_RDF4J_SERVER_URL = getParameter("p-rdf4j-server-url");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cz.cvut.kbss.jopa.model.JOPAPersistenceProperties;
import cz.cvut.kbss.jopa.model.JOPAPersistenceProvider;
import cz.cvut.kbss.ontodriver.config.OntoDriverProperties;
import cz.cvut.kbss.ontodriver.sesame.config.SesameOntoDriverProperties;
import cz.cvut.kbss.ontodriver.rdf4j.config.Rdf4jOntoDriverProperties;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -29,13 +29,13 @@ public static void init(Map<String, String> properties) {
final Map<String, String> props = new HashMap<>();
// Here we set up basic storage access properties-driver class, physical location of the storage
props.put(JOPAPersistenceProperties.DATA_SOURCE_CLASS,
"cz.cvut.kbss.ontodriver.sesame.SesameDataSource");
"cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource");
// View transactional changes during transaction
props.put(OntoDriverProperties.USE_TRANSACTIONAL_ONTOLOGY, Boolean.TRUE.toString());
// Use in-memory storage if not remote or local file path specified
props.put(SesameOntoDriverProperties.SESAME_USE_VOLATILE_STORAGE, Boolean.TRUE.toString());
// Don't use Sesame inference
props.put(SesameOntoDriverProperties.SESAME_USE_INFERENCE, Boolean.FALSE.toString());
props.put(Rdf4jOntoDriverProperties.USE_VOLATILE_STORAGE, Boolean.TRUE.toString());
// Don't use inference
props.put(Rdf4jOntoDriverProperties.USE_INFERENCE, Boolean.FALSE.toString());
// Ontology language
props.put(JOPAPersistenceProperties.LANG, "en");
if (properties != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import cz.cvut.kbss.jopa.model.JOPAPersistenceProperties;
import cz.cvut.kbss.jopa.model.JOPAPersistenceProvider;
import cz.cvut.kbss.ontodriver.config.OntoDriverProperties;
import cz.cvut.kbss.ontodriver.sesame.config.SesameOntoDriverProperties;
import cz.cvut.kbss.ontodriver.rdf4j.config.Rdf4jOntoDriverProperties;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;
import org.jetbrains.annotations.NotNull;

public class RDF4JPersistenceFactory {

Expand All @@ -30,11 +31,11 @@ EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, String
Map<String, String> getInitialParams() {
final Map<String, String> props = new HashMap<>();
// Here we set up basic storage access properties-driver class, physical location of the storage
props.put(JOPAPersistenceProperties.DATA_SOURCE_CLASS, "cz.cvut.kbss.ontodriver.sesame.SesameDataSource");
props.put(JOPAPersistenceProperties.DATA_SOURCE_CLASS, "cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource");
// View transactional changes during transaction
props.put(OntoDriverProperties.USE_TRANSACTIONAL_ONTOLOGY, Boolean.TRUE.toString());
// Don't use Sesame inference
props.put(SesameOntoDriverProperties.SESAME_USE_INFERENCE, Boolean.FALSE.toString());
props.put(Rdf4jOntoDriverProperties.USE_INFERENCE, Boolean.FALSE.toString());
// Don't use cache
props.put(JOPAPersistenceProperties.CACHE_ENABLED, Boolean.FALSE.toString());
// Ontology language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public class SemanticLoggingProgressListener implements ProgressListener {
private static final Map<Long, Path> logDir= new HashMap<>();

private static final String P_HAS_PART =
Vocabulary.ONTOLOGY_IRI_dataset_descriptor + "/has-part";
Vocabulary.ONTOLOGY_IRI_DATASET_DESCRIPTOR + "/has-part";
private static final String P_HAS_NEXT =
Vocabulary.ONTOLOGY_IRI_dataset_descriptor + "/has-next";
Vocabulary.ONTOLOGY_IRI_DATASET_DESCRIPTOR + "/has-next";

static {
final Map<String, String> props = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cz.cvut.spipes.util;

import java.io.IOException;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryException;
import org.eclipse.rdf4j.repository.config.RepositoryConfig;
Expand Down Expand Up @@ -31,7 +30,7 @@ public static void createRdf4RepositoryIfNotExist(String rdf4jServerUrl, String
repositoryManager.addRepositoryConfig(repConfig);
repository = repositoryManager.getRepository(repositoryName);
}
repository.initialize();
repository.init();

} catch (final RepositoryException | RDFParseException | RepositoryConfigException e) {
log.error(e.getMessage(), e);
Expand Down
119 changes: 73 additions & 46 deletions s-pipes-forms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,50 @@
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>cz.cvut.kbss</groupId>
<artifactId>s-pipes-core</artifactId>
<version>${project.parent.version}</version>
</dependency>

<!-- JOPA -->
<dependency>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-api</artifactId>
</dependency>
<dependency>
<groupId>cz.cvut.kbss</groupId>
<artifactId>s-pipes-core</artifactId>
<version>${project.parent.version}</version>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-impl</artifactId>
</dependency>

<!-- Jena -->
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
<version>${org.apache.jena}</version>
</dependency>
<dependency>
<groupId>org.topbraid</groupId>
<artifactId>shacl</artifactId>
<version>1.0.1</version>
<exclusions> <!-- TODO update jena libs and remove exclusions -->
<exclusion>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>${org.apache.jena}</version>
</dependency>

<!-- Annotations -->
<dependency>
<groupId>com.intellij</groupId>
<artifactId>annotations</artifactId>
</dependency>

<!-- Spring -->
<dependency>
Expand Down Expand Up @@ -87,12 +120,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -169,43 +196,43 @@
<vocabulary-only>true</vocabulary-only>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<complianceLevel>${jdk.version}</complianceLevel>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-impl</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${org.aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
<!-- use this goal to weave all your main classes -->
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.codehaus.mojo</groupId>-->
<!-- <artifactId>aspectj-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <complianceLevel>${jdk.version}</complianceLevel>-->
<!-- <source>${jdk.version}</source>-->
<!-- <target>${jdk.version}</target>-->
<!-- <showWeaveInfo>true</showWeaveInfo>-->
<!-- <aspectLibraries>-->
<!-- <aspectLibrary>-->
<!-- <groupId>cz.cvut.kbss.jopa</groupId>-->
<!-- <artifactId>jopa-impl</artifactId>-->
<!-- </aspectLibrary>-->
<!-- </aspectLibraries>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>org.aspectj</groupId>-->
<!-- <artifactId>aspectjtools</artifactId>-->
<!-- <version>${org.aspectj.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.aspectj</groupId>-->
<!-- <artifactId>aspectjrt</artifactId>-->
<!-- <version>${org.aspectj.version}</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>process-classes</phase>-->
<!-- <goals>-->
<!-- <goal>compile</goal>-->
<!-- &lt;!&ndash; use this goal to weave all your main classes &ndash;&gt;-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ private SFormsVocabularyJena() {
throw new IllegalStateException("Utility class");
}

public static final Property s_p_constraint = getProperty(cz.cvut.sforms.Vocabulary.s_p_constraint);
public static final Property s_p_defaultValue = getProperty(cz.cvut.sforms.Vocabulary.s_p_defaultValue);
public static final Property s_p_optional = getProperty(cz.cvut.sforms.Vocabulary.s_p_optional);
public static final Property s_p_predicate_A = getProperty(Vocabulary.s_p_predicate_A);
public static final Property s_p_valueType = getProperty(cz.cvut.sforms.Vocabulary.s_p_valueType);
public static final Property s_p_minCount = getProperty(cz.cvut.sforms.Vocabulary.s_p_minCount);
public static final Property s_p_maxCount = getProperty(cz.cvut.sforms.Vocabulary.s_p_maxCount);
public static final Property s_p_constraint = getProperty(cz.cvut.sforms.Vocabulary.s_p_spl_constraint);
public static final Property s_p_defaultValue = getProperty(cz.cvut.sforms.Vocabulary.s_p_spl_defaultValue);
public static final Property s_p_optional = getProperty(cz.cvut.sforms.Vocabulary.s_p_spl_optional);
public static final Property s_p_predicate_A = getProperty(Vocabulary.s_p_spl_predicate);
public static final Property s_p_valueType = getProperty(cz.cvut.sforms.Vocabulary.s_p_spl_valueType);
public static final Property s_p_minCount = getProperty(cz.cvut.sforms.Vocabulary.s_p_spl_minCount);
public static final Property s_p_maxCount = getProperty(cz.cvut.sforms.Vocabulary.s_p_spl_maxCount);
public static final Property s_p_has_related_question = getProperty(cz.cvut.sforms.Vocabulary.s_p_has_related_question);
public static final Property s_p_has_answer = getProperty(cz.cvut.sforms.Vocabulary.s_p_has_answer);
public static final Property s_p_has_origin_path = getProperty(cz.cvut.sforms.Vocabulary.s_p_has_origin_path);
Expand Down
Loading

0 comments on commit 89bfaf7

Please sign in to comment.