Skip to content

Releases: typedb/typeql

Graql 2.0.0-alpha-3

13 Jan 13:26
b24190a
Compare
Choose a tag to compare

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

06 Jan 21:03
d40d2aa
Compare
Choose a tag to compare

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

03 Jan 14:18
Compare
Choose a tag to compare

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 to iid, and thus the literal id is now free for user to use in their schema
  • Only data (things) can be referred to by their iid now. Schema (types) can only be referred to using their label.
  • Changed regex of concept IIDs from: ('V'|'E')[a-z0-9-]* ; (alpha numeric string starting with V or E) 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 an iid 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 Concept iid is officially dangerous now: the iid of a concept before and after being committed to the database are different. So if you hold onto an iid 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 valid iid. 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, with owns
  • Replace key keyword with a @key annotation that follows has <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...

Read more

Graql 1.0.8

10 Aug 13:44
Compare
Choose a tag to compare

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

17 Jun 15:31
5b64da8
Compare
Choose a tag to compare

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, including via.

  • 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 accept statement_instance for delete 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 in build-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

17 Jan 10:56
e2b45d6
Compare
Choose a tag to compare

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 having 10.123 seconds, and 2019-01-01T10:10:10.1 will parse as having 10.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

04 Dec 22:28
b330b89
Compare
Choose a tag to compare

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 of graknlabs_common

Code Refactors

  • Remove aggregate as a reserved keyword.
    Clean up forgotten unused keyword

Other Improvements

Graql 1.0.4

22 Nov 15:56
c84e0d7
Compare
Choose a tag to compare

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 in README

  • Adapt to latest changes in bazel-distribution.
    typedb/bazel-distribution#191 changed the way Maven JARs are built. This PR adapts graql to latest changes

Code Refactors

  • Remove special Compute Count Attribute Exclusion.
    In the past compute count; was treating Attributes as a special case/second class citizen of Grakn and excluded by default from the count. The current design thinking is that compute count; should return the same values as match...get...count without reasoning enabled.
    This means we can remove the special casing for including attributes in the compute count Graql behavior.

  • Migrate utils to graknlabs/common.
    Since we have graknlabs/common for common collections in util, we can migrate common occurences to depend on this central library. This PR removes copies of Collections, Pair and Triple and depends on graknlabs/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

23 Sep 21:42
Compare
Choose a tag to compare

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

05 Sep 14:25
8d66116
Compare
Choose a tag to compare

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 that limit is not applied to match...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 be artifact-id-version.jar, without the group-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 with graql- 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 of Variable 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 of bazel version in @graknlabs_build_tools broke CI for graql. This PR aims to fix it by synchronizing .bazelrc with latest version in build-tools.