Search in sources :

Example 21 with TxResponse

use of ai.grakn.rpc.generated.GrpcGrakn.TxResponse in project grakn by graknlabs.

the class TxObserver method runConceptMethod.

private void runConceptMethod(RunConceptMethod runConceptMethod) {
    Concept concept = nonNull(tx().getConcept(GrpcUtil.getConceptId(runConceptMethod)));
    GrpcConceptConverter converter = grpcConcept -> tx().getConcept(GrpcUtil.convert(grpcConcept.getId()));
    ConceptMethod<?> conceptMethod = ConceptMethods.fromGrpc(converter, runConceptMethod.getConceptMethod());
    TxResponse response = conceptMethod.run(grpcIterators, concept);
    responseObserver.onNext(response);
}
Also used : Concept(ai.grakn.concept.Concept) GrpcConcept(ai.grakn.rpc.generated.GrpcConcept) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) RunConceptMethod(ai.grakn.rpc.generated.GrpcGrakn.RunConceptMethod) ExecQuery(ai.grakn.rpc.generated.GrpcGrakn.ExecQuery) GrpcGraknService.nonNull(ai.grakn.engine.rpc.GrpcGraknService.nonNull) Role(ai.grakn.concept.Role) GrpcOpenRequestExecutor(ai.grakn.grpc.GrpcOpenRequestExecutor) Concept(ai.grakn.concept.Concept) AttributeValue(ai.grakn.rpc.generated.GrpcConcept.AttributeValue) GrpcIterators(ai.grakn.grpc.GrpcIterators) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) GrpcUtil(ai.grakn.grpc.GrpcUtil) Open(ai.grakn.rpc.generated.GrpcGrakn.Open) Rule(ai.grakn.concept.Rule) EntityType(ai.grakn.concept.EntityType) ConceptMethod(ai.grakn.grpc.ConceptMethod) Attribute(ai.grakn.concept.Attribute) TxResponse(ai.grakn.rpc.generated.GrpcGrakn.TxResponse) StreamObserver(io.grpc.stub.StreamObserver) Label(ai.grakn.concept.Label) ConceptMethods(ai.grakn.grpc.ConceptMethods) QueryResult(ai.grakn.rpc.generated.GrpcGrakn.QueryResult) AttributeType(ai.grakn.concept.AttributeType) RelationshipType(ai.grakn.concept.RelationshipType) GrpcConceptConverter(ai.grakn.grpc.GrpcConceptConverter) Status(io.grpc.Status) Stop(ai.grakn.rpc.generated.GrpcIterator.Stop) ThreadFactory(java.util.concurrent.ThreadFactory) Nullable(javax.annotation.Nullable) ExecutorService(java.util.concurrent.ExecutorService) QueryBuilder(ai.grakn.graql.QueryBuilder) Iterator(java.util.Iterator) IteratorId(ai.grakn.rpc.generated.GrpcIterator.IteratorId) Collection(java.util.Collection) PutRule(ai.grakn.rpc.generated.GrpcGrakn.PutRule) Next(ai.grakn.rpc.generated.GrpcIterator.Next) TxRequest(ai.grakn.rpc.generated.GrpcGrakn.TxRequest) Executors(java.util.concurrent.Executors) PostProcessor(ai.grakn.engine.task.postprocessing.PostProcessor) StatusRuntimeException(io.grpc.StatusRuntimeException) ExecutionException(java.util.concurrent.ExecutionException) Stream(java.util.stream.Stream) GrpcConcept(ai.grakn.rpc.generated.GrpcConcept) EmbeddedGraknTx(ai.grakn.kb.internal.EmbeddedGraknTx) Optional(java.util.Optional) PutAttributeType(ai.grakn.rpc.generated.GrpcGrakn.PutAttributeType) Pattern(ai.grakn.graql.Pattern) GrpcConceptConverter(ai.grakn.grpc.GrpcConceptConverter) TxResponse(ai.grakn.rpc.generated.GrpcGrakn.TxResponse)

Aggregations

TxResponse (ai.grakn.rpc.generated.GrpcGrakn.TxResponse)21 Test (org.junit.Test)10 IteratorId (ai.grakn.rpc.generated.GrpcIterator.IteratorId)9 GrpcConcept (ai.grakn.rpc.generated.GrpcConcept)8 Concept (ai.grakn.concept.Concept)6 QueryResult (ai.grakn.rpc.generated.GrpcGrakn.QueryResult)6 Answer (ai.grakn.graql.admin.Answer)5 GraknTx (ai.grakn.GraknTx)4 TxGrpcCommunicator (ai.grakn.grpc.TxGrpcCommunicator)4 GetQuery (ai.grakn.graql.GetQuery)3 GrpcGrakn (ai.grakn.rpc.generated.GrpcGrakn)3 Attribute (ai.grakn.concept.Attribute)2 Role (ai.grakn.concept.Role)2 DefineQuery (ai.grakn.graql.DefineQuery)2 QueryBuilder (ai.grakn.graql.QueryBuilder)2 QueryAnswer (ai.grakn.graql.internal.query.QueryAnswer)2 TxRequest (ai.grakn.rpc.generated.GrpcGrakn.TxRequest)2 AttributeType (ai.grakn.concept.AttributeType)1 EntityType (ai.grakn.concept.EntityType)1 Label (ai.grakn.concept.Label)1