Releases: typedb/typeql
TypeQL 2.27.0-rc0
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.27.0-rc0
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.typedb.com</id>
<url>https://repo.typedb.com/public/public-release/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.27.0-rc0</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.27.0-rc0</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.27.0-rc0
New Features
Bugs Fixed
Code Refactors
-
Refactor TypeQL Java projection builder
We note a previous change in 2eef07d388391e073cc1631f5af2bbf15e844cc4 and extend it here to refactor the TypeQL Fetch projection query builder:
Usage rename, before:
cVar("x").map("name") label("subquery").map(TypeQL.match(...).fetch(...))
Usage now:
cVar("x").fetch("name") label("subquery").fetch(TypeQL.match(...).fetch(...))
Fetching multiple attributes without relabeling, before:
cVar("x").fetch(list(pair("name", null), pair("age", null), pair("dob", null)))
Usage now:
cVar("x").fetch("name", "age", "dob")
Other Improvements
-
Add helper method to create Sorting modifier with just one argument
-
ProjectionBuilder for fetch queries
-
Renamed projection builder 'map()' to 'fetch()' and dissolved Stream overload
TypeQL 2.26.6
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.26.6
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.typedb.com</id>
<url>https://repo.typedb.com/public/public-release/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.26.6</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.26.6</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.26.6
New Features
-
Implement non-ascii variables in Java and Rust
We update to TypeQL with Unicode support in both value and concept variables. This makes the following valid TypeQL:match $人 isa person, has name "Liu"; get $人;
match $אדם isa person, has name "Solomon"; get $אדם;
We now require all Labels and Variables are valid unicode identifiers not starting with
_
.This change is fully backwards compatible. We also validate that Type Labels and Variables created using the TypeQL language builders in both Rust and Java are conforming to our Unicode specification.
Bugs Fixed
-
Fix snapshot version in test-deployment-maven
We update the generated snapshot version in test-deployment-maven CI job to correspond to the updated snapshot version format.
Code Refactors
-
Allow variables to have a leading digit
We modify the behaviour of #310 which unified variables and labels to have the same valid identifier syntax, which eliminated the capability of variables to have a leading number. For example, the variable
$0
was banned.This PR reverts this specific behaviour, and enables usage of variables with leading digits:
match $1_a isa entity; get;
is made valid again.
Testing specified in typedb/typedb-behaviour#281
-
Merge typedb-common repository into typeql
As part of the effort to reduce the number of vaticle organization repositories, we merge typedb-common into the typeql repo as a subpackage.
Other Improvements
-
Sync dependencies in CI
We add a sync-dependencies job to be run in CI after successful snapshot and release deployments. The job sends a request to vaticle-bot to update all downstream dependencies.
Note: this PR does not update the
dependencies
repo dependency. It will be updated automatically by the bot during its first pass. -
Set up CI filters for master-development workflow
-
Migrate artifact hosting to cloudsmith
Updates artifact deployment & consumption rules to use cloudsmith instead of the self-hosted sonatype repository.
TypeQL 2.26.6-rc0
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.26.6-rc0
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.typedb.com</id>
<url>https://repo.typedb.com/public/public-release/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.26.6-rc0</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.26.6-rc0</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.26.6-rc0
New Features
-
Implement non-ascii variables in Java and Rust
We update to TypeQL with Unicode support in both value and concept variables. This makes the following valid TypeQL:match $人 isa person, has name "Liu"; get $人;
match $אדם isa person, has name "Solomon"; get $אדם;
We now require all Labels and Variables are valid unicode identifiers not starting with
_
.This change is fully backwards compatible. We also validate that Type Labels and Variables created using the TypeQL language builders in both Rust and Java are conforming to our Unicode specification.
Bugs Fixed
-
Fix snapshot version in test-deployment-maven
We update the generated snapshot version in test-deployment-maven CI job to correspond to the updated snapshot version format.
Code Refactors
-
Merge typedb-common repository into typeql
As part of the effort to reduce the number of vaticle organization repositories, we merge typedb-common into the typeql repo as a subpackage.
Other Improvements
-
Sync dependencies in CI
We add a sync-dependencies job to be run in CI after successful snapshot and release deployments. The job sends a request to vaticle-bot to update all downstream dependencies.
Note: this PR does not update the
dependencies
repo dependency. It will be updated automatically by the bot during its first pass. -
Set up CI filters for master-development workflow
-
Migrate artifact hosting to cloudsmith
Updates artifact deployment & consumption rules to use cloudsmith instead of the self-hosted sonatype repository.
TypeQL 2.25.8
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.25.8
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.25.8</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.25.8</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.25.8
New Features
Bugs Fixed
Code Refactors
-
Technical debt: improve error_messages, cleanup
error_messages!
now accepts struct enum variants, rather than tuple variants. This forces the user to name the fields and to refer to the fields by name in the format strings, reducing user error.
Other Improvements
-
Update README.md
-
Update readme: fix the forum badge
Update the readme file to fix the forum badge.
-
Fixed badges in README.md to refer to TypeQL
TypeQL 2.25.0
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.25.0
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.25.0</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.25.0</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.25.0
API Changes
One breaking change is implemented:
Match-Get
queries used to be implicit if theget
was ommitted. We now require theget
be explicitly written out. For example:
match $x isa entity;
must now be written as:
match $x isa entity; get; # or get $x;
One new type is added:
Match-Fetch
queries are now available as both builders and parsed queries.
New Features
-
Implement TypeQL Fetch query
We implement a new type of query: the
Fetch
query. This type of query does three things:- Projects the concepts selected in the 'match' clause into 'data' objects that can be consumed as a simple JSON structure
- Customising the desired JSON structure to be returned
- Fetches extra data beyond that described by the 'match' clause in the form of attribute retrieval or full subqueries.
The terminology we use to decribe 'fetch' clauses is that each entry in the 'fetch' is a projection.
Examples
- Projecting concepts selected from the 'match' clause directory into data objects. We are allowed to project attributes, types, and value concepts without transformation in the 'fetch' clause:
match $movie-type sub movie; # movie or its subtypes $x isa! $movie-type, # an entity instance of the type has title "Godfather", has release-date $date, has duration-minutes $mins; ?duration-hours = $mins / 60.0; fetch $movie-type; $date; ?duration-hours;
- Customising the desired JSON structure to be returned
match $movie-type sub movie; $x isa! $movie-type, has title "Godfather", has release-date $date, has duration-minutes $mins; ?duration-hours = $mins / 60.0; fetch $movie-type as "movie category"; # set the key to return $movie-types as to "movie category" $date as "release date"; # ... ?duration-hours as "length"; # ...
3a. Fetching extra data in the form of attributes. We use this to project an entity or relation into 'data' objects such as attributes, values, and types.
match $x isa movie, has title "Godfather", has release-date $date; fetch $x: title, duration-minutes as "length"; $date as "release-date";
3b. Fetching extra data in the form of subqueries:
match $x isa movie, has title "Godfather", has release-date $date; fetch $x: title, duration-minutes as "length"; $date as "release-date"; director-details: { # for each movie found, we will also get all the directors and fetch them as name and age match ($x, $director) isa directorship; fetch $director: name, age; }; director-count: { # for each movie found, we will retrieve the count of all directors for the movie match ($x, $director) isa directorship; get $director; count; };
TypeQL Fetch Query Builders
We also implement programmatic TypeQL builders for both Java and Rust. Without too much detail, here is how one would programmatically generate the query from 3b in Java and Rust builders:
Java
TypeQLFetch expected = match( cVar("x").isa("movie").has("title", "Godfather").has("release-date", cVar("date")) ).fetch( cVar("date").asLabel("release date"), // $date as "release date" cVar("x").map("title").map("duration-minutes", "length"), // $x: title, duration-minutes as "length" label("director-details").map( // subquery 'director-details' match( rel(cVar("x")).rel(cVar("director")).isa("directorship") ).fetch( cVar("director").map("name").map("age") ) ), label("directors-count").map( // subquery 'director-count' match( rel(cVar("x")).rel(cVar("director")).isa("directorship") ).get(cVar("director")).count() ) );
Rust
let projections: Vec<Projection> = vec![ cvar("date").label("release date").into(), // $date as "release date" cvar("x").map_attributes(vec![ // $x: title, duration-minutes as "length" "title".into(), ("duration-minutes", "length").into(), ]), label("director-details").map_subquery_fetch( // subquery 'director-details' typeql_match!( rel(cvar("x")).rel(cvar("director")).isa("directorship") ).fetch(vec![ cvar("director").map_attribute(vec!["name".into(), "age".into()]) ]) ), label("director-count").map_subquery_get_aggregate( // subquery 'director-count' typeql_match!( rel(cvar("x")).rel(cvar("director")).isa("directorship") ).get_fixed([cvar("director")]).count() ) ]; let typeql_fetch = typeql_match!( cvar("x").isa("movie").has(("title", "Godfather")).has(("release-date", cvar("date"))) ).fetch(projections);
Important TypeQL Changes
To help enforce when a 'Get' and 'Fetch' query is being issued, we now require that the 'get' clause is mandatory in
Get
queries, and rename what used to be considered a "Match" query to be a "Get" query.The mental model we encourage is that the 'match' clause of a query is the definition/constraint space to search, and the following clause is the operation over that space - for example get (without transformation), fetch (transformation), insert, delete, update, etc.
Bugs Fixed
Code Refactors
Other Improvements
-
Update README file
Update the README file.
-
Update root checkstyle to exclude banner
TypeQL 2.24.11
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.24.11
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.24.11</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.24.11</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.24.11
New Features
Bugs Fixed
Code Refactors
Other Improvements
TypeQL 2.24.8
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.24.8
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.24.8</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.24.8</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.24.8
New Features
Bugs Fixed
Code Refactors
Other Improvements
-
Update pest 2.4.0 => 2.7.4
We update to pest and pest-derive v2.7.4, which among other things purports to fix the error where deriving Parser fails on "undeclared crate or module
alloc
" (pest-parser/pest#900). -
Replace vaticle.com with typedb.com
-
Update release notes
TypeQL 2.24.5
TypeQL Grammar and Language Library distributions for Rust
Available through https://crates.io/crates/typeql.
cargo add typeql@2.24.5
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.24.5</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.24.5</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.24.5
New Features
Bugs Fixed
- Cargo package includes PEST grammar
- Add License and README to Cargo package
Code Refactors
Other Improvements
- Update to the latest dependencies, Bazel 6.2.0
TypeQL 2.24.0
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.24.0</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.24.0</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.24.0
New Features
-
Introduce expressions and computed value variables in typeql-rust
We introduce in
typeql-rust
the ability to perform arithmetic computation and store the results in a "value variable" - denoted by a preceding?
, the same as introduced intypeql-java
by #260.All redundant parenthesis from original query will not persist in the string representation of the parsed expression anymore. If we get this query:
match $p isa person, has salary $s; ?net = (($s - 12500) * 0.8 + 12500);
it will be transformed into
match $p isa person, has salary $s; ?net = ($s - 12500) * 0.8 + 12500;
-
Implement formatted code accessor for the TypeQL/common error macro
We implement the
format_code()
accessor for the generated error types, as well as expose thePREFIX
string. -
Debug formatting Errors
We improve the debug formatting for macro-generated errors, by including more detail about the error. This solves issue typedb/typedb-driver-rust#44
Bugs Fixed
-
Sanitise rust macros to avoid forcing user's environment
Problem is described in #298: we have macros that need access to other items in our crate. Paths to these items were not absolute, and users had to import that particular items and were able to use their own objects with the same names and use it in the macros. Now all paths are absolute, based on the
$crate
metavariable. -
Relation variable name in rule 'then' must not be present.
Check that relation variables used to infer new relations in then clause should be anonymous
-
Implement common error traits for Error
We implement cloning, equality comparison, and the standard error trait for the main
Error
type. -
Fix Rust parser for definables and variables
While parsing
Variable
,visit_pattern_variable()
panicked because of incorrect argument format. We fixed it and added unit tests. Similar errors ware while parsingdefinables
andpatterns
.
Code Refactors
Other Improvements
-
Enable Rust crate deployment
We enable the TypeQL Rust crate deployment jobs in CI.
-
Remove header from template
TypeQL 2.18.0
TypeQL
This release includes exciting changes such as expression-based computation (for an initially limited set of functions) and new annotation for attribute ownership: @unique
.
TypeQL Grammar and Language Library distributions for Java
<repositories>
<repository>
<id>repo.vaticle.com</id>
<url>https://repo.vaticle.com/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-grammar</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>2.18.0</version>
</dependency>
</dependencies>
TypeQL Grammar distribution for Python
Available through https://pypi.org
pip install typeql-grammar==2.18.0
New Features
-
Introduce expressions and computed value variables
We introduce the ability to perform arithmetic computation and store the results in a 'value variable' - denoted by a preceding
?
. For example:match $x isa triangle, has base $b, has height $h; ?area = 0.5 * $b * $h;
Or through the java api:
TypeQLMatch query = match( cVar("x").isa("triangle").has("base", cVar("b")).has("height", cVar("h")), vVar("area").assign(Expression.constant(0.5).mul(cVar("b").mul(cVar("h")))))) );
Rules now also support value-variable conclusions:
define rule computation-cost-dollars-to-pounds: when { $c isa computation, has cost-dollars $c; $_ isa exchange-rate, has name "dollar-pound", has rate $rate; ?pounds = $rate * $c; } then { $c has cost-pounds ?pounds; };
The expression on the right hand side of an assignment can be functions, operations, variables or constants:
- This PR implements infix operators:
+
,-
,*
,/
,^
,%
, - This PR implements prefix functions:
min
,max
,floor
,ceil
,round
,abs
- This PR implements parantheses:
(...)
and instantiation of constants eg.12
,0.25
,false
,"abc"
, etc.
These constructs are currently defined on double and long valued Attribute instances or Value instances.
The language implements order-of-operations for infix operators in this order:
()
,^
,*
,|
,%
,+
,-
.Deprecation warnings
- Using
=
can should no longer be used to denote value-equality.=
now represents value-assignment, with==
representing value equality. For the time being, concept variables$x
will still support the old syntax,=
and the new==
, however expect$x =
to be removed from the language in future releases.
Breaking changes
var
is no longer part of the TypeQL builder API, being replaced bycVar
to create concept variables ($x
) andvVar
to create a value variable (?y
).
- This PR implements infix operators:
-
Implement unique annotation in TypeQL Rust
We generalise the annotation syntax and parsing to be able to handle a new type of annotation: the
@unique
annotation, which is available only on the owns constraint:define person sub entity, owns email @unique;
The
@unique
annotation has been introduced first in TypeQL Java in #273. -
Introduce unique annotation in TypeQL Java
We generalise the annotation syntax and parsing to be able to handle a new type of annotation: the
@unique
annotation, which is available only on theowns
constraint:define person sub entity, owns email @unique; email sub attribute, value string;
This annotation indicates that any
email
s a person owns must be unique to that person. It does not place any restrictions on the number of emails any given person may own.The language builder API has also been updated to use a generalised form of any number of annotations, rather than having a particular boolean per annotation type (now, pass annotation
UNIQUE
orKEY
instead of booleans).
Bugs Fixed
-
Fix rule validation
While parsing a rule with
has
and without relation inthen
partexpect_valid_inference()
function panicked. Now it returns anError
. -
Fix TypeQL Python build
We fix the issue with grammar-python producing empty pip packages.
Code Refactors
-
Remove unnecessary parentheses
As per the Rust compiler:
warning: unnecessary parentheses around type | 306 | impl<const N: usize> From<([(&str, token::Order); N])> for Sorting { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 306 - impl<const N: usize> From<([(&str, token::Order); N])> for Sorting { 306 + impl<const N: usize> From<[(&str, token::Order); N]> for Sorting { |
Other Improvements
-
Update release notes workflow
We integrate the new release notes tooling. The release notes are now to be written by a person and committed to the repo.
-
Don't use bazel-cache for building all targets, which includes Python targets
-
Set up remote bazel cache