typeql
typeql copied to clipboard
TypeQL Rust prototype
What is the goal of this PR?
We implement a subset of the TypeQL parser in Rust. The scope encompasses basic, i.e. non-aggregate, match
queries like:
match
$brando "Marl B" isa name;
(actor: $brando, $char, movie: $movie);
$movie has title $title,
has release-date 2020-05-07T00:00;
get $char, $title; sort $title;
What are the changes implemented in this PR?
Implemented the data structures with corresponding builder functions and parser visitors for the following constructs:
-
match
query; - generic conjunction;
- thing variable constraints:
-
isa X
; -
has X
; - attribute value constraints:
$x = $y
or$x 123
; - relations:
$r(role: $x, ...) isa relation_type;
-
- type variable constraints:
-
type T
; -
sub T
; -
relates R
; -
plays R
; -
owns T
;
-
- match query modifiers:
-
get $x
; -
sort $x
; -
limit N
; -
offset N
.
-
PR Review Checklist
Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.
Code
- [x] Packages, classes, and methods have a single domain of responsibility.
- [x] Packages, classes, and methods are grouped into cohesive and consistent domain model.
- [x] The code is canonical and the minimum required to achieve the goal.
- [x] Modules, libraries, and APIs are easy to use, robust (foolproof and not errorprone), and tested.
- [x] Logic and naming has clear narrative that communicates the accurate intent and responsibility of each module (e.g. method, class, etc.).
- [x] The code is algorithmically efficient and scalable for the whole application.
Architecture
- [x] Any required refactoring is completed, and the architecture does not introduce technical debt incidentally.
- [x] Any required build and release automations are updated and/or implemented.
- [x] Any new components follows a consistent style with respect to the pre-existing codebase.
- [x] The architecture intuitively reflects the application domain, and is easy to understand.
- [x] The architecture has a well-defined hierarchy of encapsulated components.
- [x] The architecture is extensible and scalable.