From a622e4f4da70506d0fccd7f6128dedbb2e0ed73a Mon Sep 17 00:00:00 2001 From: Raitis Veinbahs Date: Fri, 5 Apr 2024 18:22:31 +0200 Subject: [PATCH] chore: Bump jena to 5.0.0 (DEV-3426) (#3170) --- project/Dependencies.scala | 2 +- .../org/knora/webapi/messages/util/rdf/JenaModel.scala | 4 ++-- .../knora/webapi/responders/admin/ListsResponder.scala | 4 ++-- .../slice/admin/repo/service/KnoraUserRepoLive.scala | 2 +- .../triplestore/api/TriplestoreServiceInMemory.scala | 9 +++++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index be2f5a3936..f82df6972f 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -19,7 +19,7 @@ object Dependencies { val PekkoActorVersion = "1.0.2" val PekkoHttpVersion = "1.0.1" - val JenaVersion = "4.10.0" + val JenaVersion = "5.0.0" val Rdf4jVersion = "4.3.10" val ZioConfigVersion = "4.0.1" diff --git a/webapi/src/main/scala/org/knora/webapi/messages/util/rdf/JenaModel.scala b/webapi/src/main/scala/org/knora/webapi/messages/util/rdf/JenaModel.scala index f9153c13e6..3373ead9b5 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/util/rdf/JenaModel.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/util/rdf/JenaModel.scala @@ -21,7 +21,7 @@ sealed trait JenaNode extends RdfNode { } case class JenaBlankNode(node: jena.graph.Node) extends JenaNode with BlankNode { - override def id: String = node.getBlankNodeId.getLabelString + override def id: String = node.getBlankNodeLabel() override def stringValue: String = id } @@ -368,7 +368,7 @@ object JenaNodeFactory { * @param language the language tag. */ def makeStringWithLanguage(value: String, language: String): StringWithLanguage = - JenaStringWithLanguage(jena.graph.NodeFactory.createLiteral(value, language)) + JenaStringWithLanguage(jena.graph.NodeFactory.createLiteralLang(value, language)) /** * Constructs a statement. diff --git a/webapi/src/main/scala/org/knora/webapi/responders/admin/ListsResponder.scala b/webapi/src/main/scala/org/knora/webapi/responders/admin/ListsResponder.scala index 6abe27e425..85507b9e0a 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/admin/ListsResponder.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/admin/ListsResponder.scala @@ -240,8 +240,8 @@ final case class ListsResponder( name = propsMap .get(KnoraBase.ListNodeName.toSmartIri) .map(_.head.asInstanceOf[StringLiteralV2].value), - labels = StringLiteralSequenceV2(labels.toVector), - comments = StringLiteralSequenceV2(comments.toVector), + labels = StringLiteralSequenceV2(labels.toVector.sorted), + comments = StringLiteralSequenceV2(comments.toVector.sorted), ).unescape } else { ListChildNodeInfoADM( diff --git a/webapi/src/main/scala/org/knora/webapi/slice/admin/repo/service/KnoraUserRepoLive.scala b/webapi/src/main/scala/org/knora/webapi/slice/admin/repo/service/KnoraUserRepoLive.scala index 5ea6819d56..dd41883e0f 100644 --- a/webapi/src/main/scala/org/knora/webapi/slice/admin/repo/service/KnoraUserRepoLive.scala +++ b/webapi/src/main/scala/org/knora/webapi/slice/admin/repo/service/KnoraUserRepoLive.scala @@ -108,7 +108,7 @@ object KnoraUserRepoLive { passwordHash, preferredLanguage, status, - isInProjectIris, + isInProjectIris.sortBy(_.value), isInGroupIris, isInSystemAdminGroup, isInProjectAdminGroupIris, diff --git a/webapi/src/test/scala/org/knora/webapi/store/triplestore/api/TriplestoreServiceInMemory.scala b/webapi/src/test/scala/org/knora/webapi/store/triplestore/api/TriplestoreServiceInMemory.scala index caca8a56c8..de2202ae08 100644 --- a/webapi/src/test/scala/org/knora/webapi/store/triplestore/api/TriplestoreServiceInMemory.scala +++ b/webapi/src/test/scala/org/knora/webapi/store/triplestore/api/TriplestoreServiceInMemory.scala @@ -4,12 +4,13 @@ */ package org.knora.webapi.store.triplestore.api + import org.apache.jena.query._ import org.apache.jena.rdf.model import org.apache.jena.rdf.model.Model import org.apache.jena.rdf.model.ModelFactory import org.apache.jena.riot.RDFDataMgr -import org.apache.jena.tdb.TDB +import org.apache.jena.tdb1.TDB1 import org.apache.jena.tdb2.TDB2Factory import org.apache.jena.update.UpdateExecutionFactory import org.apache.jena.update.UpdateFactory @@ -263,7 +264,7 @@ final case class TriplestoreServiceInMemory(datasetRef: Ref[Dataset], implicit v override def printDataset(prefix: String = ""): UIO[Unit] = for { -// _ <- Console.printLine(s"TDB Context:\n${TDB.getContext}\n").orDie +// _ <- Console.printLine(s"TDB Context:\n${TDB1.getContext}\n").orDie ds <- getDataset _ <- Console.printLine(s"${prefix}TriplestoreServiceInMemory.printDataset:").orDie _ = printDatasetContents(ds) @@ -314,14 +315,14 @@ object TriplestoreServiceInMemory { .flatMap(TriplestoreServiceInMemory.setDataset) /** - * Creates an empty TBD2 [[Dataset]]. + * Creates an empty TDB2 [[Dataset]]. * * Currently does not (yet) support create a [[Dataset]] which supports Lucene indexing. * TODO: https://jena.apache.org/documentation/query/text-query.html#configuration-by-code */ val createEmptyDataset: UIO[Dataset] = ZIO - .succeed(TDB.getContext.set(TDB.symUnionDefaultGraph, true)) + .succeed(TDB1.getContext.set(TDB1.symUnionDefaultGraph, true)) .as(TDB2Factory.createDataset()) val emptyDatasetRefLayer: ULayer[Ref[Dataset]] = ZLayer.fromZIO(createEmptyDataset.flatMap(Ref.make(_)))