17
17
# under the License.
18
18
#
19
19
20
- from itertools import imap
21
-
22
20
from grakn .service .Session .util import enums
23
21
from grakn .service .Session .util .RequestBuilder import RequestBuilder
24
22
from grakn .exception .GraknError import GraknError
23
+ from six .moves import map
25
24
26
25
27
26
class RemoteConcept (object ):
@@ -163,7 +162,7 @@ def subs(self):
163
162
""" Retrieve the sub schema concepts of this schema concept, as an iterator """
164
163
subs_req = RequestBuilder .ConceptMethod .SchemaConcept .subs ()
165
164
from grakn .service .Session .Concept import ConceptFactory
166
- return imap (lambda iter_res :
165
+ return map (lambda iter_res :
167
166
ConceptFactory .create_remote_concept (self ._tx_service ,
168
167
iter_res .schemaConcept_subs_iter_res .schemaConcept ),
169
168
self ._tx_service .run_concept_iter_method (self .id , subs_req ))
@@ -172,7 +171,7 @@ def sups(self):
172
171
""" Retrieve the all supertypes (direct and higher level) of this schema concept as an iterator """
173
172
sups_req = RequestBuilder .ConceptMethod .SchemaConcept .sups ()
174
173
from grakn .service .Session .Concept import ConceptFactory
175
- return imap (lambda iter_res :
174
+ return map (lambda iter_res :
176
175
ConceptFactory .create_remote_concept (self ._tx_service ,
177
176
iter_res .schemaConcept_sups_iter_res .schemaConcept ),
178
177
self ._tx_service .run_concept_iter_method (self .id , sups_req ))
@@ -201,7 +200,7 @@ def attributes(self):
201
200
""" Retrieve all attributes attached to this Type as an iterator """
202
201
attributes_req = RequestBuilder .ConceptMethod .Type .attributes ()
203
202
from grakn .service .Session .Concept import ConceptFactory
204
- return imap (lambda iter_res :
203
+ return map (lambda iter_res :
205
204
ConceptFactory .create_remote_concept (self ._tx_service ,
206
205
iter_res .type_attributes_iter_res .attributeType ),
207
206
self ._tx_service .run_concept_iter_method (self .id , attributes_req ))
@@ -210,7 +209,7 @@ def instances(self):
210
209
""" Retrieve all instances of this Type as an iterator """
211
210
instances_req = RequestBuilder .ConceptMethod .Type .instances ()
212
211
from grakn .service .Session .Concept import ConceptFactory
213
- return imap (lambda iter_res :
212
+ return map (lambda iter_res :
214
213
ConceptFactory .create_remote_concept (self ._tx_service ,
215
214
iter_res .type_instances_iter_res .thing ),
216
215
self ._tx_service .run_concept_iter_method (self .id , instances_req ))
@@ -219,7 +218,7 @@ def playing(self):
219
218
""" Retrieve iterator of roles played by this type """
220
219
playing_req = RequestBuilder .ConceptMethod .Type .playing ()
221
220
from grakn .service .Session .Concept import ConceptFactory
222
- return imap (lambda iter_res :
221
+ return map (lambda iter_res :
223
222
ConceptFactory .create_remote_concept (self ._tx_service ,
224
223
iter_res .type_playing_iter_res .role ),
225
224
self ._tx_service .run_concept_iter_method (self .id , playing_req ))
@@ -252,7 +251,7 @@ def keys(self):
252
251
""" Retrieve an iterator of attribute types that this Type uses as keys """
253
252
keys_req = RequestBuilder .ConceptMethod .Type .keys ()
254
253
from grakn .service .Session .Concept import ConceptFactory
255
- return imap (lambda iter_res :
254
+ return map (lambda iter_res :
256
255
ConceptFactory .create_remote_concept (self ._tx_service ,
257
256
iter_res .type_keys_iter_res .attributeType ),
258
257
self ._tx_service .run_concept_iter_method (self .id , keys_req ))
@@ -353,7 +352,7 @@ def roles(self):
353
352
""" Retrieve roles in this relation schema type """
354
353
get_roles = RequestBuilder .ConceptMethod .RelationType .roles ()
355
354
from grakn .service .Session .Concept import ConceptFactory
356
- return imap (lambda iter_res :
355
+ return map (lambda iter_res :
357
356
ConceptFactory .create_remote_concept (self ._tx_service ,
358
357
iter_res .relationType_roles_iter_res .role ),
359
358
self ._tx_service .run_concept_iter_method (self .id , get_roles ))
@@ -407,7 +406,7 @@ def relations(self):
407
406
""" Retrieve relations that this role participates in, as an iterator """
408
407
relations_req = RequestBuilder .ConceptMethod .Role .relations ()
409
408
from grakn .service .Session .Concept import ConceptFactory
410
- return imap (lambda iter_res :
409
+ return map (lambda iter_res :
411
410
ConceptFactory .create_remote_concept (self ._tx_service ,
412
411
iter_res .role_relations_iter_res .relationType ),
413
412
self ._tx_service .run_concept_iter_method (self .id , relations_req ))
@@ -416,7 +415,7 @@ def players(self):
416
415
""" Retrieve an iterator of entities that play this role """
417
416
players_req = RequestBuilder .ConceptMethod .Role .players ()
418
417
from grakn .service .Session .Concept import ConceptFactory
419
- return imap (lambda iter_res :
418
+ return map (lambda iter_res :
420
419
ConceptFactory .create_remote_concept (self ._tx_service ,
421
420
iter_res .role_players_iter_res .type ),
422
421
self ._tx_service .run_concept_iter_method (self .id , players_req ))
@@ -443,7 +442,7 @@ def relations(self, *roles):
443
442
""" Get iterator this Thing's relations, filtered to the optionally provided roles """
444
443
relations_req = RequestBuilder .ConceptMethod .Thing .relations (roles )
445
444
from grakn .service .Session .Concept import ConceptFactory
446
- return imap (lambda iter_res :
445
+ return map (lambda iter_res :
447
446
ConceptFactory .create_remote_concept (self ._tx_service ,
448
447
iter_res .thing_relations_iter_res .relation ),
449
448
self ._tx_service .run_concept_iter_method (self .id , relations_req ))
@@ -452,7 +451,7 @@ def attributes(self, *attribute_types):
452
451
""" Retrieve iterator of this Thing's attributes, filtered by optionally provided attribute types """
453
452
attrs_req = RequestBuilder .ConceptMethod .Thing .attributes (attribute_types )
454
453
from grakn .service .Session .Concept import ConceptFactory
455
- return imap (lambda iter_res :
454
+ return map (lambda iter_res :
456
455
ConceptFactory .create_remote_concept (self ._tx_service ,
457
456
iter_res .thing_attributes_iter_res .attribute ),
458
457
self ._tx_service .run_concept_iter_method (self .id , attrs_req ))
@@ -461,7 +460,7 @@ def roles(self):
461
460
""" Retrieve iterator of roles this Thing plays """
462
461
roles_req = RequestBuilder .ConceptMethod .Thing .roles ()
463
462
from grakn .service .Session .Concept import ConceptFactory
464
- return imap (lambda iter_res :
463
+ return map (lambda iter_res :
465
464
ConceptFactory .create_remote_concept (self ._tx_service ,
466
465
iter_res .thing_roles_iter_res .role ),
467
466
self ._tx_service .run_concept_iter_method (self .id , roles_req ))
@@ -470,7 +469,7 @@ def keys(self, *attribute_types):
470
469
""" Retrieve iterator of keys (i.e. actual attributes) of this Thing, filtered by the optionally provided attribute types """
471
470
keys_req = RequestBuilder .ConceptMethod .Thing .keys (attribute_types )
472
471
from grakn .service .Session .Concept import ConceptFactory
473
- return imap (lambda iter_res :
472
+ return map (lambda iter_res :
474
473
ConceptFactory .create_remote_concept (self ._tx_service ,
475
474
iter_res .thing_keys_iter_res .attribute ),
476
475
self ._tx_service .run_concept_iter_method (self .id , keys_req ))
@@ -506,7 +505,7 @@ def owners(self):
506
505
""" Retrieve entities that have this attribute value """
507
506
owners_req = RequestBuilder .ConceptMethod .Attribute .owners ()
508
507
from grakn .service .Session .Concept import ConceptFactory
509
- return imap (lambda iter_res :
508
+ return map (lambda iter_res :
510
509
ConceptFactory .create_remote_concept (self ._tx_service ,
511
510
iter_res .attribute_owners_iter_res .thing ),
512
511
self ._tx_service .run_concept_iter_method (self .id , owners_req ))
@@ -551,7 +550,7 @@ def role_players(self, *roles):
551
550
""" Retrieve role players filtered by roles """
552
551
role_players_req = RequestBuilder .ConceptMethod .Relation .role_players (roles )
553
552
from grakn .service .Session .Concept import ConceptFactory
554
- return imap (lambda iter_res :
553
+ return map (lambda iter_res :
555
554
ConceptFactory .create_remote_concept (self ._tx_service ,
556
555
iter_res .relation_rolePlayers_iter_res .thing ),
557
556
self ._tx_service .run_concept_iter_method (self .id , role_players_req ))
0 commit comments