Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Commit 98ad793

Browse files
author
Ganeshwara Hananda
committed
Update @graknlabs_protocol and rename get_type to get_thing_type
1 parent bba2227 commit 98ad793

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ assemble_pip(
8080
author_email = "[email protected]",
8181
license = "Apache-2.0",
8282
install_requires=[
83-
'graknprotocol==2.0.0a3',
83+
'graknprotocol==2.0.0a4',
8484
'grpcio==1.33.2',
8585
'protobuf==3.6.1',
8686
'six>=1.11.0',

grakn/concept/concept_manager.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, transaction):
3131
self._transaction = transaction
3232

3333
def get_root_thing_type(self):
34-
return self.get_type("thing")
34+
return self._get_thing_type("thing")
3535

3636
def get_root_entity_type(self):
3737
return self.get_entity_type("entity")
@@ -51,7 +51,7 @@ def put_entity_type(self, label: str):
5151
return EntityType._of(res.put_entity_type_res.entity_type)
5252

5353
def get_entity_type(self, label: str):
54-
_type = self.get_type(label)
54+
_type = self._get_thing_type(label)
5555
return _type if _type.is_entity_type() else None
5656

5757
def put_relation_type(self, label: str):
@@ -63,7 +63,7 @@ def put_relation_type(self, label: str):
6363
return RelationType._of(res.put_relation_type_res.relation_type)
6464

6565
def get_relation_type(self, label: str):
66-
_type = self.get_type(label)
66+
_type = self._get_thing_type(label)
6767
return _type if _type.is_relation_type() else None
6868

6969
def put_attribute_type(self, label: str, value_type):
@@ -76,7 +76,7 @@ def put_attribute_type(self, label: str, value_type):
7676
return concept_proto_reader.attribute_type(res.put_attribute_type_res.attribute_type)
7777

7878
def get_attribute_type(self, label: str):
79-
_type = self.get_type(label)
79+
_type = self._get_thing_type(label)
8080
return _type if _type.is_attribute_type() else None
8181

8282
def get_thing(self, iid: str):
@@ -88,14 +88,14 @@ def get_thing(self, iid: str):
8888
response = self._execute(req)
8989
return concept_proto_reader.thing(response.get_thing_res.thing) if response.get_thing_res.WhichOneof("res") == "thing" else None
9090

91-
def get_type(self, label: str):
91+
def _get_thing_type(self, label: str):
9292
req = concept_proto.ConceptManager.Req()
93-
get_type_req = concept_proto.ConceptManager.GetType.Req()
94-
get_type_req.label = label
95-
req.get_type_req.CopyFrom(get_type_req)
93+
get_thing_type_req = concept_proto.ConceptManager.GetThingType.Req()
94+
get_thing_type_req.label = label
95+
req.get_thing_type_req.CopyFrom(get_thing_type_req)
9696

9797
response = self._execute(req)
98-
return concept_proto_reader.type_(response.get_type_res.type) if response.get_type_res.WhichOneof("res") == "type" else None
98+
return concept_proto_reader.thing_type(response.get_thing_type_res.thing_type) if response.get_thing_type_res.WhichOneof("res") == "thing_type" else None
9999

100100
def _execute(self, request: concept_proto.ConceptManager.Req):
101101
req = transaction_proto.Transaction.Req()

grakn/concept/type/type.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def delete(self):
154154
self._execute(method)
155155

156156
def is_deleted(self):
157-
return not self._transaction.concepts().get_type(self.get_label())
157+
return not self._transaction.concepts()._get_thing_type(self.get_label())
158158

159159
def _type_stream(self, method: concept_proto.Type.Req, type_list_getter: Callable[[concept_proto.Type.Res], List[concept_proto.Type]]):
160160
method.label = self.get_label()

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#
1919

2020
# --extra-index-url https://repo.grakn.ai/repository/pypi-snapshot/simple
21-
graknprotocol==2.0.0a3
21+
graknprotocol==2.0.0a4
2222
grpcio==1.33.2
2323
protobuf==3.6.1
2424
six>=1.11.0

test/integration/test_query.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_define_and_undef_relation_type(self):
4040
with client.session("grakn", SessionType.SCHEMA) as session:
4141
with session.transaction(TransactionType.WRITE) as tx:
4242
tx.query().define("define lionfight sub relation, relates victor, relates loser;")
43-
lionfight_type = tx.concepts().get_type("lionfight")
43+
lionfight_type = tx.concepts().get_relation_type("lionfight")
4444
print(lionfight_type._label)
4545
tx.query().undefine("undefine lionfight sub relation;")
4646
tx.commit()

0 commit comments

Comments
 (0)