Skip to content
Permalink
Browse files
build: fix warnings (DEV-80) (#1929)
* WIP - fix deprecation warnings

* WIP - fix more warns

* WIP - fix more warns

* WIP - fix more warns

* sonar

* review changes

* fix graph + edge
  • Loading branch information
mpro7 committed Nov 2, 2021
1 parent a24a320 commit 136876910d1991ff0e0749c92e702f3bf438247f
@@ -2326,7 +2326,7 @@ class StringFormatter private (
errorFun: => Nothing
): IRI = {
val ontologyIri = xmlImportNamespaceToInternalOntologyIriV1(namespace, errorFun)
ontologyIri + "#" + elementLabel
ontologyIri.toString + "#" + elementLabel
}

/**
@@ -441,7 +441,8 @@ object PermissionUtilADM extends LazyLogging {
throw InconsistentRepositoryDataException(s"invalid permission literal: $permissionLiteral")
}
): Map[EntityPermission, Set[IRI]] = {
val permissions: Seq[String] = permissionLiteral.split(OntologyConstants.KnoraBase.PermissionListDelimiter)
val permissions: Seq[String] =
permissionLiteral.split(OntologyConstants.KnoraBase.PermissionListDelimiter).toIndexedSeq

permissions.map { permission =>
val splitPermission: Array[String] = permission.split(' ')
@@ -481,7 +482,7 @@ object PermissionUtilADM extends LazyLogging {
{
val cleanedPermissionListStr = permissionListStr.replaceAll("[<>]", "")
val permissions: Seq[String] =
cleanedPermissionListStr.split(OntologyConstants.KnoraBase.PermissionListDelimiter)
cleanedPermissionListStr.split(OntologyConstants.KnoraBase.PermissionListDelimiter).toIndexedSeq
logger.debug(s"PermissionUtil.parsePermissionsWithType - split permissions: $permissions")
permissions.flatMap { permission =>
val splitPermission = permission.split(' ')
@@ -6,15 +6,14 @@
package org.knora.webapi.messages.util.search.gravsearch.prequery

import org.knora.webapi.ApiV2Schema
import org.knora.webapi.exceptions.AssertionException
import org.knora.webapi.feature.{Feature, FeatureFactory, FeatureFactoryConfig}
import org.knora.webapi.messages.{OntologyConstants, SmartIri}
import org.knora.webapi.messages.util.search._
import org.knora.webapi.messages.util.search.gravsearch.types.{
GravsearchTypeInspectionResult,
GravsearchTypeInspectionUtil,
TypeableEntity
}
import org.knora.webapi.messages.{OntologyConstants, SmartIri}
import scalax.collection.Graph
import scalax.collection.GraphEdge.DiHyperEdge

@@ -256,9 +255,10 @@ class ReorderPatternsByDependencyOptimisationFeature(
private def createAndSortGraph(statementPatterns: Seq[StatementPattern]): Seq[QueryPattern] = {
@scala.annotation.tailrec
def makeGraphWithoutCycles(graphComponents: Seq[(String, String)]): Graph[String, DiHyperEdge] = {
val graph = graphComponents.foldLeft(Graph.empty[String, DiHyperEdge]) { (graph, edgeDef) =>
val edge = DiHyperEdge(edgeDef._1, edgeDef._2)
graph + edge // add nodes and edges to graph
val graph: Graph[String, DiHyperEdge] = graphComponents.foldLeft(Graph.empty[String, DiHyperEdge]) {
(graph, edgeDef) =>
val edge: DiHyperEdge[String] = DiHyperEdge(edgeDef._1, edgeDef._2)
graph ++ Vector(edge) // add nodes and edges to graph
}

if (graph.isCyclic) {
@@ -5,9 +5,6 @@

package org.knora.webapi.messages.util.standoff

import java.time.Instant
import java.util.UUID

import akka.actor.ActorRef
import akka.event.LoggingAdapter
import akka.pattern.ask
@@ -30,6 +27,8 @@ import org.knora.webapi.messages.v2.responder.standoffmessages._
import org.knora.webapi.messages.{OntologyConstants, SmartIri, StringFormatter}
import org.knora.webapi.settings.KnoraSettingsImpl

import java.time.Instant
import java.util.UUID
import scala.concurrent.{ExecutionContext, Future}

object StandoffTagUtilV2 {
@@ -1308,7 +1307,7 @@ object StandoffTagUtilV2 {
conventionalAttributes
) :+ StandoffTagAttribute(
key = dataTypeAttrName,
value = StandoffTagUtilV2.internalLinkMarker + internalRefTarget,
value = StandoffTagUtilV2.internalLinkMarker.toString + internalRefTarget,
xmlNamespace = None
)

@@ -2839,7 +2839,7 @@ case class ReadClassInfoV2(
propertyIri
}.sortBy { case (_, cardinalityInfo: KnoraCardinalityInfo) =>
cardinalityInfo.guiOrder
}.map { case (propertyIri: SmartIri, cardinalityInfo: KnoraCardinalityInfo) =>
}.toIndexedSeq.map { case (propertyIri: SmartIri, cardinalityInfo: KnoraCardinalityInfo) =>
val prop2card: (IRI, JsonLDInt) = cardinalityInfo.cardinality match {
case Cardinality.MayHaveMany => OntologyConstants.Owl.MinCardinality -> JsonLDInt(0)
case Cardinality.MayHaveOne => OntologyConstants.Owl.MaxCardinality -> JsonLDInt(1)
@@ -2904,7 +2904,7 @@ case class ReadClassInfoV2(
} ++ owlCardinalities

val jsonSubClassOfStatement: Option[(IRI, JsonLDArray)] = if (jsonSubClassOf.nonEmpty) {
Some(OntologyConstants.Rdfs.SubClassOf -> JsonLDArray(jsonSubClassOf))
Some(OntologyConstants.Rdfs.SubClassOf -> JsonLDArray(jsonSubClassOf.toIndexedSeq))
} else {
None
}
@@ -3063,7 +3063,7 @@ case class ReadPropertyInfoV2(
case objs if objs.nonEmpty =>
Some(
OntologyConstants.SalsahGuiApiV2WithValueObjects.GuiAttribute -> JsonLDArray(
objs.toArray.sorted.map(JsonLDString)
objs.toArray.sorted.map(JsonLDString).toIndexedSeq
)
)

@@ -170,7 +170,7 @@ class CkanResponderV1(responderData: ResponderData) extends Responder(responderD
val propsMap = flattenProps(props)
CkanProjectDatasetV1(
ckan_title = propsMap.getOrElse("Description", ""),
ckan_tags = propsMap.getOrElse("Title", "").split("/").map(_.trim),
ckan_tags = propsMap.getOrElse("Title", "").split("/").toIndexedSeq.map(_.trim),
files = Vector(
CkanProjectDatasetFileV1(
ckan_title = propsMap.getOrElse("preview_loc_origname", ""),
@@ -1399,8 +1399,12 @@ class ResourcesResponderV1(responderData: ResponderData) extends Responder(respo
}

// create a list of three tuples, sort it by guiOrder and valueOrder and return only string values
val values: Seq[String] =
(valueStrings, guiOrders, valueOrders).zipped.toVector.sortBy(row => (row._2, row._3)).map(_._1)
val values: Seq[String] = valueStrings
.lazyZip(guiOrders)
.lazyZip(valueOrders)
.toVector
.sortBy(row => (row._2, row._3))
.map(_._1)

// ?values is given: it is one string to be split by separator
val propValues = values.foldLeft(Vector(firstProp)) { case (acc, prop: String) =>
@@ -3372,7 +3376,7 @@ class ResourcesResponderV1(responderData: ResponderData) extends Responder(respo
private def convertPropertyV1toPropertyGetV1(propertyV1: PropertyV1): PropertyGetV1 = {

val valueObjects: Seq[PropertyGetValueV1] =
(propertyV1.value_ids, propertyV1.values, propertyV1.comments).zipped.map {
propertyV1.value_ids.lazyZip(propertyV1.values).lazyZip(propertyV1.comments).map {
case (id: IRI, value: ApiValueV1, comment: Option[String]) =>
PropertyGetValueV1(
id = id,
Loading

0 comments on commit 1368769

Please sign in to comment.