Deleteing an n-ary relationship


#1

Hi there,

I have an n-ary relationship between four entities and am trying to delete the relationship like so.

This as can be seen is throwing an error. Why is this not working? Am I doing something wrong?

Thanks in advance


#2

Hi @hcbh96,

that’s just a wrong visual effect we have on dashboard.
Dashboard was supposed to be used only for read-only queries, so there is no real full support for delete/insert.
But it looks like the query worked, have you checked in the graph, is the relationship still there?


#3

Hiya @marco, that is what I thought might be happening at first but when checking the relation it had not been removed. I have found a workaround in the order I am running my queries so am all ok but for your reference. I have attached the queries I executed and the grakn.log for those queries.
Request

     >>> match $user isa user has identifier '5b14dfa89cbb8537810ff8b2';$user2 isa 
    user;$authorisation isa authorisation;$requests ($user, $user2, attached: $authorisation) isa 
    requests; get $requests;

Response

    $requests id V462960 (requested: id V278696, requester: id V241816, attached: id V983192, 
    attached: id V626752) isa requests; 

Request

    >> match $user isa user has identifier '5b14dfa89cbb8537810ff8b2';$user2 isa 
    user;$authorisation isa authorisation;$requests ($user, $user2, attached: $authorisation) isa 
    requests; delete $requests;

Response

Exception in thread "main" io.grpc.StatusRuntimeException: UNKNOWN
at io.grpc.Status.asRuntimeException(Status.java:526)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:418)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:663)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:392)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:443)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:525)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:446)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:557)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

I also tried adding an including the 2nd attached role in the delete query but got the same error and I was not removed.

Again please note this is not a critical error anymore for me. Thanks a million.

Harry

Relevant lines from grakn.log

2018-06-04 07:48:53,791 [qtp1979502976-6952] WARN  a.g.e.controller.GraqlController - 
Retrying transaction after {1} attempts due to exception {Vertex with id 462960 was removed.}
2018-06-04 07:48:53,792 [qtp1979502976-6952] ERROR ai.grakn.engine.HttpHandler - REST 
error
java.lang.IllegalStateException: Vertex with id 462960 was removed.
at org.apache.tinkerpop.gremlin.structure.Element$Exceptions.elementAlreadyRemoved(Element.java:154)
at org.janusgraph.core.InvalidElementException.removedException(InvalidElementException.java:58)
at org.janusgraph.graphdb.vertices.AbstractVertex.verifyAccess(AbstractVertex.java:86)
at org.janusgraph.graphdb.vertices.AbstractVertex.query(AbstractVertex.java:133)
at org.janusgraph.graphdb.vertices.AbstractVertex.edges(AbstractVertex.java:169)
at ai.grakn.kb.internal.structure.VertexElement.lambda$getEdgesOfType$0(VertexElement.java:62)
at java.lang.Iterable.spliterator(Iterable.java:101)
at ai.grakn.kb.internal.structure.VertexElement.getEdgesOfType(VertexElement.java:63)
at ai.grakn.kb.internal.concept.ThingImpl.castingsInstance(ThingImpl.java:192)
at ai.grakn.kb.internal.concept.ThingImpl.delete(ThingImpl.java:119)
at ai.grakn.kb.internal.concept.RelationshipImpl.delete(RelationshipImpl.java:231)
at ai.grakn.graql.internal.query.runner.TinkerQueryRunner.deleteResult(TinkerQueryRunner.java:214)
at ai.grakn.graql.internal.query.runner.TinkerQueryRunner.lambda$run$5(TinkerQueryRunner.java:113)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at ai.grakn.graql.internal.query.runner.TinkerQueryRunner.run(TinkerQueryRunner.java:113)
at ai.grakn.graql.internal.query.DeleteQueryImpl.execute(DeleteQueryImpl.java:51)
at ai.grakn.graql.internal.query.DeleteQueryImpl.execute(DeleteQueryImpl.java:38)
at ai.grakn.engine.controller.GraqlController.executeAndMonitor(GraqlController.java:297)
at ai.grakn.engine.controller.GraqlController.executeQuery(GraqlController.java:284)
at ai.grakn.engine.controller.GraqlController.lambda$executeGraql$5(GraqlController.java:197)
at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:78)
at com.github.rholder.retry.Retryer.call(Retryer.java:160)
at ai.grakn.engine.controller.GraqlController.executeFunctionWithRetrying(GraqlController.java:213)
at ai.grakn.engine.controller.GraqlController.executeGraql(GraqlController.java:185)
at spark.RouteImpl$1.handle(RouteImpl.java:61)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:126)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)