-
Notifications
You must be signed in to change notification settings - Fork 15
Add analyze endpoint and query structure #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
krishnangovindraj
wants to merge
50
commits into
typedb:master
Choose a base branch
from
krishnangovindraj:query-structure
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 49 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
9a6a022
WIP: Flush out QueryStructure
krishnangovindraj 04fad54
Add kind, links can have multiple role-players
krishnangovindraj 71bf044
Add query-structure into header & provenance into row
krishnangovindraj 7b606d8
Update BUILD files
krishnangovindraj 97e193b
Fix build files
krishnangovindraj 2396bab
Add constraint span
krishnangovindraj 9f9bd41
Add exactness to Isa, Sub and other speculatively
krishnangovindraj b10129f
Fix label to be a concept
krishnangovindraj 8b77d2a
Fix value to be oneof
krishnangovindraj 315168e
Fix owns field names
krishnangovindraj e7160ba
Make expression assigned repeated for future-proofing
krishnangovindraj aee5da4
Extend QueryVariable to possibly be unavailable
krishnangovindraj 7de1479
Some minor renaming
krishnangovindraj 1d00ae0
Add span for each role-player
krishnangovindraj 0eaf900
Flatten links roleplayers
krishnangovindraj 0a5eb80
Reflect naming
krishnangovindraj b912759
Make labels only accept type
krishnangovindraj 0586271
Reflect renaming again
krishnangovindraj cff738f
Remove query structure from ConceptRowStream, making it currently unused
krishnangovindraj c8b975a
Try filling in analyze proto
krishnangovindraj b197dc2
Do I have to add it to the filegroup?
krishnangovindraj 98ba00c
Rename Constraint to structureConstraint for consistency
krishnangovindraj e7b9671
And one for the build.rs
krishnangovindraj e8f9bc3
Add constraint nested patterns + sort direction
krishnangovindraj 1a3bbee
Rename inner to conjunction
krishnangovindraj 90e977e
Rename Disjunction -> or etc for consistency
krishnangovindraj 373db61
Make StructureVertex Label support unresolved labels
krishnangovindraj 7b77360
Forgot oneoef
krishnangovindraj a2cd43a
Introduce Analyze req & res into transaction rpc
krishnangovindraj c9b4bf5
Variables deserve their own message
krishnangovindraj 3fb64f1
Oopsies. I forgot about annotations
krishnangovindraj f59677e
Forgot the fields in res
krishnangovindraj ec84d80
Make return reducer field plural
krishnangovindraj e185176
Add kind & label constraints; comparator
krishnangovindraj 574bc32
Rename Value(Constraint)::type -> attribute_type
krishnangovindraj 9fba4c5
Rename Iid field: var -> concenpt
krishnangovindraj daa9860
Fix build
krishnangovindraj a3cd5d5
WIP: Add conjunction annotations; next fetch
krishnangovindraj 6729f15
Add fetch annotations
krishnangovindraj f731396
Add function annotations & update
krishnangovindraj a3e548f
Add returns_stream to function annotations
krishnangovindraj 9f0f388
Fix function annotations
krishnangovindraj 4d51f8f
Support Thing & Type
krishnangovindraj a45dc23
Bad field name in ConceptVariableAnnotations
krishnangovindraj 8e7077e
Oopsies. Do analyze errors properly
krishnangovindraj 8095df4
Remove TOOD
krishnangovindraj ba56e09
Rename Label.label::(failedInference to unresolved)
krishnangovindraj deae655
Move StructureVertex::Label::unresolved to a new Label::NamedRole var…
krishnangovindraj bf98739
Add unresolved as a variant in vertex
krishnangovindraj f2aa192
Rename conjunction.proto to structure.proto
krishnangovindraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? | ||
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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we try to move this to the Conjunction? |
||
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; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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