Esempio n. 1
0
 def get_players(self, role_types=None):
     if not role_types:
         role_types = []
     method = concept_proto.Thing.Req()
     get_players_req = concept_proto.Relation.GetPlayers.Req()
     get_players_req.role_types.extend(concept_proto_builder.types(role_types))
     method.relation_get_players_req.CopyFrom(get_players_req)
     return self._thing_stream(method, lambda res: res.relation_get_players_res.things)
Esempio n. 2
0
 def get_has(self,
             attribute_type=None,
             attribute_types: List = None,
             only_key=False):
     if [bool(attribute_type),
             bool(attribute_types), only_key].count(True) > 1:
         raise GraknClientException(
             "Only one filter can be applied at a time to get_has."
             "The possible filters are: [attribute_type, attribute_types, only_key]"
         )
     if attribute_type:
         attribute_types = [attribute_type]
     method = concept_proto.Thing.Req()
     get_has_req = concept_proto.Thing.GetHas.Req()
     if only_key:
         get_has_req.keys_only = only_key
     elif attribute_types:
         get_has_req.attribute_types.extend(
             concept_proto_builder.types(attribute_types))
     method.thing_get_has_req.CopyFrom(get_has_req)
     return self._thing_stream(method,
                               lambda res: res.thing_get_has_res.attributes)