Skip to content

Releases: typedb/typeql

Graql 2.0.0-alpha-7

04 Feb 18:08
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-7</version>
    </dependency>
</dependencies>

New Features

Bugs Fixed

Code Refactors

Other Improvements

Please refer to full release notes of 2.0.0-alpha to see the changes in 2.0.0.

Graql 2.0.0-alpha-6

28 Jan 10:03
d691c26
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

Code Refactors

Other Improvements

  • Add typeless has to thing variable builder
    As deleting a roleplayer now requires typeless has (to avoid a derived isa being present), we added a has overload to ThingVariableBuilder in order to construct a typeless has.

  • Mark Isa constraints derived via has constraints as derived
    In order to handle deletion properly, we need to be able to distinguish Isa constraints placed implicitly as part of has. For example, $x has name $y implies $y isa name, but if we are deleting $x has name $y we should not also delete $y's isa constraint. To this end, we added a flag on the Isa constraint indicating if it was derived.

  • Reenable remote build caching
    Speed up builds by utilizing remote caching provided by BuildBuddy.

Please refer to full release notes of 2.0.0-alpha to see the changes in 2.0.0.

Graql 2.0.0-alpha-5

24 Jan 17:33
933564d
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

Code Refactors

Other Improvements

  • Allow named unbound variables to be retrieved from insert & delete query
    Implemented NamedUnboundVariables on GraqlInsert

Please refer to full release notes of 2.0.0-alpha to see the changes in 2.0.0.

Graql 2.0.0-alpha-4

21 Jan 15:04
9b218cf
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-4</version>
    </dependency>
</dependencies>

New Features

Bugs Fixed

Code Refactors

Other Improvements

  • Scope unscoped role types in Plays TypeConstraints
    When a role type is overridden within the Plays constraint, the overridden type is specified with no scope- we can infer the scope based on it being a supertype of the supplied role type, but at parse time this is not possible to infer without building the entire graph tree. In order to avert this, we supplied the root Relation type as a scope for the relation so it can be identified as a role type ahead of time, which leads to it being passed over for definition.

  • Fix the checkstyle error in grabl correctness test
    We fixed the issue in the correctness test in Grabl.

  • Refactor exception handling
    We improved the way we are handling exceptions. Additionally, we also refactored some of the related code.

  • Fixed Referable Class Typo

    • Change name of class from "Referrable" to "Referable"
  • Update automation.yml to include release dependencies
    We fixed the dependency-analysis issue caused by an incorrect automation.yml.

  • Bump year in license headers to 2021
    License headers are currently out of date (2020) for a while. This PR replaces 2020 with 2021 across all the files.

  • Update grabl automation yaml syntax
    Recently we added the support for background monitor script. Therefore we change the foreground job script from script to command.

Please refer to full release notes of 2.0.0-alpha to see the changes in 2.0.0.

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.