Releases: typedb/typeql
Graql 2.0.0-alpha-3
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>2.0.0-alpha-3</version>
</dependency>
</dependencies>
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Graql 2.0.0-alpha-2
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>2.0.0-alpha-2</version>
</dependency>
</dependencies>
This release contains changes only for the build system and dependencies.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Graql 2.0.0-alpha
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>2.0.0-alpha</version>
</dependency>
</dependencies>
New Graql: even simpler and more powerful
As a result of the change in our type system, Graql also needed to be changed. We kept the grammar almost entirely, especially in data queries, but we considerably improved the schema language. We introduced more expressive features, such as inheriting and overriding attribute types and role types, to reflect the type system's new features. However, we also introduced changes that significantly simplify your schema, such as "scoping role types to their relation types", making the Graql language even easier to use. Under-the-hood, we rebuilt Graql to natively have a graph data structure and be semantically logical - which made implementing everything else in Grakn so much easier.
Please refer to full release notes of Grakn 2.0.0-alpha to see the changes in Grakn 2.0.0.
Public API changes and new features
The following changes impact how you use Graql and may require you to make changes if you migrate from 1.8.4 or earlier.
1) Concept ID
- Renamed
id
toiid
, and thus the literalid
is now free for user to use in their schema - Only data (
thing
s) can be referred to by theiriid
now. Schema (type
s) can only be referred to using theirlabel
. - Changed regex of concept IIDs from:
('V'|'E')[a-z0-9-]* ;
(alpha numeric string starting withV
orE
) to'0x'[0-9a-f]+
(a hexadecimal string).
Example: Instead of saying match $x id V123; get $x;
you now say match $x iid 0x04fa523; get $x;
.
Note that we continue to discourage you in using Concept
iid
.
The purpose of aniid
is as an "internal identifier" that the server uses under-the-hood to refer to concepts. This was prematurely exposed in the earlier versions of Grakn. Referring to Conceptiid
is officially dangerous now: theiid
of a concept before and after being committed to the database are different. So if you hold onto aniid
of a concept you've just written to the database before you commit it, and try to use it to query the concept after it has been committed, it will not be a validiid
. If you would like to refer to a thing uniquely, you must declare a@key
attribute for that thing, as a "primary key" to uniquely refer to the concept.
2) Attribute ownership in the schema
- Replaced
has
keyword in Type Variable properties, withowns
- Replace
key
keyword with a@key
annotation that followshas <type>
For example, where previously you would write:
define
person sub entity,
key email,
has name;
You now write:
define
person sub entity,
owns email @key,
owns name;
To add or remove a @key
annotation, re-define the ownership with or without it. For example, to set email
to not be a @key
, do:
define person owns email;
Note that the has
keyword for thing
variables remains unchanged. You still write:
match $x isa person, has name $name;
3) Roles are now scoped by their relations
Roles are now scoped by their relations, such that they will only be uniquely identifiable by relation:role
. Previously, names of Role Types are globally unique. Now, that's no longer true. Role Types only need to be unique in the scope of their relation, and the relation they extend/inherit. This simplifies the effort of naming role types considerably. Thus, in order to refer to roles that a thing
could play
, we now refer to played roles as relation:role
.
For example, previously we would say:
define
task sub entity,
plays dependency_dependee,
plays dependency_dependant;
dependency sub relation,
relates dependency_dependee,
relates dependency_dependant;
Now you can say:
define
task sub entity,
plays dependency:dependee,
plays dependency:dependant;
dependency sub relation,
relates dependee,
relates dependant;
4) Roles are inherited in a relation hierarchy
Previously, one had to "redeclare" a role type that they would like to inherit in a subtyping relation hierarchy. For example:
define
parenthood sub relation,
relates parenthood_parent,
relates parenthood_child;
motherhood sub parenthood,
relates parenthood_mother as parenthood_parent,
relates parenthood_child;
Now you no longer need to redeclare the parenthood_child
roletype in the subtyping relation type motherhood
. You can simply say the following and achieve the same goal (where motherhood
also relates a child
):
define
parenthood sub relation,
relates parent,
relates child;
motherhood sub parenthood,
relates mother as parent;
ps: you also don't need the parenthood_
prefix on the role types because they are now scoped by their relation types.
5) Overriding attribute and role types
- override inherited attribute types by defining
owns <type> as <inherted type>
- override inherited played role types by defining
plays <type> as <inhierted type>
- override inherited related role types by defining
relates <type> as <inherited type>
The first two are new, and they do not clash with previous grammar. Previously, we were not able to override an inherited owned attribute or played role type. Now we can. Here's an example of all three usages:
define
company sub entity, owns company-name;
charity sub company, owns charity-name as company-name;
person sub entity, plays parentship:parent;
man sub person, plays fathership:father as parent;
parentship sub relation, relates parent;
fathership sub parentship, relates father as parent;
Once a type is overridden using as
, the override type is no longer available. So in the above example, a charity
can no longer own any instances of company-name
, and only own charity-name
.
6) Rule definition syntax
Rule definition no longer follows concept type
definition syntax using sub
. Rules now have their own syntax to be defined and undefined.
To define
a rule, you now say:
define
rule transitive-ownership:
when {
(owned: $x, owner: $y) isa ownership;
(owned: $y, owner: $z) isa ownership;
} then {
(owned: $x, owner: $z) isa ownership;
};
To undefine
a rule, you now say:
undefine
rule transitive-ownership;
7) Permitted Rule Semantics
Rules have been streamlined to produce consistent logical semantics: a rule can now only infer a full "fact".
Option 1: a rule inferring a new relation
rule transitive-ownership:
when {
(owned: $x, owner: $y) isa ownership;
(owned: $y, owner: $z) isa ownership;
} then {
(owned: $x, owner: $z) isa ownership;
};
Option 2: a rule can add an ownership between an existing concept and existing attribute
rule user-has-group-permissions:
when {
$x isa user; $g isa group, has permission-level $p;
(member: $x, member-of: $g) isa group-membership;
} then {
$x has $p;
}
Option 3: a rule can add an ownership of a potentially new attribute
rule voting-age-requirement:
when {
$x isa person, has age >= 18;
} then {
$x has may-vote true;
}
We no longer permit a rule to add new role players to an existing relation:
rule add-mutual-friend:
when {
$r ($x) isa friendship; $x isa person;
$r2 ($x, $y) isa friendship; $r2 != $r
} then {
$r (friend: $y) isa friendship;
}
We also no longer permit a rule to copy an attribute value (Note that this feature will be reintroduced with arithmetic in a later version of Grakn):
rule copy-id:
when {
$x has government-id $id;
} then {
$x has company-id $id;
}
Rules now have more flexibility in using variables for defining new relations:
rule binary-to-ternary-relations:
when {
$r ($rol: $x, $rol: $y) isa $rel;
$r2 ($rol: $x, $rol: $z) isa $rel;
} then {
($rol: $x, $rol: $y, $rol: $z) isa $rel;
}
Finally, on negation in rules: this is currently not ready for 2.0.0 release, so you won't be able to write negations in rules. However, we are planning to bring it back as soon as 2.1, and we will be permitting multiple negation blocks in the when
clause of a rule, rather than just one.
rule person-not-in-any-marriage:
when {
$x isa person;
not { (husband: $x) isa marriage; };
not { (wife: $x) isa marriage; };
} then {
(unmarried: $x) isa not-married;
}
8) Concept equality, replacing concept inequality
We would like to streamline the attribute value constraints to be more consistent. Right now, >
, <
, >=
, and<=
, all operate on "attribute values". However, !=
operates on "concept equality". And thus to evaluate "attribute value equality" and "inequality", we must use ==
and !==
. This was very inelegant and thus was error-prone as they were very close to =
and !=
. This behaviour was also inelegant for another reason: that it introduced a second way to do "negation", other than through our not
logical operator. This issue has also been raised through issue #167.
Our conclusion is to remove "concept inequality" constraint (!=
), and introduce new constraint operator: is
. is
would allow us to...
Graql 1.0.8
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
New Features
New dependency imports for maven.
Bugs Fixed
Code Refactors
Other Improvements
- Integrate building with BuildBuddy.
Migrate from RBE to BuildBuddy
Graql 1.0.7
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
New Features
-
Remove implicit types syntax from grammar.
Remove all references to implicit types and attribute relations, includingvia
. -
Remove VIA.
Remove VIA from the language, as we no longer need it. Implicit attribute relations will be removed, and deletion is accessible using a different syntax. -
Deletes accept statement_instance instead of variables.
Implementing the first step of #115, we change the grammar to acceptstatement_instance
fordelete
clauses, not just variables. As a medium term consequence, we remove the ability to limit, sort or offset delete queries.
Bugs Fixed
Code Refactors
- Revert rename to ValueClass from ValueType.
Decided to stick with ValueType instead of ValueClass
Other Improvements
-
Add .bazelrc.
.bazelrc
needs to be synced with version inbuild-tools
such that RBE uses proper config. -
Upgrade to Bazel 3.0.0.
Upgrade Bazel to latest upstream version -
Update copyright headers to 2020.
In order for build not to break after typedb/typedb-dependencies#122, copyright headers need to be updated.
Graql 1.0.6
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
New Features
-
Datetime Milliseconds Decimal Representation.
Enable and test the inclusion of fractions of seconds in a date time attribute value, up to 3 digits, allowing us to store up to 999 milliseconds.
For example,
2019-01-01T10:10:10.123
will now parse as having10.123
seconds, and2019-01-01T10:10:10.1
will parse as having10.100
seconds
Bugs Fixed
Code Refactors
Other Improvements
-
Use forked rules_antlr.
Recently Maven Central started enforcing HTTPS when downloading artifacts (ref) -
Upgrade to bazel rules_antlr package 0.4 from 0.2.
Due to maven changes to requiring access over HTTPS rather than HTTP, rules_antlr 0.2.0 broke. To fix this, we upgrade to rules_antlr 0.4 (current). Now require bazel 0.29, added in .bazelversion -
Update build-tools in order to fix the HTTPS issue when accessing Maven Central.
We have update build-tools to the one which connects to Maven Central with HTTPS.
Graql 1.0.5
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
New Features
Bugs Fixed
-
Add the maven release repository in test deployment.
We have fixed a bug in the test deployment where the release repository is not included. -
Add release-validate for graknlabs_common.
We have added release-validation ofgraknlabs_common
Code Refactors
- Remove aggregate as a reserved keyword.
Clean up forgotten unused keyword
Other Improvements
Graql 1.0.4
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
New Features
- Integrate checking for unused Java dependencies.
Integrate checking for unused Java dependencies
Bugs Fixed
-
Fix a typo in README.
Fix a typo in Bazel target name inREADME
-
Adapt to latest changes in bazel-distribution.
typedb/bazel-distribution#191 changed the way Maven JARs are built. This PR adaptsgraql
to latest changes
Code Refactors
-
Remove special Compute Count Attribute Exclusion.
In the pastcompute count;
was treating Attributes as a special case/second class citizen of Grakn and excluded by default from thecount
. The current design thinking is thatcompute count;
should return the same values asmatch...get...count
without reasoning enabled.
This means we can remove the special casing for including attributes in thecompute count
Graql behavior. -
Migrate utils to graknlabs/common.
Since we havegraknlabs/common
for common collections inutil
, we can migrate common occurences to depend on this central library. This PR removes copies ofCollections
,Pair
andTriple
and depends ongraknlabs/common
instead. -
Refactor how version is provided to deployment rules.
Adapt@graknlabs_graql
to latest changes in bazel-distribution (in particular, typedb/bazel-distribution#150)
Other Improvements
- Add release title in the Github draft.
Add release title in the Github draft.
Graql 1.0.3
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
Graql 1.0.2
Distribution (for Java)
<repositories>
<repository>
<id>repo.grakn.ai</id>
<url>https://repo.grakn.ai/repository/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.graql</groupId>
<artifactId>graql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
New Features
Bugs Fixed
-
GraqlDelete Ignore limit filter.
A bug filed previously typedb/typedb#5388 shows thatlimit
is not applied tomatch...delete
queries. An investigation showed that filters were not even leaving the Graql parser and becoming part of the parsed Graql objects. -
Prefixed artifact IDs of Maven packages with 'graql-'.
When deploying Maven JARs to Sonatype, the JARs are renamed to beartifact-id-version.jar
, without thegroup-id
. This is done in Sonatype because the JARs are organised into folders where the folder names represent the Group IDs. However, in certain build systems, e.g. Gradle, the JARs are collected under one directory, which means the JAR names are not unique enough to disambiguate itself from each other. We have now renamed the artifact ID of our Maven packages to be prefixed withgraql-
to solve this problem.
Code Refactors
- Update from 2018 to 2019 in license headers.
Other Improvements
-
Revert @rules_antlr to use mainline repo.
Previously, a forked copy of@rules_antlr
with several patches was used to generate ANTLR code. We can now use mainline repo since fixes we needed were merged. -
Cache Variable hashCode and add missing negation hashCode&equals.
During profiling it occurred to us that caching the hashCode ofVariable
might be a good idea as it is called often. This PR introduces the change. Additionally we make equals and hashCode consistent for all patterns. -
Fix CI by synchronizing .bazelrc with @graknlabs_build_tools.
Recent upgrade ofbazel
version in@graknlabs_build_tools
broke CI forgraql
. This PR aims to fix it by synchronizing.bazelrc
with latest version inbuild-tools
.