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

Commit e42ecc6

Browse files
author
Alex Walker
authored
Delete query_pattern from ConceptMap (#147)
## What is the goal of this PR? Delete query_pattern from ConceptMap
1 parent 6fc3bd8 commit e42ecc6

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

grakn/concept/answer/concept_map.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ class ConceptMap(Answer):
3131

3232
_THING = "thing"
3333

34-
def __init__(self, mapping: Mapping[str, Concept], query_pattern: str):
34+
def __init__(self, mapping: Mapping[str, Concept]):
3535
self._map = mapping
36-
self._query_pattern = query_pattern
37-
38-
def query_pattern(self):
39-
return self._query_pattern
4036

4137
def map(self):
4238
return self._map
@@ -73,5 +69,4 @@ def _of(concept_map_proto: answer_proto.ConceptMap):
7369
else:
7470
concept = concept_proto_reader.type_(res_concept.type)
7571
variable_map[res_var] = concept
76-
query_pattern = None if concept_map_proto.pattern == "" else concept_map_proto.pattern
77-
return ConceptMap(variable_map, query_pattern)
72+
return ConceptMap(variable_map)

grakn/concept/type/attribute_type.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,20 @@ def put(self, value: str):
265265
def get(self, value: str):
266266
return self._get_internal(concept_proto_builder.string_attribute_value(value))
267267

268+
def get_regex(self):
269+
method = concept_proto.Type.Req()
270+
get_regex_req = concept_proto.AttributeType.GetRegex.Req()
271+
method.attribute_type_get_regex_req.CopyFrom(get_regex_req)
272+
regex = self._execute(method).attribute_type_get_regex_res.regex
273+
return None if len(regex) == 0 else regex
274+
275+
def set_regex(self, regex: str):
276+
method = concept_proto.Type.Req()
277+
set_regex_req = concept_proto.AttributeType.SetRegex.Req()
278+
set_regex_req.regex = regex
279+
method.attribute_type_set_regex_req.CopyFrom(set_regex_req)
280+
self._execute(method)
281+
268282
def is_string(self):
269283
return True
270284

0 commit comments

Comments
 (0)