Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prepare 2.45.0 #1778

Merged
merged 12 commits into from
Nov 6, 2023
6 changes: 3 additions & 3 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand All @@ -60,7 +60,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand All @@ -81,7 +81,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand All @@ -45,7 +45,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand All @@ -66,7 +66,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand All @@ -93,7 +93,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup cache
uses: actions/cache@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.renku.graph.model.testentities
import io.renku.tinytypes._
import io.renku.tinytypes.constraints._

import java.net.{MalformedURLException, URL}
import java.net.URI

final case class Project(entitiesProject: testentities.RenkuProject,
id: GitLabId,
Expand Down Expand Up @@ -120,7 +120,7 @@ object Project {
addConstraint(
check = url =>
(url endsWith ".git") && Validated
.catchOnly[MalformedURLException](new URL(url))
.catchOnly[IllegalArgumentException](new URI(url).toURL)
.isValid,
message = url => s"$url is not a valid repository http url"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import io.renku.graph.model._
import io.renku.graph.model.events.CommitId
import io.renku.jsonld.JsonLD

import java.net.URL
import java.net.URI

trait RemoteTriplesGenerator {
self: ApplicationServices =>
Expand Down Expand Up @@ -122,9 +122,9 @@ trait RemoteTriplesGenerator {
private object RemoteTriplesGeneratorWiremockInstance {
private val logger = TestLogger()

private val remoteTriplesGeneratorUrl = new URL(
private val remoteTriplesGeneratorUrl = new URI(
ConfigFactory.load().getString("services.remote-triples-generator.url")
)
).toURL

private val port: Int = remoteTriplesGeneratorUrl.getPort

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ lazy val commonSettings = Seq(
// Format: on
organizationName := "Swiss Data Science Center (SDSC)",
startYear := Some(java.time.LocalDate.now().getYear),
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")),
licenses += ("Apache-2.0", new URI("https://www.apache.org/licenses/LICENSE-2.0.txt").toURL),
headerLicense := Some(
HeaderLicense.Custom(
s"""|Copyright ${java.time.LocalDate.now().getYear} Swiss Data Science Center (SDSC)
Expand Down
4 changes: 2 additions & 2 deletions commit-event-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a multi-stage build, see reference:
# https://docs.docker.com/develop/develop-images/multistage-build/

FROM eclipse-temurin:17-jre-alpine as builder
FROM eclipse-temurin:21-jre-alpine as builder

WORKDIR /work

Expand All @@ -16,7 +16,7 @@ RUN export PATH="/usr/local/sbt/bin:$PATH" && \
sbt "project commit-event-service" stage && \
apk del .build-dependencies

FROM eclipse-temurin:17-jre-alpine
FROM eclipse-temurin:21-jre-alpine

WORKDIR /opt/commit-event-service

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,13 @@ private object DatasetInfoDeleteQuery {
Prefixes of (renku -> "renku", schema -> "schema"),
sparql"""|DELETE {
| GRAPH ${GraphClass.Datasets.id} {
| ?imageId ?imagePred ?imageObj.
| ?linkId ?linkPred ?linkObj.
| ?topSameAs ?dsPred ?dsObj.
| }
|}
|WHERE {
| GRAPH ${GraphClass.Datasets.id} {
| BIND (${topmostSameAs.asEntityId} AS ?topSameAs)
|
| OPTIONAL {
| ?topSameAs schema:image ?imageId.
| ?imageId ?imagePred ?imageObj.
| }

| OPTIONAL {
| ?topSameAs renku:datasetProjectLink ?linkId.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package commands
import DatasetSearchInfoOntology._
import Link.{ImportedDataset, OriginalDataset}
import cats.syntax.all._
import io.renku.entities.searchgraphs.toConcatValue
import io.renku.entities.searchgraphs.maybeTripleObject
import io.renku.graph.model.Schemas.{rdf, renku}
import io.renku.graph.model.images.Image
import io.renku.graph.model.{datasets, persons}
Expand All @@ -33,14 +33,6 @@ import io.renku.triplesstore.client.syntax._

private[datasets] object Encoders {

implicit val imageEncoder: QuadsEncoder[Image] = QuadsEncoder.instance { case Image(resourceId, uri, position) =>
Set(
DatasetsQuad(resourceId, rdf / "type", Image.Ontology.typeClass.id),
DatasetsQuad(resourceId, Image.Ontology.contentUrlProperty.id, uri.asObject),
DatasetsQuad(resourceId, Image.Ontology.positionProperty.id, position.asObject)
)
}

implicit val linkEncoder: QuadsEncoder[Link] = QuadsEncoder.instance { link =>
val typeQuads = link match {
case _: OriginalDataset =>
Expand All @@ -59,7 +51,7 @@ private[datasets] object Encoders {

implicit val projectsVisibilitiesConcatEncoder: QuadsEncoder[(datasets.TopmostSameAs, List[Link])] =
QuadsEncoder.instance { case (topSameAs, links) =>
toConcatValue[Link](links, link => s"${link.projectSlug.value}:${link.visibility.value}")
maybeTripleObject[Link](links, link => s"${link.projectSlug.value}:${link.visibility.value}")
.map(DatasetsQuad(topSameAs, projectsVisibilitiesConcatProperty.id, _))
.toSet
}
Expand All @@ -69,7 +61,7 @@ private[datasets] object Encoders {
DatasetsQuad(info.topmostSameAs, predicate, obj)

def maybeConcatQuad[A](property: Property, values: List[A], toValue: A => String): Option[Quad] =
toConcatValue(values, toValue).map(searchInfoQuad(property, _))
maybeTripleObject(values, toValue).map(searchInfoQuad(property, _))

val createdOrPublishedQuad = info.createdOrPublished match {
case d: datasets.DateCreated =>
Expand All @@ -93,18 +85,9 @@ private[datasets] object Encoders {
val maybeCreatorsNamesConcatQuad =
maybeConcatQuad[persons.Name](creatorsNamesConcatProperty.id, info.creators.toList.map(_.name).distinct, _.value)

val keywordsQuads = info.keywords.toSet.map { (k: datasets.Keyword) =>
searchInfoQuad(keywordsProperty.id, k.asObject)
}

val maybeKeywordsConcatQuad =
maybeConcatQuad[datasets.Keyword](keywordsConcatProperty.id, info.keywords.distinct, _.value)

val imagesQuads = info.images.toSet.flatMap { (i: Image) =>
i.asQuads +
searchInfoQuad(imageProperty, i.resourceId.asEntityId)
}

val maybeImagesConcatQuad =
maybeConcatQuad[Image](imagesConcatProperty.id,
info.images,
Expand All @@ -129,6 +112,6 @@ private[datasets] object Encoders {
maybeCreatorsNamesConcatQuad,
maybeKeywordsConcatQuad,
maybeImagesConcatQuad
).flatten ++ projectsVisibilitiesConcatQuads ++ creatorsQuads ++ keywordsQuads ++ imagesQuads ++ linksQuads
).flatten ++ projectsVisibilitiesConcatQuads ++ creatorsQuads ++ linksQuads
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package io.renku.entities.searchgraphs.datasets

import io.renku.graph.model.Schemas.{xsd, _}
import io.renku.graph.model.entities.{Dataset, Person, Project}
import io.renku.graph.model.images.Image
import io.renku.jsonld.Property
import io.renku.jsonld.ontology._

Expand All @@ -31,12 +30,10 @@ object DatasetSearchInfoOntology {
val dateCreatedProperty: DataProperty.Def = Dataset.Ontology.dateCreatedProperty
val datePublishedProperty: DataProperty.Def = Dataset.Ontology.datePublishedProperty
val dateModifiedProperty: DataProperty.Def = DataProperty(schema / "dateModified", xsd / "dateTime")
val keywordsProperty: DataProperty.Def = Dataset.Ontology.keywordsProperty
val keywordsConcatProperty: DataProperty.Def = DataProperty(renku / "keywordsConcat", xsd / "string")
val descriptionProperty: DataProperty.Def = Dataset.Ontology.descriptionProperty
val creatorProperty: Property = Dataset.Ontology.creator
val creatorsNamesConcatProperty: DataProperty.Def = DataProperty(renku / "creatorsNamesConcat", xsd / "string")
val imageProperty: Property = Dataset.Ontology.image
val imagesConcatProperty: DataProperty.Def = DataProperty(renku / "imagesConcat", xsd / "string")
val linkProperty: Property = renku / "datasetProjectLink"
val projectsVisibilitiesConcatProperty: DataProperty.Def =
Expand All @@ -46,7 +43,6 @@ object DatasetSearchInfoOntology {
Class(renku / "DiscoverableDataset"),
ObjectProperties(
ObjectProperty(creatorProperty, Person.Ontology.typeDef),
ObjectProperty(imageProperty, Image.Ontology.typeDef),
ObjectProperty(linkProperty, LinkOntology.typeDef)
),
DataProperties(
Expand All @@ -55,7 +51,6 @@ object DatasetSearchInfoOntology {
dateCreatedProperty,
datePublishedProperty,
dateModifiedProperty,
keywordsProperty,
keywordsConcatProperty,
descriptionProperty,
creatorsNamesConcatProperty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import io.renku.triplesstore.client.syntax._
package object searchgraphs {
val concatSeparator: Char = ';'

private[searchgraphs] def toConcatValue[A](values: List[A], toValue: A => String): Option[TripleObject] =
private[searchgraphs] def maybeTripleObject[A](values: List[A], toValue: A => String): Option[TripleObject] =
values match {
case Nil => Option.empty[TripleObject]
case vls =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@ import io.renku.jsonld.syntax._
import io.renku.triplesstore.client.model.{Quad, QuadsEncoder, TripleObject}
import io.renku.triplesstore.client.syntax._

private object Encoders {
object Encoders {

implicit val imageEncoder: QuadsEncoder[Image] = QuadsEncoder.instance { case Image(resourceId, uri, position) =>
Set(
ProjectsQuad(resourceId, rdf / "type", Image.Ontology.typeClass.id),
ProjectsQuad(resourceId, Image.Ontology.contentUrlProperty.id, uri.asObject),
ProjectsQuad(resourceId, Image.Ontology.positionProperty.id, position.asObject)
)
}
def maybeKeywordsObject(keywords: List[projects.Keyword]): Option[TripleObject] =
maybeTripleObject[projects.Keyword](keywords.distinct, _.value)

def maybeKeywordsQuad(id: projects.ResourceId, keywords: List[projects.Keyword]): Option[Quad] =
maybeKeywordsObject(keywords).map(ProjectsQuad(id, keywordsConcatProperty.id, _))

def maybeImagesObject(images: List[Image]): Option[TripleObject] =
maybeTripleObject[Image](images, image => s"${image.position.value}:${image.uri.value}")

def maybeImagesQuad(id: projects.ResourceId, images: List[Image]): Option[Quad] =
maybeImagesObject(images).map(ProjectsQuad(id, imagesConcatProperty.id, _))

implicit val searchInfoEncoder: QuadsEncoder[ProjectSearchInfo] = QuadsEncoder.instance { info =>
private[commands] implicit val searchInfoEncoder: QuadsEncoder[ProjectSearchInfo] = QuadsEncoder.instance { info =>
def searchInfoQuad(predicate: Property, obj: TripleObject): Quad =
ProjectsQuad(info.id, predicate, obj)

def maybeConcatQuad[A](property: Property, values: List[A], toValue: A => String): Option[Quad] =
toConcatValue(values, toValue).map(searchInfoQuad(property, _))

val maybeDescriptionQuad = info.maybeDescription.map { d =>
searchInfoQuad(descriptionProperty.id, d.asObject)
}
Expand All @@ -55,22 +56,9 @@ private object Encoders {
searchInfoQuad(creatorProperty, resourceId.asEntityId)
}

val keywordsQuads = info.keywords.toSet.map { (k: projects.Keyword) =>
searchInfoQuad(keywordsProperty.id, k.asObject)
}

val maybeKeywordsConcatQuad =
maybeConcatQuad[projects.Keyword](keywordsConcatProperty.id, info.keywords.distinct, _.value)

val imagesQuads = info.images.toSet.flatMap { (i: Image) =>
i.asQuads + searchInfoQuad(imageProperty, i.resourceId.asEntityId)
}
val maybeKeywordsConcatQuad = maybeKeywordsQuad(info.id, info.keywords)

val maybeImagesConcatQuad =
maybeConcatQuad[Image](imagesConcatProperty.id,
info.images,
image => s"${image.position.value}:${image.uri.value}"
)
val maybeImagesConcatQuad = maybeImagesQuad(info.id, info.images)

Set(
searchInfoQuad(rdf / "type", typeDef.clazz.id).some,
Expand All @@ -83,6 +71,6 @@ private object Encoders {
maybeKeywordsConcatQuad,
maybeImagesConcatQuad,
maybeDescriptionQuad
).flatten ++ creatorQuads ++ keywordsQuads ++ imagesQuads
).flatten ++ creatorQuads
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,12 @@ private[projects] object ProjectInfoDeleteQuery {
Prefixes of schema -> "schema",
sparql"""|DELETE {
| GRAPH ${GraphClass.Projects.id} {
| ?imageId ?imagePred ?imageObj.
| ?projId ?projPred ?projObj.
| }
|}
|WHERE {
| GRAPH ${GraphClass.Projects.id} {
| BIND (${projectId.asEntityId} AS ?projId)
|
| OPTIONAL {
| ?projId schema:image ?imageId.
| ?imageId ?imagePred ?imageObj.
| }
|
| ?projId ?projPred ?projObj.
| }
|}
Expand Down
Loading
Loading