Skip to content

Commit

Permalink
[#308] Migrate jopa from 0.19.3 to 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Mar 6, 2025
1 parent 65f8da5 commit b3cab41
Show file tree
Hide file tree
Showing 17 changed files with 729 additions and 851 deletions.
53 changes: 6 additions & 47 deletions s-pipes-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
<groupId>cz.cvut.kbss.jopa</groupId>
<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>

<build>
Expand All @@ -133,53 +139,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,8 +56,12 @@ public class AdvancedLoggingProgressListener implements ProgressListener {
private static final Map<String, Object> metadataMap = new HashMap<>();
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";
private static final String P_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 @@ -29,12 +29,12 @@ 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(Rdf4jOntoDriverProperties.USE_VOLATILE_STORAGE, Boolean.TRUE.toString());
// Don't use Sesame inference
// Don't use inference
props.put(Rdf4jOntoDriverProperties.USE_INFERENCE, Boolean.FALSE.toString());
// Ontology language
props.put(JOPAPersistenceProperties.LANG, "en");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import cz.cvut.kbss.jopa.model.JOPAPersistenceProvider;
import cz.cvut.kbss.ontodriver.config.OntoDriverProperties;
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,7 +31,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import cz.cvut.spipes.Vocabulary;
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.engine.ProgressListener;
import cz.cvut.spipes.model.*;
import cz.cvut.spipes.model.ModuleExecution;
import cz.cvut.spipes.model.PipelineExecution;
import cz.cvut.spipes.model.SourceDatasetSnapshot;
import cz.cvut.spipes.model.Thing;
import cz.cvut.spipes.modules.Module;
import cz.cvut.spipes.util.TempFileUtils;
import cz.cvut.spipes.util.JenaUtils;
import cz.cvut.spipes.util.TempFileUtils;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.eclipse.rdf4j.model.Statement;
Expand Down Expand Up @@ -47,6 +50,10 @@ 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";
private static final String P_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
74 changes: 33 additions & 41 deletions s-pipes-forms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
<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>
Expand All @@ -23,13 +30,35 @@
<groupId>cz.cvut.kbss.jopa</groupId>
<artifactId>jopa-impl</artifactId>
</dependency>

<!-- Jena -->
<dependency>
<groupId>cz.cvut.kbss</groupId>
<artifactId>s-pipes-core</artifactId>
<version>${project.parent.version}</version>
<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 @@ -200,43 +229,6 @@
<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>
</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 b3cab41

Please sign in to comment.