Ejemplo n.º 1
0
 def insert(self, query: str, options: GraknOptions = None):
     if not options:
         options = GraknOptions.core()
     request = query_proto.Query.Req()
     insert_req = query_proto.Query.Insert.Req()
     insert_req.query = query
     request.insert_req.CopyFrom(insert_req)
     return map(
         lambda answer_proto: concept_map._of(answer_proto),
         self._iterate_query(request,
                             lambda res: res.query_res.insert_res.answers,
                             options))
Ejemplo n.º 2
0
def _of(proto_answer: answer_proto.Answer):
    answer_case = proto_answer.WhichOneof("answer")
    if answer_case == Answer._CONCEPT_MAP:
        return concept_map._of(proto_answer.concept_map)
    raise GraknClientException("The answer type " + answer_case +
                               " was not recognised.")
Ejemplo n.º 3
0
 def match(self, query: str, options=GraknOptions()):
     request = query_proto.Query.Req()
     match_req = query_proto.Graql.Match.Req()
     match_req.query = query
     request.match_req.CopyFrom(match_req)
     return map(lambda answer_proto: concept_map._of(answer_proto), self._iterate_query(request, lambda res: res.query_res.match_res.answers, options))
Ejemplo n.º 4
0
def _of(concept_map_group_proto: answer_proto.ConceptMapGroup):
    return ConceptMapGroup(concept(concept_map_group_proto.owner), map(lambda cm: concept_map._of(cm), concept_map_group_proto.concept_maps))