Skip to content
Draft
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9a6a022
WIP: Flush out QueryStructure
krishnangovindraj May 12, 2025
04fad54
Add kind, links can have multiple role-players
krishnangovindraj May 12, 2025
71bf044
Add query-structure into header & provenance into row
krishnangovindraj May 12, 2025
7b606d8
Update BUILD files
krishnangovindraj May 12, 2025
97e193b
Fix build files
krishnangovindraj May 12, 2025
2396bab
Add constraint span
krishnangovindraj May 12, 2025
9f9bd41
Add exactness to Isa, Sub and other speculatively
krishnangovindraj May 12, 2025
b10129f
Fix label to be a concept
krishnangovindraj May 12, 2025
8b77d2a
Fix value to be oneof
krishnangovindraj May 12, 2025
315168e
Fix owns field names
krishnangovindraj May 12, 2025
e7160ba
Make expression assigned repeated for future-proofing
krishnangovindraj May 12, 2025
aee5da4
Extend QueryVariable to possibly be unavailable
krishnangovindraj May 12, 2025
7de1479
Some minor renaming
krishnangovindraj May 12, 2025
1d00ae0
Add span for each role-player
krishnangovindraj May 13, 2025
0eaf900
Flatten links roleplayers
krishnangovindraj May 13, 2025
0a5eb80
Reflect naming
krishnangovindraj May 16, 2025
b912759
Make labels only accept type
krishnangovindraj May 16, 2025
0586271
Reflect renaming again
krishnangovindraj May 19, 2025
cff738f
Remove query structure from ConceptRowStream, making it currently unused
krishnangovindraj Sep 12, 2025
c8b975a
Try filling in analyze proto
krishnangovindraj Sep 12, 2025
b197dc2
Do I have to add it to the filegroup?
krishnangovindraj Sep 15, 2025
98ba00c
Rename Constraint to structureConstraint for consistency
krishnangovindraj Sep 15, 2025
e7b9671
And one for the build.rs
krishnangovindraj Sep 15, 2025
e8f9bc3
Add constraint nested patterns + sort direction
krishnangovindraj Sep 15, 2025
1a3bbee
Rename inner to conjunction
krishnangovindraj Sep 15, 2025
90e977e
Rename Disjunction -> or etc for consistency
krishnangovindraj Sep 15, 2025
373db61
Make StructureVertex Label support unresolved labels
krishnangovindraj Sep 22, 2025
7b77360
Forgot oneoef
krishnangovindraj Sep 22, 2025
a2cd43a
Introduce Analyze req & res into transaction rpc
krishnangovindraj Sep 24, 2025
c9b4bf5
Variables deserve their own message
krishnangovindraj Sep 24, 2025
3fb64f1
Oopsies. I forgot about annotations
krishnangovindraj Sep 24, 2025
f59677e
Forgot the fields in res
krishnangovindraj Sep 24, 2025
ec84d80
Make return reducer field plural
krishnangovindraj Sep 24, 2025
e185176
Add kind & label constraints; comparator
krishnangovindraj Sep 24, 2025
574bc32
Rename Value(Constraint)::type -> attribute_type
krishnangovindraj Sep 24, 2025
9fba4c5
Rename Iid field: var -> concenpt
krishnangovindraj Sep 24, 2025
daa9860
Fix build
krishnangovindraj Sep 29, 2025
a3cd5d5
WIP: Add conjunction annotations; next fetch
krishnangovindraj Sep 29, 2025
6729f15
Add fetch annotations
krishnangovindraj Sep 29, 2025
f731396
Add function annotations & update
krishnangovindraj Oct 2, 2025
a3e548f
Add returns_stream to function annotations
krishnangovindraj Oct 2, 2025
9f0f388
Fix function annotations
krishnangovindraj Oct 2, 2025
4d51f8f
Support Thing & Type
krishnangovindraj Oct 2, 2025
a45dc23
Bad field name in ConceptVariableAnnotations
krishnangovindraj Oct 2, 2025
8e7077e
Oopsies. Do analyze errors properly
krishnangovindraj Oct 2, 2025
8095df4
Remove TOOD
krishnangovindraj Oct 6, 2025
ba56e09
Rename Label.label::(failedInference to unresolved)
krishnangovindraj Oct 6, 2025
deae655
Move StructureVertex::Label::unresolved to a new Label::NamedRole var…
krishnangovindraj Oct 6, 2025
bf98739
Add unresolved as a variant in vertex
krishnangovindraj Oct 6, 2025
f2aa192
Rename conjunction.proto to structure.proto
krishnangovindraj Oct 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions grpc/java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ java_grpc_library(
"//proto:options-proto",
"//proto:query-proto",
"//proto:transaction-proto",
"//proto:analyze-proto",
"//proto:conjunction-proto",
"//proto:version-proto",
],
# TypeDB Core bundles JARs by maven coordinate, we can remove this when Core is rewritten in Rust
Expand Down
2 changes: 2 additions & 0 deletions grpc/nodejs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ts_grpc_compile(
"//proto:options-proto",
"//proto:query-proto",
"//proto:transaction-proto",
"//proto:analyze-proto",
"//proto:conjunction-proto",
"//proto:version-proto",
]
)
Expand Down
2 changes: 2 additions & 0 deletions grpc/rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ rust_tonic_compile(
"//proto:options-proto",
"//proto:query-proto",
"//proto:transaction-proto",
"//proto:analyze-proto",
"//proto:conjunction-proto",
"//proto:version-proto",
]
)
Expand Down
2 changes: 2 additions & 0 deletions grpc/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

fn main() -> std::io::Result<()> {
let protos = vec![
"../../proto/analyze.proto",
"../../proto/answer.proto",
"../../proto/authentication.proto",
"../../proto/concept.proto",
"../../proto/connection.proto",
"../../proto/conjunction.proto",
"../../proto/database.proto",
"../../proto/error.proto",
"../../proto/migration.proto",
Expand Down
22 changes: 22 additions & 0 deletions proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ proto_library(
name = "transaction-proto",
srcs = ["transaction.proto"],
deps = [
":analyze-proto",
":answer-proto",
":concept-proto",
":error-proto",
Expand All @@ -103,6 +104,25 @@ proto_library(
]
)

proto_library(
name = "analyze-proto",
srcs = ["analyze.proto"],
deps = [
":conjunction-proto",
":concept-proto",
":error-proto",
],
)

proto_library(
name = "conjunction-proto",
srcs = ["conjunction.proto"],
deps = [
":answer-proto",
":concept-proto",
],
)

proto_library(
name = "version-proto",
srcs = ["version.proto"],
Expand All @@ -114,9 +134,11 @@ proto_library(
filegroup(
name = "proto-raw-buffers",
srcs = [
"analyze.proto",
"answer.proto",
"concept.proto",
"connection.proto",
"conjunction.proto",
"options.proto",
"query.proto",
"transaction.proto",
Expand Down
189 changes: 189 additions & 0 deletions proto/analyze.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

syntax = "proto3";

import "proto/conjunction.proto";
import "proto/concept.proto";
import "proto/error.proto";

package typedb.protocol;

message Analyze {

message Req {
string query = 1;
}

message Res {
oneof result {
Error err = 1;
AnalyzedQuery ok = 2;
}

message AnalyzedQuery {
QueryStructure structure = 1;
QueryAnnotations annotations = 2;

message QueryStructure {
PipelineStructure query = 1;
repeated FunctionStructure preamble = 2;

message FunctionStructure {
PipelineStructure body = 1;
repeated ConjunctionStructure.Variable arguments = 2;
oneof returns {
ReturnOpStream stream = 3;
ReturnOpSingle single = 4;
ReturnOpCheck check = 5;
ReturnOpReduce reduce = 6;
};

message ReturnOpStream {
repeated ConjunctionStructure.Variable variables = 1;
}
message ReturnOpSingle {
string selector = 1;
repeated ConjunctionStructure.Variable variables = 2;
}
message ReturnOpCheck {}
message ReturnOpReduce {
repeated Reducer reducers = 1;
}
}

message PipelineStructure {
repeated ConjunctionStructure conjunctions = 1;
repeated PipelineStage stages = 2;
map<uint32, VariableInfo> variable_info = 3;
repeated ConjunctionStructure.Variable outputs = 4;

message VariableInfo {
string name = 1;
}

message PipelineStage {
oneof stage {
Match match = 1;
Insert insert = 2;
Put put = 3;
Update update = 4;
Delete delete = 5;
Select select = 6;
Sort sort = 7;
Require require = 8;
Offset offset = 9;
Limit limit = 10;
Distinct distinct = 11;
Reduce reduce = 12;
}

// They're all the same structure. Should we just use one?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quite like them separate! In Rust itll be very easy to unpack them identically

message Match {
uint32 block = 1;
}
message Insert {
uint32 block = 1;
}
message Put {
uint32 block = 1;
}
message Update {
uint32 block = 1;
}
message Delete {
uint32 block = 1;
repeated ConjunctionStructure.Variable deleted_variables = 2;
}

message Select {
repeated ConjunctionStructure.Variable variables = 1;
}
message Sort {
repeated SortVariable sort_variables = 1;
message SortVariable {
ConjunctionStructure.Variable variable = 1;
SortDirection direction = 2;
enum SortDirection {
ASC = 0;
DESC = 1;
}
}
}
message Require {
repeated ConjunctionStructure.Variable variables = 1;
}
message Offset {
uint64 offset = 1;
}
message Limit {
uint64 limit = 1;
}
message Distinct {}
message Reduce {
repeated ReduceAssign reducers = 1;
repeated ConjunctionStructure.Variable groupby = 2;

message ReduceAssign {
ConjunctionStructure.Variable assigned = 1;
Reducer reducer = 2;
}
}
}
}

message Reducer {
string reducer = 1;
repeated ConjunctionStructure.Variable variables = 2;
}
}

message QueryAnnotations {
PipelineAnnotations query = 1;
repeated FunctionAnnotations preamble = 2;
FetchAnnotations fetch = 3;

message FunctionAnnotations {
repeated VariableAnnotations arguments = 1;
repeated VariableAnnotations returns = 2;
bool returns_stream = 3;
PipelineAnnotations body = 4;
}

message PipelineAnnotations {
repeated ConjunctionAnnotations conjunctions = 1;
message ConjunctionAnnotations {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to move this to the Conjunction?
Structure and Annotations have the same structure and are just unzipped. I don't see a great reason to keep it this way.

map<uint32, VariableAnnotations> variable_annotations = 1;
}
}

message FetchAnnotations {
oneof node {
Object object = 1;
FetchAnnotations list = 2;
Leaf leaf = 3;
}
message Object {
map<string, FetchAnnotations> annotations = 1;
}
message Leaf {
repeated ValueType annotations = 1;
}
}

message VariableAnnotations {
oneof annotations {
ConceptVariableAnnotations thing = 1;
ConceptVariableAnnotations type = 2;
ValueType value_annotations = 3;

}
message ConceptVariableAnnotations {
repeated Type types = 1;
}
}
}
}
}
}
1 change: 1 addition & 0 deletions proto/answer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package typedb.protocol;

message ConceptRow {
repeated RowEntry row = 1;
bytes involved_blocks = 2;
}

message RowEntry {
Expand Down
Loading