diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index af063bed..37e72c0d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,15 +20,15 @@ jobs: environment: sonatype steps: - # Checks-out the repository under $GITHUB_WORKSPACE - - uses: actions/checkout@v2 + - name: Check out the repo + uses: actions/checkout@v4.1.1 # Sets up JDK - - name: Set up JDK 11 - uses: actions/setup-java@v3.4.0 + - name: Set up JDK + uses: actions/setup-java@v4.0.0 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Runs the Maven build - name: Build and deploy with Maven diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 28f4cfb2..9ad73a19 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,14 +19,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 # Sets up JDK - - name: Set up JDK 11 - uses: actions/setup-java@v3.4.0 + - name: Set up JDK + uses: actions/setup-java@v4.0.0 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Runs the Maven build - name: Build server with Maven diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 18edc4cf..8750180b 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -17,15 +17,15 @@ jobs: runs-on: ubuntu-latest steps: - # Checks-out the repository under $GITHUB_WORKSPACE - - uses: actions/checkout@v2 + - name: Check out the repo + uses: actions/checkout@v4.1.1 # Sets up JDK - - name: Set up JDK 11 - uses: actions/setup-java@v3.4.0 + - name: Set up JDK + uses: actions/setup-java@v4.0.0 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Runs the Maven build - name: Build and verify with Maven diff --git a/bundles/io.github.linkedfactory.core/pom.xml b/bundles/io.github.linkedfactory.core/pom.xml index e2d7dcf3..4f3f8e86 100644 --- a/bundles/io.github.linkedfactory.core/pom.xml +++ b/bundles/io.github.linkedfactory.core/pom.xml @@ -19,13 +19,13 @@ org.osgi osgi.core - 6.0.0 + 7.0.0 provided org.osgi osgi.cmpn - 6.0.0 + 7.0.0 provided @@ -151,7 +151,7 @@ com.google.guava guava - 30.1.1-jre + 32.1.3-jre net.enilink.komma diff --git a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/ModelModule.java b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/ModelModule.java index 02fcb9e2..9aa5f022 100644 --- a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/ModelModule.java +++ b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/ModelModule.java @@ -6,8 +6,5 @@ public class ModelModule extends KommaModule { { addBehaviour(KvinMemoryModelSet.class); addBehaviour(KvinPersistentModelSet.class); - addBehaviour(RepositoryManagerModelSet.class); - addBehaviour(Rdf4jModelSet.class); } - } diff --git a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/Rdf4jModelSet.java b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/Rdf4jModelSet.java deleted file mode 100644 index be8a5b12..00000000 --- a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/Rdf4jModelSet.java +++ /dev/null @@ -1,64 +0,0 @@ -package io.github.linkedfactory.core.komma; - -import net.enilink.commons.iterator.IExtendedIterator; -import net.enilink.composition.annotations.Iri; -import net.enilink.komma.core.*; -import net.enilink.komma.model.MODELS; -import net.enilink.komma.model.rdf4j.MemoryModelSetSupport; -import net.enilink.komma.rdf4j.RDF4JValueConverter; -import org.apache.http.auth.AUTH; -import org.eclipse.rdf4j.model.Model; -import org.eclipse.rdf4j.model.impl.LinkedHashModel; -import org.eclipse.rdf4j.model.impl.SimpleValueFactory; -import org.eclipse.rdf4j.repository.Repository; -import org.eclipse.rdf4j.repository.RepositoryException; -import org.eclipse.rdf4j.repository.config.*; -import org.eclipse.rdf4j.repository.manager.LocalRepositoryManager; - -import java.io.File; -import java.util.*; - -@Iri(MODELS.NAMESPACE + "Rdf4jModelSet") -public abstract class Rdf4jModelSet extends MemoryModelSetSupport { - @Iri(MODELS.NAMESPACE + "repository") - public abstract IReference getRepository(); - - public Repository createRepository() throws RepositoryException { - IEntityManager manager = ((IEntity) getBehaviourDelegate()).getEntityManager(); - RDF4JValueConverter converter = new RDF4JValueConverter(SimpleValueFactory.getInstance()); - Model configModel = new LinkedHashModel(); - try (IExtendedIterator stmts = manager - .createQuery("construct { ?s ?p ?o } where { ?repository (!<:>)* ?s . ?s ?p ?o }") - .setParameter("repository", getRepository()) - .evaluateRestricted(IStatement.class)) { - stmts.forEach(stmt -> { - configModel.add(converter.toRdf4j(stmt)); - }); - } - Set repositoryIDs = RepositoryConfigUtil.getRepositoryIDs(configModel); - if (repositoryIDs.isEmpty()) { - throw new KommaException("No repository ID in configuration: " + getRepository()); - } - if (repositoryIDs.size() != 1) { - throw new KommaException("Multiple repository IDs in configuration: " + getRepository()); - } - RepositoryConfig repoConfig = RepositoryConfigUtil.getRepositoryConfig(configModel, - repositoryIDs.iterator().next()); - RepositoryImplConfig implConfig = repoConfig.getRepositoryImplConfig(); - if (implConfig == null) { - throw new KommaException("No implementation config in configuration: " + getRepository()); - } - RepositoryFactory factory = RepositoryRegistry.getInstance().get(implConfig.getType()).orElseThrow(() -> { - return new RepositoryConfigException("Unsupported repository type: " + implConfig.getType()); - }); - Repository repository = factory.getRepository(implConfig); - repository.init(); - addBasicKnowledge(repository); - return repository; - } - - @Override - public boolean isPersistent() { - return true; - } -} diff --git a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/RepositoryManagerModelSet.java b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/RepositoryManagerModelSet.java deleted file mode 100644 index 19451772..00000000 --- a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/komma/RepositoryManagerModelSet.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.github.linkedfactory.core.komma; - -import net.enilink.composition.annotations.Iri; -import net.enilink.komma.core.EntityVar; -import net.enilink.komma.core.IReference; -import net.enilink.komma.model.MODELS; -import net.enilink.komma.model.rdf4j.MemoryModelSetSupport; -import org.eclipse.rdf4j.repository.Repository; -import org.eclipse.rdf4j.repository.RepositoryException; -import org.eclipse.rdf4j.repository.manager.LocalRepositoryManager; - -import java.io.File; -import java.util.Collections; - -@Iri(MODELS.NAMESPACE + "RepositoryManagerModelSet") -public abstract class RepositoryManagerModelSet extends MemoryModelSetSupport { - EntityVar manager; - - @Iri(MODELS.NAMESPACE + "baseDir") - public abstract Object getBaseDir(); - - @Iri(MODELS.NAMESPACE + "repositoryID") - public abstract String getRepositoryID(); - - public Repository createRepository() throws RepositoryException { - Object baseDir = getBaseDir(); - File file; - if (baseDir instanceof IReference && (((IReference) baseDir)).getURI() != null - && (((IReference) baseDir)).getURI().isFile()) { - file = new File((((IReference) baseDir)).getURI().toFileString()); - } else { - file = new File(baseDir.toString()); - } - LocalRepositoryManager repoManager = new LocalRepositoryManager(file) { - @Override - public void shutDown() { - // prevent manager from shutting down the repositories as this already handled by KOMMA - setInitializedRepositories(Collections.emptyMap()); - super.shutDown(); - } - }; - repoManager.init(); - manager.set(repoManager); - Repository repository = manager.get().getRepository(getRepositoryID()); - repository.init(); - addBasicKnowledge(repository); - return repository; - } - - @Override - public void dispose() { - LocalRepositoryManager m = manager.get(); - if (m != null) { - m.shutDown(); - } - manager.remove(); - } - - @Override - public boolean isPersistent() { - return true; - } -} diff --git a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java index dbe1e35e..6394b1cc 100644 --- a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java +++ b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java @@ -13,6 +13,7 @@ import net.enilink.komma.core.URI; import net.enilink.komma.core.URIs; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.parquet.avro.AvroParquetReader; import org.apache.parquet.filter2.compat.FilterCompat; diff --git a/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/Rdf4jModelSetTest.java b/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/KvinModelSetTest.java similarity index 90% rename from bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/Rdf4jModelSetTest.java rename to bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/KvinModelSetTest.java index 39cd03e2..8e6908e0 100644 --- a/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/Rdf4jModelSetTest.java +++ b/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/KvinModelSetTest.java @@ -8,7 +8,7 @@ import org.junit.Assert; import org.junit.Test; -public class Rdf4jModelSetTest { +public class KvinModelSetTest { @Test public void testBasicConfig() { // create configuration and a model set factory @@ -16,7 +16,7 @@ public void testBasicConfig() { IModelSetFactory factory = Guice.createInjector(new ModelSetModule(module)).getInstance(IModelSetFactory.class); IGraph config = new LinkedHashGraph(); - ModelUtil.readData(getClass().getResourceAsStream("/rdf4j-modelset-config.ttl"), null, + ModelUtil.readData(getClass().getResourceAsStream("/kvin-modelset-config.ttl"), null, "text/turtle", new IDataVisitor() { @Override public Object visitBegin() { diff --git a/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/RepositoryManagerModelSetTest.java b/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/RepositoryManagerModelSetTest.java deleted file mode 100644 index cc2125de..00000000 --- a/bundles/io.github.linkedfactory.core/src/test/java/io/github/linkedfactory/core/rdf4j/RepositoryManagerModelSetTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.github.linkedfactory.core.rdf4j; - -import com.google.inject.Guice; -import net.enilink.komma.core.*; -import net.enilink.komma.model.*; -import net.enilink.vocab.owl.Restriction; -import net.enilink.vocab.rdf.RDF; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; - -public class RepositoryManagerModelSetTest { - Path tempDir; - - @Before - public void setup() throws IOException { - tempDir = Files.createTempDirectory("repomanager-modelset"); - } - - @After - public void cleanup() throws IOException { - FileUtils.deleteDirectory(tempDir.toFile()); - } - - @Test - public void testMemoryConfig() throws IOException { - Path repoDir = tempDir.resolve("repositories").resolve("memory"); - Files.createDirectories(repoDir); - Files.copy(getClass().getResourceAsStream("/kvin-memory-config.ttl"), repoDir.resolve("config.ttl")); - - // create configuration and a model set factory - KommaModule module = ModelPlugin.createModelSetModule(getClass().getClassLoader()); - IModelSetFactory factory = Guice.createInjector(new ModelSetModule(module)).getInstance(IModelSetFactory.class); - - IGraph config = new LinkedHashGraph(); - URI msUri = URIs.createURI("urn:enilink:data"); - config.add(msUri, RDF.PROPERTY_TYPE, MODELS.NAMESPACE_URI.appendFragment("RepositoryManagerModelSet")); - config.add(msUri, MODELS.NAMESPACE_URI.appendFragment("baseDir"), URIs.createURI(tempDir.toUri().toString())); - config.add(msUri, MODELS.NAMESPACE_URI.appendFragment("repositoryID"), "memory"); - - IModelSet modelSet = factory.createModelSet(msUri, config); - Assert.assertTrue(modelSet.createModel(URIs.createURI("test:model")) - .getManager().create(Restriction.class) instanceof Restriction); - modelSet.dispose(); - } -} diff --git a/bundles/io.github.linkedfactory.core/src/test/resources/kvin-memory-config.ttl b/bundles/io.github.linkedfactory.core/src/test/resources/kvin-memory-config.ttl deleted file mode 100644 index a755fd7b..00000000 --- a/bundles/io.github.linkedfactory.core/src/test/resources/kvin-memory-config.ttl +++ /dev/null @@ -1,20 +0,0 @@ -@prefix rdfs: . -@prefix rep: . -@prefix sr: . -@prefix sail: . -@prefix ms: . -@prefix sb: . - -[] a rep:Repository ; - rep:repositoryID "memory" ; - rdfs:label "LinkedFactory data repository" ; - rep:repositoryImpl [ - rep:repositoryType "openrdf:SailRepository" ; - sr:sailImpl [ - sail:sailType "kvin:KvinSail" ; - sail:delegate [ - sail:sailType "openrdf:MemoryStore" ; - ms:persist false - ] - ] - ]. \ No newline at end of file diff --git a/bundles/io.github.linkedfactory.core/src/test/resources/rdf4j-modelset-config.ttl b/bundles/io.github.linkedfactory.core/src/test/resources/kvin-modelset-config.ttl similarity index 94% rename from bundles/io.github.linkedfactory.core/src/test/resources/rdf4j-modelset-config.ttl rename to bundles/io.github.linkedfactory.core/src/test/resources/kvin-modelset-config.ttl index c6442f11..4b4bfca9 100644 --- a/bundles/io.github.linkedfactory.core/src/test/resources/rdf4j-modelset-config.ttl +++ b/bundles/io.github.linkedfactory.core/src/test/resources/kvin-modelset-config.ttl @@ -6,7 +6,7 @@ @prefix sb: . @prefix models: . - a models:Rdf4jModelSet ; + a models:RepositoryModelSet ; models:repository . a rep:Repository ; diff --git a/bundles/io.github.linkedfactory.service/pom.xml b/bundles/io.github.linkedfactory.service/pom.xml index a497d846..d1dc5bf9 100644 --- a/bundles/io.github.linkedfactory.service/pom.xml +++ b/bundles/io.github.linkedfactory.service/pom.xml @@ -32,13 +32,13 @@ org.osgi osgi.core - 6.0.0 + 7.0.0 provided org.osgi osgi.cmpn - 6.0.0 + 7.0.0 provided diff --git a/docker/Dockerfile b/docker/Dockerfile index a4216023..d7c3415c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM adoptopenjdk:11-jre-hotspot +FROM eclipse-temurin:17-alpine EXPOSE 8080 # Add linkedfactory-pod server diff --git a/pom.xml b/pom.xml index 6dfdebf3..f4da1be5 100644 --- a/pom.xml +++ b/pom.xml @@ -16,12 +16,13 @@ UTF-8 - 1.7.4 - 1.5.4 + 1.8.0-SNAPSHOT + 1.6.0-SNAPSHOT 2.13 - 2.13.2 - 4.4.0 - 4.4.0 + 2.13.12 + 4.8.1 + 4.4.4 + 4.4.4 6.3.1 scm:git:git://github.com:linkedfactory/linkedfactory-pod.git @@ -40,7 +41,7 @@ net.alchim31.maven scala-maven-plugin - 4.5.4 + ${scala.plugin.version} ${scala.version} @@ -75,9 +76,9 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.12.1 - 11 + 17 @@ -234,7 +235,7 @@
releng/license-header.txt
LinkedFactory contributors - 2022 + 2024 src/*/java/**/*.java