Skip to content

Commit aaf44f3

Browse files
author
Ganeshwara Hananda
authored
Support match, match aggregate, match group, and match group aggregate (#100)
## What is the goal of this PR? We have updated protocol to support not only `match` queries, but also `match aggregate`, `match group`, and `match group aggregate`. ## What are the changes implemented in this PR? - Extend the protocol by adding new message types: `Match.Aggregate`, `Match.Group`, and `Match.Group.Aggregate` - Remove the ability to nest `AnswerGroup` which is no longer needed given the new answer structure.
1 parent caca382 commit aaf44f3

File tree

2 files changed

+56
-26
lines changed

2 files changed

+56
-26
lines changed

protobuf/answer.proto

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,22 @@ import "protobuf/concept.proto";
2424

2525
package grakn.protocol;
2626

27-
message Answer {
28-
oneof answer {
29-
AnswerGroup answer_group = 1;
30-
ConceptMap concept_map = 2;
31-
Number number = 3;
32-
}
33-
}
34-
35-
message AnswerGroup {
36-
Concept owner = 1;
37-
repeated Answer answers = 2;
38-
}
39-
4027
message ConceptMap {
4128
map<string, Concept> map = 1;
4229
string pattern = 2;
4330
}
4431

32+
message ConceptMapGroup {
33+
Concept owner = 1;
34+
repeated ConceptMap concept_maps = 2;
35+
}
36+
4537
message Number {
4638
string value = 1;
4739
// We use a string to contain the full representation of a number
4840
}
41+
42+
message NumberGroup {
43+
Concept owner = 1;
44+
repeated Number numbers = 2;
45+
}

protobuf/query.proto

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,29 @@ message Query {
3030
message Req {
3131
Options options = 1;
3232
oneof req {
33-
Graql.Delete.Req delete_req = 100;
34-
Graql.Define.Req define_req = 101;
35-
Graql.Undefine.Req undefine_req = 102;
36-
Graql.Match.Req match_req = 103;
37-
Graql.Insert.Req insert_req = 104;
33+
Delete.Req delete_req = 100;
34+
Define.Req define_req = 101;
35+
Undefine.Req undefine_req = 102;
36+
Match.Req match_req = 103;
37+
MatchAggregate.Req match_aggregate_req = 104;
38+
MatchGroup.Req match_group_req = 105;
39+
MatchGroupAggregate.Req match_group_aggregate_req = 106;
40+
Insert.Req insert_req = 107;
3841
}
3942
}
4043

4144
message Res {
4245
oneof res {
43-
Graql.Delete.Res delete_res = 100;
44-
Graql.Define.Res define_res = 101;
45-
Graql.Undefine.Res undefine_res = 102;
46-
Graql.Match.Res match_res = 103;
47-
Graql.Insert.Res insert_res = 104;
46+
Delete.Res delete_res = 100;
47+
Define.Res define_res = 101;
48+
Undefine.Res undefine_res = 102;
49+
Match.Res match_res = 103;
50+
MatchAggregate.Res match_aggregate_res = 104;
51+
MatchGroup.Res match_group_res = 105;
52+
MatchGroupAggregate.Res match_group_aggregate_res = 106;
53+
Insert.Res insert_res = 107;
4854
}
4955
}
50-
}
51-
52-
message Graql {
5356

5457
message Match {
5558
message Req {
@@ -60,6 +63,36 @@ message Graql {
6063
}
6164
}
6265

66+
message MatchAggregate {
67+
message Req {
68+
string query = 1;
69+
}
70+
71+
message Res {
72+
Number answer = 1;
73+
}
74+
}
75+
76+
message MatchGroup {
77+
message Req {
78+
string query = 1;
79+
}
80+
81+
message Res {
82+
repeated ConceptMapGroup answers = 1;
83+
}
84+
}
85+
86+
message MatchGroupAggregate {
87+
message Req {
88+
string query = 1;
89+
}
90+
91+
message Res {
92+
repeated NumberGroup answers = 1;
93+
}
94+
}
95+
6396
message Insert {
6497
message Req {
6598
string query = 1;

0 commit comments

Comments
 (0)