diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViews.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViews.scala index 9b95aa439f..b7c78b23b4 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViews.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViews.scala @@ -27,12 +27,10 @@ import ch.epfl.bluebrain.nexus.delta.sdk.model._ import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContext import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.ApiMappings import ch.epfl.bluebrain.nexus.delta.sdk.resolvers.ResolverContextResolution -import ch.epfl.bluebrain.nexus.delta.sourcing.ScopedEntityDefinition.Tagger import ch.epfl.bluebrain.nexus.delta.sourcing._ import ch.epfl.bluebrain.nexus.delta.sourcing.config.EventLogConfig import ch.epfl.bluebrain.nexus.delta.sourcing.model.EntityDependency.DependsOn import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.Subject -import ch.epfl.bluebrain.nexus.delta.sourcing.model.Tag.UserTag import ch.epfl.bluebrain.nexus.delta.sourcing.model._ import ch.epfl.bluebrain.nexus.delta.sourcing.offset.Offset import ch.epfl.bluebrain.nexus.delta.sourcing.stream.Elem @@ -166,36 +164,6 @@ final class BlazegraphViews( } yield res }.span("updateBlazegraphView") - /** - * Add a tag to an existing view. - * - * @param id - * the id of the view - * @param project - * the project to which the view belongs - * @param tag - * the tag label - * @param tagRev - * the target revision of the tag - * @param rev - * the current revision of the view - */ - def tag( - id: IdSegment, - project: ProjectRef, - tag: UserTag, - tagRev: Int, - rev: Int - )(implicit subject: Subject): IO[ViewResource] = { - for { - pc <- fetchContext.onModify(project) - iri <- expandIri(id, pc) - _ <- validateNotDefaultView(iri) - res <- eval(TagBlazegraphView(iri, project, tagRev, tag, rev, subject)) - _ <- createNamespace(res) - } yield res - }.span("tagBlazegraphView") - /** * Deprecate a view. * @@ -281,10 +249,8 @@ final class BlazegraphViews( notFound = ViewNotFound(iri, project) state <- id match { case Latest(_) => log.stateOr(project, iri, notFound) - case Revision(_, rev) => - log.stateOr(project, iri, rev, notFound, RevisionNotFound) - case Tag(_, tag) => - log.stateOr(project, iri, tag, notFound, TagNotFound(tag)) + case Revision(_, rev) => log.stateOr(project, iri, rev, notFound, RevisionNotFound) + case t: Tag => IO.raiseError(FetchByTagNotSupported(t)) } } yield state }.span("fetchBlazegraphView") @@ -394,7 +360,6 @@ object BlazegraphViews { e.uuid, e.value, e.source, - Tags.empty, e.rev, e.rev, deprecated = false, @@ -422,7 +387,7 @@ object BlazegraphViews { } def tagAdded(e: BlazegraphViewTagAdded): Option[BlazegraphViewState] = state.map { s => - s.copy(rev = e.rev, tags = s.tags + (e.tag -> e.targetRev), updatedAt = e.instant, updatedBy = e.subject) + s.copy(rev = e.rev, updatedAt = e.instant, updatedBy = e.subject) } def deprecated(e: BlazegraphViewDeprecated): Option[BlazegraphViewState] = state.map { s => @@ -475,19 +440,6 @@ object BlazegraphViews { } yield BlazegraphViewUpdated(c.id, c.project, s.uuid, c.value, c.source, s.rev + 1, t, c.subject) } - def tag(c: TagBlazegraphView) = state match { - case None => - IO.raiseError(ViewNotFound(c.id, c.project)) - case Some(s) if s.rev != c.rev => - IO.raiseError(IncorrectRev(c.rev, s.rev)) - case Some(s) if c.targetRev <= 0 || c.targetRev > s.rev => - IO.raiseError(RevisionNotFound(c.targetRev, s.rev)) - case Some(s) => - clock.realTimeInstant.map( - BlazegraphViewTagAdded(c.id, c.project, s.value.tpe, s.uuid, c.targetRev, c.tag, s.rev + 1, _, c.subject) - ) - } - def deprecate(c: DeprecateBlazegraphView) = state match { case None => IO.raiseError(ViewNotFound(c.id, c.project)) @@ -517,7 +469,6 @@ object BlazegraphViews { cmd match { case c: CreateBlazegraphView => create(c) case c: UpdateBlazegraphView => update(c) - case c: TagBlazegraphView => tag(c) case c: DeprecateBlazegraphView => deprecate(c) case c: UndeprecateBlazegraphView => undeprecate(c) } @@ -530,7 +481,7 @@ object BlazegraphViews { BlazegraphViewEvent, BlazegraphViewRejection ] = - ScopedEntityDefinition( + ScopedEntityDefinition.untagged( entityType, StateMachine( None, @@ -539,15 +490,6 @@ object BlazegraphViews { ), BlazegraphViewEvent.serializer, BlazegraphViewState.serializer, - Tagger[BlazegraphViewEvent]( - { - case r: BlazegraphViewTagAdded => Some(r.tag -> r.targetRev) - case _ => None - }, - { _ => - None - } - ), { s => s.value match { case a: AggregateBlazegraphViewValue => diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphView.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphView.scala index 040f019bd3..64b886ba85 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphView.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphView.scala @@ -9,12 +9,12 @@ import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder import ch.epfl.bluebrain.nexus.delta.sdk.ResourceShift import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdContent -import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, IdSegmentRef, Tags} +import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, IdSegmentRef} import ch.epfl.bluebrain.nexus.delta.sdk.permissions.model.Permission import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ import ch.epfl.bluebrain.nexus.delta.sdk.views.ViewRef -import ch.epfl.bluebrain.nexus.delta.sourcing.model.{IriFilter, ProjectRef} import ch.epfl.bluebrain.nexus.delta.sourcing.model.Tag.UserTag +import ch.epfl.bluebrain.nexus.delta.sourcing.model.{IriFilter, ProjectRef} import io.circe.generic.extras.Configuration import io.circe.generic.extras.semiauto.deriveConfiguredEncoder import io.circe.syntax._ @@ -52,12 +52,6 @@ sealed trait BlazegraphView extends Product with Serializable { */ def project: ProjectRef - /** - * @return - * the tag -> rev mapping - */ - def tags: Tags - /** * @return * the original json document provided at creation or update @@ -118,7 +112,6 @@ object BlazegraphView { includeMetadata: Boolean, includeDeprecated: Boolean, permission: Permission, - tags: Tags, source: Json, indexingRev: Int ) extends BlazegraphView { @@ -147,7 +140,6 @@ object BlazegraphView { description: Option[String], project: ProjectRef, views: NonEmptySet[ViewRef], - tags: Tags, source: Json ) extends BlazegraphView { override def metadata: Metadata = Metadata(None, None) diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewCommand.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewCommand.scala index 88e47265c7..b0ea991845 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewCommand.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewCommand.scala @@ -2,7 +2,6 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.Subject -import ch.epfl.bluebrain.nexus.delta.sourcing.model.Tag.UserTag import ch.epfl.bluebrain.nexus.delta.sourcing.model.ProjectRef import io.circe.Json @@ -116,29 +115,4 @@ object BlazegraphViewCommand { */ final case class UndeprecateBlazegraphView(id: Iri, project: ProjectRef, rev: Int, subject: Subject) extends BlazegraphViewCommand - - /** - * Command for adding a tag to a Blazegraph view. - * - * @param id - * the view id - * @param project - * a reference to the parent project - * @param targetRev - * the revision that is being aliased with the provided ''tag'' - * @param tag - * the tag label - * @param rev - * the last known revision of the view - * @param subject - * the identity associated with this command - */ - final case class TagBlazegraphView( - id: Iri, - project: ProjectRef, - targetRev: Int, - tag: UserTag, - rev: Int, - subject: Subject - ) extends BlazegraphViewCommand } diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewRejection.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewRejection.scala index 9600cdd5b2..a4802a85cf 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewRejection.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewRejection.scala @@ -16,6 +16,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.{RdfError, Vocabulary} import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdRejection import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdRejection.{BlankId, UnexpectedId} import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields +import ch.epfl.bluebrain.nexus.delta.sdk.model.IdSegmentRef import ch.epfl.bluebrain.nexus.delta.sdk.permissions.model.Permission import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContext.ContextRejection import ch.epfl.bluebrain.nexus.delta.sdk.views.ViewRef @@ -112,6 +113,11 @@ object BlazegraphViewRejection { s"Incorrect revision '$provided' provided, expected '$expected', the view may have been updated since last seen." ) + final case class FetchByTagNotSupported(tag: IdSegmentRef.Tag) + extends BlazegraphViewRejection( + s"Fetching blazegraph views by tag is no longer supported. Id ${tag.value.asString} and tag ${tag.tag.value}" + ) + /** * Signals a rejection caused when interacting with other APIs when fetching a resource */ @@ -265,6 +271,7 @@ object BlazegraphViewRejection { case ViewIsDefaultView => StatusCodes.Forbidden case IncorrectRev(_, _) => StatusCodes.Conflict case ProjectContextRejection(rej) => rej.status + case _: FetchByTagNotSupported => StatusCodes.BadRequest case _ => StatusCodes.BadRequest } } diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewState.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewState.scala index 1905c69da1..f6a5ae75fe 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewState.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewState.scala @@ -4,7 +4,7 @@ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphView._ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewValue._ import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri -import ch.epfl.bluebrain.nexus.delta.sdk.model.{ResourceF, ResourceUris, Tags} +import ch.epfl.bluebrain.nexus.delta.sdk.model.{ResourceF, ResourceUris} import ch.epfl.bluebrain.nexus.delta.sourcing.Serializer import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.Subject import ch.epfl.bluebrain.nexus.delta.sourcing.model.{ProjectRef, ResourceRef} @@ -51,7 +51,6 @@ final case class BlazegraphViewState( uuid: UUID, value: BlazegraphViewValue, source: Json, - tags: Tags, rev: Int, indexingRev: Int, deprecated: Boolean, @@ -91,12 +90,11 @@ final case class BlazegraphViewState( includeMetadata, includeDeprecated, permission, - tags, source, indexingRev ) case AggregateBlazegraphViewValue(name, description, views) => - AggregateBlazegraphView(id, name, description, project, views, tags, source) + AggregateBlazegraphView(id, name, description, project, views, source) } def toResource: ViewResource = diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutes.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutes.scala index aee2153271..83b9e333f4 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutes.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutes.scala @@ -3,7 +3,6 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.routes import akka.http.scaladsl.model.StatusCodes.Created import akka.http.scaladsl.server.{Directive0, Route} import cats.implicits._ -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphView._ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewRejection._ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model._ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.permissions.{read => Read, write => Write} @@ -22,7 +21,6 @@ import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller import ch.epfl.bluebrain.nexus.delta.sdk.implicits._ import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.RdfMarshalling -import ch.epfl.bluebrain.nexus.delta.sdk.model.routes.Tag import ch.epfl.bluebrain.nexus.delta.sdk.model.search.SearchResults._ import ch.epfl.bluebrain.nexus.delta.sdk.model.search.{PaginationConfig, SearchResults} import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, IdSegment} @@ -168,36 +166,6 @@ class BlazegraphViewsRoutes( } ) }, - (pathPrefix("tags") & pathEndOrSingleSlash) { - concat( - // Fetch tags for a view - (get & idSegmentRef(id) & authorizeFor(project, Read)) { id => - emit( - views - .fetch(id, project) - .map(_.value.tags) - .attemptNarrow[BlazegraphViewRejection] - .rejectOn[ViewNotFound] - ) - }, - // Tag a view - (post & parameter("rev".as[Int])) { rev => - authorizeFor(project, Write).apply { - entity(as[Tag]) { case Tag(tagRev, tag) => - emit( - Created, - views - .tag(id, project, tag, tagRev, rev) - .flatTap(index(project, _, mode)) - .mapValue(_.metadata) - .attemptNarrow[BlazegraphViewRejection] - .rejectOn[ViewNotFound] - ) - } - } - } - ) - }, // Fetch a view original source (pathPrefix("source") & get & pathEndOrSingleSlash & idSegmentRef(id)) { id => authorizeFor(project, Read).apply { diff --git a/delta/plugins/blazegraph/src/test/resources/blazegraph/database/aggregate-view-state.json b/delta/plugins/blazegraph/src/test/resources/blazegraph/database/aggregate-view-state.json index 5cf75732e2..082f7c98ec 100644 --- a/delta/plugins/blazegraph/src/test/resources/blazegraph/database/aggregate-view-state.json +++ b/delta/plugins/blazegraph/src/test/resources/blazegraph/database/aggregate-view-state.json @@ -23,9 +23,6 @@ ] }, "uuid": "f8468909-a797-4b10-8b5f-000cba337bfa", - "tags": { - "mytag": 3 - }, "createdAt": "1970-01-01T00:00:00Z", "createdBy": { "@type": "User", diff --git a/delta/plugins/blazegraph/src/test/resources/blazegraph/database/indexing-view-state.json b/delta/plugins/blazegraph/src/test/resources/blazegraph/database/indexing-view-state.json index 37eb8f92a2..bd5d0225fa 100644 --- a/delta/plugins/blazegraph/src/test/resources/blazegraph/database/indexing-view-state.json +++ b/delta/plugins/blazegraph/src/test/resources/blazegraph/database/indexing-view-state.json @@ -17,9 +17,6 @@ "source": { "elastic": "value" }, - "tags": { - "mytag": 3 - }, "updatedAt": "1970-01-01T00:00:00Z", "updatedBy": { "@type": "User", diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsGen.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsGen.scala index 5525feac5e..45b34f8d8a 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsGen.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsGen.scala @@ -2,7 +2,6 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.{BlazegraphViewState, BlazegraphViewValue, ViewResource} import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri -import ch.epfl.bluebrain.nexus.delta.sdk.model.Tags import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Anonymous, Subject} import ch.epfl.bluebrain.nexus.delta.sourcing.model.ProjectRef import io.circe.Json @@ -21,7 +20,6 @@ object BlazegraphViewsGen { rev: Int = 1, indexingRev: Int = 1, deprecated: Boolean = false, - tags: Tags = Tags.empty, createdBy: Subject = Anonymous, updatedBy: Subject = Anonymous ): ViewResource = @@ -31,7 +29,6 @@ object BlazegraphViewsGen { uuid, value, source, - tags, rev, indexingRev, deprecated, diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsSpec.scala index 72b28d3c07..6c65112e09 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsSpec.scala @@ -19,12 +19,11 @@ import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.ApiMappings import ch.epfl.bluebrain.nexus.delta.sdk.resolvers.ResolverContextResolution import ch.epfl.bluebrain.nexus.delta.sdk.views.ViewRef import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Authenticated, Group, User} -import ch.epfl.bluebrain.nexus.delta.sourcing.model.{IriFilter, Label} import ch.epfl.bluebrain.nexus.delta.sourcing.model.Tag.UserTag +import ch.epfl.bluebrain.nexus.delta.sourcing.model.{IriFilter, Label} import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.DoobieScalaTestFixture import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec import io.circe.Json -import io.circe.syntax._ import org.scalatest.Assertion import org.scalatest.matchers.{BeMatcher, MatchResult} @@ -241,62 +240,9 @@ class BlazegraphViewsSpec extends CatsEffectSpec with DoobieScalaTestFixture wit } - "tagging a view" should { - "tag a view" in { - views.tag(aggregateViewId, projectRef, tag, tagRev = 1, 2).accepted shouldEqual resourceFor( - aggregateViewId, - projectRef, - aggregateValue, - uuid, - aggregateSource, - 3, - tags = Tags(tag -> 1), - createdBy = bob, - updatedBy = bob - ) - } - - "reject when view doesn't exits" in { - views.tag(doesntExistId, projectRef, tag, tagRev = 1, 2).rejected shouldEqual ViewNotFound( - doesntExistId, - projectRef - ) - } - - "reject when target revision doesn't exist" in { - views.tag(indexingViewId, projectRef, tag, tagRev = 42, 2).rejected shouldEqual RevisionNotFound( - 42, - 2 - ) - } - - "reject when incorrect revision is provided" in { - views.tag(indexingViewId, projectRef, tag, tagRev = 1, 1).rejected shouldEqual IncorrectRev( - 1, - 2 - ) - } - - "succeed when view is deprecated" in { - views.tag(indexingViewId2, projectRef, tag, tagRev = 1, 2).accepted shouldEqual resourceFor( - indexingViewId2, - projectRef, - indexingValue, - uuid, - indexingSource.deepMerge(Json.obj("@id" -> indexingViewId2.asJson)), - 3, - tags = Tags(tag -> 1), - createdBy = bob, - updatedBy = bob, - deprecated = true - ) - } - - } - "deprecating a view" should { "deprecate the view" in { - views.deprecate(aggregateViewId, projectRef, 3).accepted should be(deprecated) + views.deprecate(aggregateViewId, projectRef, 2).accepted should be(deprecated) views.fetch(aggregateViewId, projectRef).accepted should be(deprecated) } @@ -356,19 +302,6 @@ class BlazegraphViewsSpec extends CatsEffectSpec with DoobieScalaTestFixture wit } - "fetch a view by tag" in { - views.fetch(IdSegmentRef(aggregateViewId, tag), projectRef).accepted shouldEqual resourceFor( - aggregateViewId, - projectRef, - aggregateValue, - uuid, - aggregateSource, - 1, - createdBy = bob, - updatedBy = bob - ) - } - "fetch a view by rev" in { views.fetch(IdSegmentRef(indexingViewId, 1), projectRef).accepted shouldEqual resourceFor( indexingViewId, @@ -381,9 +314,9 @@ class BlazegraphViewsSpec extends CatsEffectSpec with DoobieScalaTestFixture wit ) } - "reject when the tag does not exist" in { - val notFound = UserTag.unsafe("notfound") - views.fetch(IdSegmentRef(aggregateViewId, notFound), projectRef).rejected shouldEqual TagNotFound(notFound) + "reject when fetching a view by tag" in { + val id = IdSegmentRef.Tag(aggregateViewId, tag) + views.fetch(id, projectRef).rejected shouldEqual FetchByTagNotSupported(id) } "reject when the revision does not exit" in { @@ -404,10 +337,6 @@ class BlazegraphViewsSpec extends CatsEffectSpec with DoobieScalaTestFixture wit "updating" in { views.update(defaultViewId, projectRef, 1, indexingSource).rejected shouldEqual ViewIsDefaultView } - - "tagging" in { - views.tag(defaultViewId, projectRef, tag, tagRev = 1, 1).rejected shouldEqual ViewIsDefaultView - } } def givenAView(test: String => Assertion): Assertion = { diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsStmSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsStmSpec.scala index 4e1bde7af7..4a53d6b584 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsStmSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphViewsStmSpec.scala @@ -4,15 +4,14 @@ import cats.data.NonEmptySet import cats.effect.IO import ch.epfl.bluebrain.nexus.delta.kernel.utils.UUIDF import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.BlazegraphViews.{evaluate, next} -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewCommand.{CreateBlazegraphView, DeprecateBlazegraphView, TagBlazegraphView, UndeprecateBlazegraphView, UpdateBlazegraphView} -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewEvent.{BlazegraphViewCreated, BlazegraphViewDeprecated, BlazegraphViewTagAdded, BlazegraphViewUndeprecated, BlazegraphViewUpdated} -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewRejection.{DifferentBlazegraphViewType, IncorrectRev, InvalidViewReferences, PermissionIsNotDefined, ResourceAlreadyExists, RevisionNotFound, ViewIsDeprecated, ViewIsNotDeprecated, ViewNotFound} +import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewCommand.{CreateBlazegraphView, DeprecateBlazegraphView, UndeprecateBlazegraphView, UpdateBlazegraphView} +import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewEvent._ +import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewRejection.{DifferentBlazegraphViewType, IncorrectRev, InvalidViewReferences, PermissionIsNotDefined, ResourceAlreadyExists, ViewIsDeprecated, ViewIsNotDeprecated, ViewNotFound} import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewType.{IndexingBlazegraphView => BlazegraphType} import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewValue.{AggregateBlazegraphViewValue, IndexingBlazegraphViewValue} import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.{BlazegraphViewState, BlazegraphViewValue} import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.syntax._ -import ch.epfl.bluebrain.nexus.delta.sdk.model.Tags import ch.epfl.bluebrain.nexus.delta.sdk.permissions.model.Permission import ch.epfl.bluebrain.nexus.delta.sdk.views.ViewRef import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Anonymous, Subject, User} @@ -61,7 +60,6 @@ class BlazegraphViewsStmSpec extends CatsEffectSpec with Fixtures { uuid: UUID = uuid, value: BlazegraphViewValue = indexingValue, source: Json = source, - tags: Tags = Tags.empty, rev: Int = 1, indexingRev: Int = 1, deprecated: Boolean = false, @@ -76,7 +74,6 @@ class BlazegraphViewsStmSpec extends CatsEffectSpec with Fixtures { uuid, value, source, - tags, rev, indexingRev, deprecated, @@ -156,36 +153,6 @@ class BlazegraphViewsStmSpec extends CatsEffectSpec with Fixtures { } } - "evaluating the TagBlazegraphView command" should { - val tag = UserTag.unsafe("tag") - "emit an BlazegraphViewTagAdded" in { - val cmd = TagBlazegraphView(id, project, 1, tag, 1, subject) - val expected = BlazegraphViewTagAdded(id, project, BlazegraphType, uuid, 1, tag, 2, epoch, subject) - eval(Some(current()), cmd).accepted shouldEqual expected - } - "raise a ViewNotFound rejection" in { - val cmd = TagBlazegraphView(id, project, 1, tag, 1, subject) - eval(None, cmd).rejectedWith[ViewNotFound] - } - "raise a IncorrectRev rejection" in { - val cmd = TagBlazegraphView(id, project, 1, tag, 2, subject) - eval(Some(current()), cmd).rejectedWith[IncorrectRev] - } - "emit an BlazegraphViewTagAdded when view is deprecated" in { - val cmd = TagBlazegraphView(id, project, 1, tag, 1, subject) - val expected = BlazegraphViewTagAdded(id, project, BlazegraphType, uuid, 1, tag, 2, epoch, subject) - eval(Some(current(deprecated = true)), cmd).accepted shouldEqual expected - } - "raise a RevisionNotFound rejection for negative revision values" in { - val cmd = TagBlazegraphView(id, project, 0, tag, 1, subject) - eval(Some(current()), cmd).rejectedWith[RevisionNotFound] - } - "raise a RevisionNotFound rejection for revisions higher that the current" in { - val cmd = TagBlazegraphView(id, project, 2, tag, 1, subject) - eval(Some(current()), cmd).rejectedWith[RevisionNotFound] - } - } - "evaluating the DeprecateBlazegraphView command" should { "emit an BlazegraphViewDeprecated" in { val cmd = DeprecateBlazegraphView(id, project, 1, subject) @@ -301,7 +268,7 @@ class BlazegraphViewsStmSpec extends CatsEffectSpec with Fixtures { next( Some(current()), BlazegraphViewTagAdded(id, project, BlazegraphType, uuid, 1, tag, 2, epoch, subject) - ).value shouldEqual current(tags = Tags(tag -> 1), rev = 2, updatedBy = subject) + ).value shouldEqual current(rev = 2, updatedBy = subject) } } diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/indexing/IndexingViewDefSuite.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/indexing/IndexingViewDefSuite.scala index 2594872376..f3f7d7a689 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/indexing/IndexingViewDefSuite.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/indexing/IndexingViewDefSuite.scala @@ -9,13 +9,12 @@ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.{BlazegraphViewSta import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.nxv import ch.epfl.bluebrain.nexus.delta.rdf.graph.NTriples import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd -import ch.epfl.bluebrain.nexus.delta.sdk.model.Tags import ch.epfl.bluebrain.nexus.delta.sdk.stream.GraphResourceStream import ch.epfl.bluebrain.nexus.delta.sdk.views.ViewRef import ch.epfl.bluebrain.nexus.delta.sourcing.config.BatchConfig import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Anonymous, Subject} -import ch.epfl.bluebrain.nexus.delta.sourcing.model.{IriFilter, ProjectRef} import ch.epfl.bluebrain.nexus.delta.sourcing.model.Tag.UserTag +import ch.epfl.bluebrain.nexus.delta.sourcing.model.{IriFilter, ProjectRef} import ch.epfl.bluebrain.nexus.delta.sourcing.offset.Offset import ch.epfl.bluebrain.nexus.delta.sourcing.stream.ProjectionErr.CouldNotFindTypedPipeErr import ch.epfl.bluebrain.nexus.delta.sourcing.stream._ @@ -43,7 +42,6 @@ class IndexingViewDefSuite extends NexusSuite { private val id = nxv + "indexing-view" private val viewRef = ViewRef(projectRef, id) private val subject: Subject = Anonymous - private val tag = UserTag.unsafe("mytag") private val indexingRev = 1 private val currentRev = 1 @@ -65,7 +63,6 @@ class IndexingViewDefSuite extends NexusSuite { uuid, v, Json.obj("blazegraph" -> Json.fromString("value")), - Tags(tag -> 3), rev = 1, indexingRev = indexingRev, deprecated = false, diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala index 426ec69a77..312d46c286 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala @@ -7,7 +7,6 @@ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewType import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewValue.{AggregateBlazegraphViewValue, IndexingBlazegraphViewValue} import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.nxv import ch.epfl.bluebrain.nexus.delta.sdk.SerializationSuite -import ch.epfl.bluebrain.nexus.delta.sdk.model.Tags import ch.epfl.bluebrain.nexus.delta.sdk.model.metrics.EventMetric._ import ch.epfl.bluebrain.nexus.delta.sdk.permissions.model.Permission import ch.epfl.bluebrain.nexus.delta.sdk.sse.SseEncoder.SseData @@ -117,7 +116,6 @@ class BlazegraphViewsSerializationSuite extends SerializationSuite { uuid, value, Json.obj("elastic" -> Json.fromString("value")), - Tags(tag -> 3), rev = 1, indexingRev = 1, deprecated = false, diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala index 1de830a3ac..caa3b3b1b1 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala @@ -13,7 +13,6 @@ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.BlazegraphViewReje import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model._ import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.RdfMediaTypes._ -import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.nxv import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery.SparqlConstructQuery @@ -21,7 +20,6 @@ import ch.epfl.bluebrain.nexus.delta.sdk.IndexingAction import ch.epfl.bluebrain.nexus.delta.sdk.acls.model.AclAddress import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaSchemeDirectives import ch.epfl.bluebrain.nexus.delta.sdk.fusion.FusionConfig -import ch.epfl.bluebrain.nexus.delta.sdk.implicits._ import ch.epfl.bluebrain.nexus.delta.sdk.model.ResourceUris import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContextDummy import ch.epfl.bluebrain.nexus.delta.sdk.resolvers.ResolverContextResolution @@ -171,16 +169,8 @@ class BlazegraphViewsRoutesSpec extends BlazegraphViewRoutesFixtures { } } - "tag a view" in { - val payload = json"""{"tag": "mytag", "rev": 1}""" - Post("/v1/views/org/proj/indexing-view/tags?rev=2", payload.toEntity) ~> asWriter ~> routes ~> check { - status shouldEqual StatusCodes.Created - response.asJson shouldEqual indexingViewMetadata(indexingViewId, 3, 2, deprecated = false) - } - } - "fail to deprecate a view without permission" in { - Delete("/v1/views/org/proj/indexing-view?rev=3") ~> asReader ~> routes ~> check { + Delete("/v1/views/org/proj/indexing-view?rev=2") ~> asReader ~> routes ~> check { response.shouldBeForbidden } } @@ -193,9 +183,9 @@ class BlazegraphViewsRoutesSpec extends BlazegraphViewRoutesFixtures { } "deprecate a view" in { - Delete("/v1/views/org/proj/indexing-view?rev=3") ~> asWriter ~> routes ~> check { + Delete("/v1/views/org/proj/indexing-view?rev=2") ~> asWriter ~> routes ~> check { response.status shouldEqual StatusCodes.OK - response.asJson shouldEqual indexingViewMetadata(indexingViewId, 4, 2, deprecated = true) + response.asJson shouldEqual indexingViewMetadata(indexingViewId, 3, 2, deprecated = true) } } @@ -253,14 +243,12 @@ class BlazegraphViewsRoutesSpec extends BlazegraphViewRoutesFixtures { "fetch a view" in { Get("/v1/views/org/proj/indexing-view") ~> asReader ~> routes ~> check { response.status shouldEqual StatusCodes.OK - response.asJson shouldEqual indexingView(4, 2, deprecated = true) + response.asJson shouldEqual indexingView(3, 2, deprecated = true) } } - "fetch a view by rev or tag" in { + + "fetch a view by rev" in { val endpoints = List( - "/v1/views/org/proj/indexing-view?tag=mytag", - "/v1/resources/org/proj/_/indexing-view?tag=mytag", - "/v1/resources/org/proj/view/indexing-view?tag=mytag", "/v1/views/org/proj/indexing-view?rev=1", "/v1/resources/org/proj/_/indexing-view?rev=1", "/v1/resources/org/proj/view/indexing-view?rev=1" @@ -271,37 +259,35 @@ class BlazegraphViewsRoutesSpec extends BlazegraphViewRoutesFixtures { response.asJson shouldEqual indexingView(1, 1, deprecated = false).mapObject(_.remove("resourceTag")) } } - } - "fetch a view source" in { + + "reject fetching a view tag" in { val endpoints = List( - "/v1/views/org/proj/indexing-view/source", - "/v1/resources/org/proj/_/indexing-view/source", - "/v1/resources/org/proj/view/indexing-view/source" + "/v1/views/org/proj/indexing-view?tag=mytag", + "/v1/resources/org/proj/_/indexing-view?tag=mytag", + "/v1/resources/org/proj/view/indexing-view?tag=mytag" ) forAll(endpoints) { endpoint => Get(endpoint) ~> asReader ~> routes ~> check { - response.status shouldEqual StatusCodes.OK - response.asJson shouldEqual updatedIndexingSource + response.status shouldEqual StatusCodes.BadRequest } } } - "fetch the view tags" in { + + "fetch a view source" in { val endpoints = List( - "/v1/views/org/proj/indexing-view/tags", - "/v1/resources/org/proj/_/indexing-view/tags", - "/v1/resources/org/proj/view/indexing-view/tags" + "/v1/views/org/proj/indexing-view/source", + "/v1/resources/org/proj/_/indexing-view/source", + "/v1/resources/org/proj/view/indexing-view/source" ) forAll(endpoints) { endpoint => Get(endpoint) ~> asReader ~> routes ~> check { response.status shouldEqual StatusCodes.OK - response.asJson shouldEqual - json"""{"tags": [{"rev": 1, "tag": "mytag"}]}""".addContext( - Vocabulary.contexts.tags - ) + response.asJson shouldEqual updatedIndexingSource } } } + "reject if provided rev and tag simultaneously" in { Get("/v1/views/org/proj/indexing-view?rev=1&tag=mytag") ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.BadRequest diff --git a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/Storages.scala b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/Storages.scala index 4711d1201a..5e2c5e47ec 100644 --- a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/Storages.scala +++ b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/Storages.scala @@ -466,6 +466,7 @@ object Storages { StateMachine(None, evaluate(access, fetchPermissions, config, clock)(_, _), next), StorageEvent.serializer, StorageState.serializer, + _ => None, onUniqueViolation = (id: Iri, c: StorageCommand) => c match { case c: CreateStorage => ResourceAlreadyExists(id, c.project) diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/Projects.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/Projects.scala index 10fa651a73..c92fd16b05 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/Projects.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/Projects.scala @@ -309,6 +309,7 @@ object Projects { StateMachine(None, evaluate(fetchAndValidateOrg, validateDeletion, clock)(_, _), next), ProjectEvent.serializer, ProjectState.serializer, + _ => None, onUniqueViolation = (id: ProjectRef, c: ProjectCommand) => c match { case _: CreateProject => ProjectAlreadyExists(id) diff --git a/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/ScopedEntityDefinition.scala b/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/ScopedEntityDefinition.scala index 7db07d5196..66161c5893 100644 --- a/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/ScopedEntityDefinition.scala +++ b/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/ScopedEntityDefinition.scala @@ -45,6 +45,7 @@ object ScopedEntityDefinition { stateMachine: StateMachine[S, Command, E], eventSerializer: Serializer[Id, E], stateSerializer: Serializer[Id, S], + extractDependencies: S => Option[Set[DependsOn]], onUniqueViolation: (Id, Command) => Rejection )(implicit get: Get[Id], put: Put[Id]): ScopedEntityDefinition[Id, S, Command, E, Rejection] = ScopedEntityDefinition( @@ -53,7 +54,7 @@ object ScopedEntityDefinition { eventSerializer, stateSerializer, Tagger(_ => None, _ => None), - _ => None, + extractDependencies, onUniqueViolation ) diff --git a/docs/src/main/paradox/docs/delta/api/assets/views/blazegraph/aggregate/tagged.json b/docs/src/main/paradox/docs/delta/api/assets/views/blazegraph/aggregate/tagged.json deleted file mode 100644 index 6ecd7c8163..0000000000 --- a/docs/src/main/paradox/docs/delta/api/assets/views/blazegraph/aggregate/tagged.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "@context": [ - "https://bluebrain.github.io/nexus/contexts/sparql-metadata.json", - "https://bluebrain.github.io/nexus/contexts/metadata.json" - ], - "@id": "https://bluebrain.github.io/nexus/vocabulary/myview", - "@type": [ - "AggregateSparqlView", - "View" - ], - "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", - "_createdAt": "2021-04-18T17:10:22.748Z", - "_createdBy": "http://localhost:8080/v1/realms/myrealm/users/Bob", - "_uuid": "9c632570-cdaa-4a35-a6f9-1e95bd3a930e", - "_deprecated": false, - "_self": "http://localhost:8080/v1/views/org/proj/nxv:myview", - "_incoming": "http://localhost:8080/v1/views/org/proj/nxv:myview/incoming", - "_outgoing": "http://localhost:8080/v1/views/org/proj/nxv:myview/outgoing", - "_project": "http://localhost:8080/v1/projects/org/proj", - "_rev": 3, - "_updatedAt": "2021-04-24T22:18:55.444Z", - "_updatedBy": "http://localhost:8080/v1/realms/myrealm/users/Bob" -} \ No newline at end of file diff --git a/docs/src/main/paradox/docs/delta/api/assets/views/blazegraph/sparql/tagged.json b/docs/src/main/paradox/docs/delta/api/assets/views/blazegraph/sparql/tagged.json deleted file mode 100644 index f477e09f8a..0000000000 --- a/docs/src/main/paradox/docs/delta/api/assets/views/blazegraph/sparql/tagged.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "@context": [ - "https://bluebrain.github.io/nexus/contexts/sparql-metadata.json", - "https://bluebrain.github.io/nexus/contexts/metadata.json" - ], - "@id": "https://bluebrain.github.io/nexus/vocabulary/myview", - "@type": [ - "SparqlView", - "View" - ], - "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", - "_createdAt": "2021-04-18T17:10:22.748Z", - "_createdBy": "http://localhost:8080/v1/realms/myrealm/users/Bob", - "_uuid": "9c632570-cdaa-4a35-a6f9-1e95bd3a930e", - "_deprecated": false, - "_self": "http://localhost:8080/v1/views/org/proj/myview", - "_incoming": "http://localhost:8080/v1/views/org/proj/myview/incoming", - "_outgoing": "http://localhost:8080/v1/views/org/proj/myview/outgoing", - "_project": "http://localhost:8080/v1/projects/org/proj", - "_rev": 3, - "_updatedAt": "2021-04-22T13:03:50.978Z", - "_updatedBy": "http://localhost:8080/v1/realms/myrealm/users/Bob" -} \ No newline at end of file diff --git a/docs/src/main/paradox/docs/delta/api/views/aggregated-sparql-view-api.md b/docs/src/main/paradox/docs/delta/api/views/aggregated-sparql-view-api.md index 7e15fe1a6b..ccdddc80ab 100644 --- a/docs/src/main/paradox/docs/delta/api/views/aggregated-sparql-view-api.md +++ b/docs/src/main/paradox/docs/delta/api/views/aggregated-sparql-view-api.md @@ -115,37 +115,6 @@ Payload Response : @@snip [updated.json](../assets/views/blazegraph/aggregate/updated.json) -## Tag - -Links a view's revision to a specific name. - -Tagging a view is considered to be an update as well. - -``` -POST /v1/views/{org_label}/{project_label}/{view_id}/tags?rev={previous_rev} - { - "tag": "{name}", - "rev": {rev} - } -``` -... where - -- `{previous_rev}`: Number - the last known revision for the resolver. -- `{name}`: String - label given to the view at specific revision. -- `{rev}`: Number - the revision to link the provided `{name}`. - -**Example** - -Request -: @@snip [tag.sh](../assets/views/blazegraph/tag.sh) - -Payload -: @@snip [tag.json](../assets/tag.json) - -Response -: @@snip [tagged.json](../assets/views/blazegraph/aggregate/tagged.json) - - ## Deprecate Locks the view, so no further operations can be performed. It also stops the indexing process and delete the associated namespace. @@ -170,14 +139,12 @@ Response ## Fetch ``` -GET /v1/views/{org_label}/{project_label}/{view_id}?rev={rev}&tag={tag} +GET /v1/views/{org_label}/{project_label}/{view_id}?rev={rev} ``` where ... - `{rev}`: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision. -- `{tag}`: String - the targeted tag to be fetched. This field is optional. - `{rev}` and `{tag}` fields cannot be simultaneously present. **Example** @@ -190,13 +157,11 @@ Response ## Fetch original payload ``` -GET /v1/views/{org_label}/{project_label}/{view_id}/source?rev={rev}&tag={tag} +GET /v1/views/{org_label}/{project_label}/{view_id}/source?rev={rev} ``` where ... - `{rev}`: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision. -- `{tag}`: String - the targeted tag to be fetched. This field is optional. - `{rev}` and `{tag}` fields cannot be simultaneously present. **Example** @@ -206,26 +171,6 @@ Request Response : @@snip [payload.json](../assets/views/blazegraph/aggregate/payload.json) -## Fetch tags - -``` -GET /v1/views/{org_label}/{project_label}/{view_id}/tags?rev={rev}&tag={tag} -``` -where ... - -- `{rev}`: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision. -- `{tag}`: String - the targeted tag to be fetched. This field is optional. - -`{rev}` and `{tag}` fields cannot be simultaneously present. - -**Example** - -Request -: @@snip [fetchTags.sh](../assets/views/blazegraph/tags.sh) - -Response -: @@snip [tags.json](../assets/tags.json) - ## SPARQL query Provides aggregated search functionality across all the `SparqlView`s referenced from the target `view_id`. diff --git a/docs/src/main/paradox/docs/delta/api/views/sparql-view-api.md b/docs/src/main/paradox/docs/delta/api/views/sparql-view-api.md index 264e292a86..33414becb4 100644 --- a/docs/src/main/paradox/docs/delta/api/views/sparql-view-api.md +++ b/docs/src/main/paradox/docs/delta/api/views/sparql-view-api.md @@ -151,37 +151,6 @@ beginning. @@@ -## Tag - -Links a view's revision to a specific name. - -Tagging a view is considered to be an update as well. - -``` -POST /v1/views/{org_label}/{project_label}/{view_id}/tags?rev={previous_rev} - { - "tag": "{name}", - "rev": {rev} - } -``` -... where - -- `{previous_rev}`: Number - the last known revision for the resolver. -- `{name}`: String - label given to the view at specific revision. -- `{rev}`: Number - the revision to link the provided `{name}`. - -**Example** - -Request -: @@snip [tag.sh](../assets/views/blazegraph/tag.sh) - -Payload -: @@snip [tag.json](../assets/tag.json) - -Response -: @@snip [tagged.json](../assets/views/blazegraph/sparql/tagged.json) - - ## Deprecate Locks the view, so no further operations can be performed. It also stops the indexing process and delete the associated namespace. @@ -227,14 +196,12 @@ Response ## Fetch ``` -GET /v1/views/{org_label}/{project_label}/{view_id}?rev={rev}&tag={tag} +GET /v1/views/{org_label}/{project_label}/{view_id}?rev={rev} ``` where ... - `{rev}`: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision. -- `{tag}`: String - the targeted tag to be fetched. This field is optional. - `{rev}` and `{tag}` fields cannot be simultaneously present. **Example** @@ -250,13 +217,11 @@ if the `Accept` header is set to `text/html`, a redirection to the fusion repres ## Fetch original payload ``` -GET /v1/views/{org_label}/{project_label}/{view_id}/source?rev={rev}&tag={tag} +GET /v1/views/{org_label}/{project_label}/{view_id}/source?rev={rev} ``` where ... - `{rev}`: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision. -- `{tag}`: String - the targeted tag to be fetched. This field is optional. - `{rev}` and `{tag}` fields cannot be simultaneously present. **Example** @@ -266,26 +231,6 @@ Request Response : @@snip [payload.json](../assets/views/blazegraph/sparql/payload.json) -## Fetch tags - -``` -GET /v1/views/{org_label}/{project_label}/{view_id}/tags?rev={rev}&tag={tag} -``` -where ... - -- `{rev}`: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision. -- `{tag}`: String - the targeted tag to be fetched. This field is optional. - -`{rev}` and `{tag}` fields cannot be simultaneously present. - -**Example** - -Request -: @@snip [fetchTags.sh](../assets/views/blazegraph/tags.sh) - -Response -: @@snip [tags.json](../assets/tags.json) - ## SPARQL query Provides search functionality on the `SparqlView` content.