Skip to content

Commit 94b79eb

Browse files
Implement Fetch protocol using Document return type (#210)
## Release notes: usage and product changes We implement Fetch queries, which return concept Document streams.
1 parent 709bfd2 commit 94b79eb

File tree

3 files changed

+35
-47
lines changed

3 files changed

+35
-47
lines changed

proto/answer.proto

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,15 @@ message RowEntry {
3333
}
3434
}
3535

36-
//
37-
//message Explainables {
38-
// map<string, Explainable> relations = 1;
39-
// map<string, Explainable> attributes = 2;
40-
// map<string, Owned> ownerships = 3;
41-
//
42-
// message Owned {
43-
// map<string, Explainable> owned = 1;
44-
// }
45-
//}
46-
//
47-
//message Explainable {
48-
// string conjunction = 1;
49-
// int64 id = 2;
50-
//}
51-
//
52-
//message ConceptMapGroup {
53-
// Concept owner = 1;
54-
// repeated ConceptMap concept_maps = 2;
55-
//}
56-
//
57-
//message ValueGroup {
58-
// Concept owner = 1;
59-
// optional Value value = 2;
60-
//}
61-
62-
message ReadableConceptTree {
63-
64-
Node.Map root = 1;
36+
message ConceptDocument {
37+
38+
Node root = 1;
6539

6640
message Node {
6741
oneof node {
6842
Map map = 1;
6943
List list = 2;
70-
ReadableConcept readable_concept = 3;
44+
Leaf leaf = 3;
7145
}
7246

7347
message Map {
@@ -78,17 +52,29 @@ message ReadableConceptTree {
7852
repeated Node list = 1;
7953
}
8054

81-
message ReadableConcept {
82-
oneof readable_concept {
83-
EntityType entity_type = 1;
84-
RelationType relation_type = 2;
85-
AttributeType attribute_type = 3;
55+
message Leaf {
56+
oneof leaf {
57+
Empty empty = 1;
58+
59+
EntityType entity_type = 10;
60+
RelationType relation_type = 11;
61+
AttributeType attribute_type = 12;
62+
RoleType role_type = 13;
63+
ValueType value_type = 15;
8664

87-
RoleType role_type = 4;
65+
Attribute attribute = 20;
66+
Value value = 21;
67+
68+
Kind kind = 30;
69+
}
8870

89-
Attribute attribute = 5;
71+
message Empty {}
9072

91-
Value value = 6;
73+
enum Kind {
74+
Entity = 0;
75+
Relation = 1;
76+
Attribute = 3;
77+
Role = 4;
9278
}
9379
}
9480
}

proto/concept.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ message Value {
8484
Datetime datetime = 1;
8585
oneof timezone {
8686
string named = 2;
87+
// offset in seconds
8788
sint32 offset = 3;
8889
}
8990
}

proto/query.proto

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,21 @@ message Query {
3232
message Ok {
3333
oneof ok {
3434
Empty empty = 1;
35-
ReadableConceptTreeStream readable_concept_tree_stream = 3;
35+
ConceptDocumentStream concept_document_stream = 3;
3636
ConceptRowStream concept_row_stream = 4;
3737
}
3838

39-
message Empty {
39+
message Empty {}
4040

41-
}
42-
43-
message ReadableConceptTreeStream {
41+
message ConceptDocumentStream {
4442
// note: we could use this first response to record debug info, type annotations, warnings, etc
45-
// TODO: Add Type query_type
43+
// TODO: network optimisation: replace keys with IDs, sending keys in the header to rebuild the document on the client side
44+
// TODO: network optimisation: replace types (== mostly constant strings) with a IDs, sending types in the header to rebuild on the client side
45+
Type query_type = 2;
4646
}
4747

4848
message ConceptRowStream {
49+
// TODO: network optimisation: replace types (== mostly constant strings) with a IDs, sending types in the header to rebuild on the client side
4950
repeated string column_variable_names = 1;
5051
Type query_type = 2;
5152
}
@@ -54,12 +55,12 @@ message Query {
5455

5556
message ResPart {
5657
oneof res {
57-
ReadableConceptTreesRes trees_res = 1;
58+
ConceptDocumentsRes documents_res = 1;
5859
ConceptRowsRes rows_res = 2;
5960
}
6061

61-
message ReadableConceptTreesRes {
62-
repeated ReadableConceptTree trees = 1;
62+
message ConceptDocumentsRes {
63+
repeated ConceptDocument documents = 1;
6364
}
6465

6566
message ConceptRowsRes {

0 commit comments

Comments
 (0)