Search in sources :

Example 1 with ConceptMethod

use of ai.grakn.grpc.ConceptMethod 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

Attribute (ai.grakn.concept.Attribute)1 AttributeType (ai.grakn.concept.AttributeType)1 Concept (ai.grakn.concept.Concept)1 EntityType (ai.grakn.concept.EntityType)1 Label (ai.grakn.concept.Label)1 RelationshipType (ai.grakn.concept.RelationshipType)1 Role (ai.grakn.concept.Role)1 Rule (ai.grakn.concept.Rule)1 GrpcGraknService.nonNull (ai.grakn.engine.rpc.GrpcGraknService.nonNull)1 PostProcessor (ai.grakn.engine.task.postprocessing.PostProcessor)1 Pattern (ai.grakn.graql.Pattern)1 QueryBuilder (ai.grakn.graql.QueryBuilder)1 ConceptMethod (ai.grakn.grpc.ConceptMethod)1 ConceptMethods (ai.grakn.grpc.ConceptMethods)1 GrpcConceptConverter (ai.grakn.grpc.GrpcConceptConverter)1 GrpcIterators (ai.grakn.grpc.GrpcIterators)1 GrpcOpenRequestExecutor (ai.grakn.grpc.GrpcOpenRequestExecutor)1 GrpcUtil (ai.grakn.grpc.GrpcUtil)1 EmbeddedGraknTx (ai.grakn.kb.internal.EmbeddedGraknTx)1 GrpcConcept (ai.grakn.rpc.generated.GrpcConcept)1