Skip to content
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

TypeQL 3.0 #342

Merged
merged 62 commits into from
Jul 8, 2024
Merged

TypeQL 3.0 #342

merged 62 commits into from
Jul 8, 2024

Conversation

dmitrii-ubskii
Copy link
Member

@dmitrii-ubskii dmitrii-ubskii commented Jul 8, 2024

Usage and product changes

User-defined functions and structs:

fun mean_salary($c: company) -> double? :
    match 
        (company: $c, employee: $_) isa employment, has salary $s;
    return mean($s); 
struct dated_coordinate:
    longitude value double,
    latitude value double,
    date value datetime;

Query pipelines:

with fun costliest_printer($employee: employee) -> printer? :
  match 
    ($printer, $employee) isa print_permission;
    $printer has cost_per_page $cost;
  sort $cost desc;
  return first($printer);
match
  $printer isa printer, has office_number $n, has newly_installed true;
  $employee isa employee, has office_number $n;
put ($employee, $printer) isa print_permission;
match 
  $high_cost_printer = costliest_printer($employee), has printer_name $name;
  not { $printer is $high_cost_printer; };
  $employee has contact $address;
insert 
  $notice isa queued_email, has recipient $address, 
  has content "Do you still need the printer " + $name + "?";

New undefine syntax allows user to be more precise as to what is being undefined:

undefine
owns age from person;
@regex from first-name;
as name from person owns first-name;

New, more concise delete syntax:

match $p isa person, has name $n;
delete $n of $p;

Implement JSON-like string unescaping (closes #106).

See The TypeDB 3.0 Roadmap for more details!

rust/annotation.rs Outdated Show resolved Hide resolved
rust/expression/mod.rs Outdated Show resolved Hide resolved
rust/common/identifier.rs Show resolved Hide resolved
rust/parser/typeql.pest Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/value.rs Outdated
Comment on lines 60 to 63
// 1. unquote
let escaped_string = &escaped_string[1..escaped_string.len() - 1]; // TODO check it's quoted

// 2. JSON unescape
Copy link
Member

Choose a reason for hiding this comment

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

Let's make sure this is outlined in the PR description + we can close the long-lived open PR if it is solved!

rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/parser/typeql.pest Outdated Show resolved Hide resolved
rust/value.rs Outdated Show resolved Hide resolved
rust/value.rs Outdated Show resolved Hide resolved
@dmitrii-ubskii dmitrii-ubskii merged commit 4a279a8 into typedb:3.0 Jul 8, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants