forked from typedb/typedb-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for 1.8:
delete
syntax, remove via
, query options, syntax …
…renaming (typedb#296) ## What is the goal of this PR? Documentation of: * new delete syntax and features, such as deleting attribute ownerships (removing `via`), and removing role players from relations. * New syntax: introduce the `value` keyword instead of `datatype`, and `datetime` instead of `date`. * Query Options * Updating dependency tables for clients * Instructions on updating relations * Use new `.get()` syntax on query execute ## What are the changes implemented in this PR? * Update docs delete documentation * Add section on removing relation players * Update CI image to use Ubuntu 16 and remove RBE installation (for now) * Introduce Query Options * Move dependency tables to bottom of client pages
- Loading branch information
1 parent
208a5eb
commit a82396a
Showing
33 changed files
with
595 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,27 +6,10 @@ Summary: API Reference of Grakn Client Java. | |
templatePath: 03-client-api/references/ | ||
--- | ||
|
||
## Dependencies | ||
## Installation | ||
|
||
| Client Java | Grakn Core | Grakn KGMS | | ||
| :---------: | :-------------:| :------------: | | ||
| 1.7.2 | 1.7.1 | N/A | | ||
| 1.6.2 | 1.6.2 | 1.6.2 | | ||
| 1.6.1 | 1.6.0, 1.6.1 | N/A | | ||
| 1.5.5 | 1.5.8, 1.5.9 | 1.5.8 | | ||
| 1.5.4 | 1.5.8, 1.5.9 | 1.5.8 | | ||
| 1.5.3 | 1.5.2 to 1.5.7 | 1.5.2 to 1.5.7 | | ||
| 1.5.2 | 1.5.2, 1.5.3 | 1.5.2 to 1.5.4 | | ||
| 1.5.0 | 1.5.0 | N/A | | ||
| 1.4.3 | 1.4.3 | 1.4.3 | | ||
| 1.4.2 | 1.4.2 | 1.2.0 | | ||
| 1.4.1 | 1.4.0 | 1.2.0 | | ||
| 1.4.0 | 1.4.0 | 1.2.0 | | ||
| 1.3.0 | 1.3.0 | 1.2.0 | | ||
|
||
<div class="tabs dark"> | ||
#### To use this client, you need a compatible Grakn Server running. Visit our [Compatibility Table](#dependencies) | ||
|
||
[tab:Grakn Core] | ||
```xml | ||
<repositories> | ||
<repository> | ||
|
@@ -35,39 +18,14 @@ templatePath: 03-client-api/references/ | |
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.graql</groupId> | ||
<artifactId>graql-lang</artifactId> | ||
<version>1.0.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grakn.client</groupId> | ||
<artifactId>grakn-client</artifactId> | ||
<version>1.6.2</version> | ||
<version>{version}</version> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
[tab:end] | ||
|
||
[tab:Grakn KGMS] | ||
```xml | ||
<repositories> | ||
<repository> | ||
<id>mavencentral</id> | ||
<url>https://oss.sonatype.org/content/repositories/releases</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>ai.grakn.kgms</groupId> | ||
<artifactId>client</artifactId> | ||
<version>1.6.2</version> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
[tab:end] | ||
|
||
</div> | ||
|
||
## Quickstart | ||
First make sure, the [Grakn Server](/docs/running-grakn/install-and-run#start-the-grakn-server) is running. | ||
|
@@ -158,15 +116,15 @@ public class GraknQuickstartC { | |
// Insert a person using a WRITE transaction | ||
GraknClient.Transaction writeTransaction = session.transaction().write(); | ||
GraqlInsert insertQuery = Graql.insert(var("x").isa("person").has("email", "[email protected]")); | ||
List<ConceptMap> insertedId = writeTransaction.execute(insertQuery); | ||
List<ConceptMap> insertedId = writeTransaction.execute(insertQuery).get(); | ||
System.out.println("Inserted a person with ID: " + insertedId.get(0).get("x").id()); | ||
// to persist changes, a write transaction must always be committed (closed) | ||
writeTransaction.commit(); | ||
|
||
// Read the person using a READ only transaction | ||
GraknClient.Transaction readTransaction = session.transaction().read(); | ||
GraqlGet getQuery = Graql.match(var("p").isa("person")).get().limit(10); | ||
Stream<ConceptMap> answers = readTransaction.stream(getQuery); | ||
Stream<ConceptMap> answers = readTransaction.stream(getQuery).get(); | ||
answers.forEach(answer -> System.out.println(answer.get("p").id())); | ||
|
||
// transactions, sessions and clients must always be closed | ||
|
@@ -204,6 +162,31 @@ To view examples of running various Graql queries using the Grakn Client Java, h | |
|
||
{% include api/generic.html data=site.data.03_client_api.references.transaction language="java" %} | ||
|
||
{% include api/generic.html data=site.data.03_client_api.references.options language="java" %} | ||
|
||
{% include api/generic.html data=site.data.03_client_api.references.graql language="java" %} | ||
|
||
{% include api/answers.html data=site.data.03_client_api.references.answer language="java" %} | ||
|
||
|
||
|
||
## Dependencies | ||
|
||
| Client Java | Grakn Core | Grakn KGMS | | ||
| :---------: | :-------------:| :------------: | | ||
| 1.8.1 | 1.8.0 | N/A | | ||
| 1.8.0 | 1.8.0 | N/A | | ||
| 1.7.3 | 1.7.1, 1.7.2 | N/A | | ||
| 1.7.2 | 1.7.1, 1.7.2 | N/A | | ||
| 1.6.2 | 1.6.2 | 1.6.2 | | ||
| 1.6.1 | 1.6.0, 1.6.1 | N/A | | ||
| 1.5.5 | 1.5.8, 1.5.9 | 1.5.8 | | ||
| 1.5.4 | 1.5.8, 1.5.9 | 1.5.8 | | ||
| 1.5.3 | 1.5.2 to 1.5.7 | 1.5.2 to 1.5.7 | | ||
| 1.5.2 | 1.5.2, 1.5.3 | 1.5.2 to 1.5.4 | | ||
| 1.5.0 | 1.5.0 | N/A | | ||
| 1.4.3 | 1.4.3 | 1.4.3 | | ||
| 1.4.2 | 1.4.2 | 1.2.0 | | ||
| 1.4.1 | 1.4.0 | 1.2.0 | | ||
| 1.4.0 | 1.4.0 | 1.2.0 | | ||
| 1.3.0 | 1.3.0 | 1.2.0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,11 @@ keywords: grakn, client, python | |
longTailKeywords: grakn python client, grakn client python, client python, python client | ||
Summary: API Reference of Grakn Client Python. | ||
--- | ||
## Installation | ||
|
||
## Dependencies | ||
#### To use this client, you need a compatible Grakn Server running. Visit our [Compatibility Table](#dependencies) | ||
|
||
| Client Python | Grakn Core | Grakn KGMS | Python | | ||
| :------------: | :-------------------------: | :----------: | :----: | | ||
| 1.7.0 | 1.7.1 | N/A | >= 2.7 | | ||
| 1.6.0 to 1.6.1 | 1.6.0 to 1.6.2 | 1.6.2 | >= 2.7 | | ||
| 1.5.4 | 1.5.8, 1.5.9 | 1.5.8 | >= 2.7 | | ||
| 1.5.3 | 1.5.2 to 1.5.7 | 1.5.2 to 1.5.7 | >= 2.7 | | ||
| 1.5.2 | 1.5.2, 1.5.3 | 1.5.2 | >= 2.7 | | ||
| 1.5.1 | 1.5.0 | N/A | >= 2.7 | | ||
| 1.4.2 | 1.3.0 to 1.4.3 | 1.2.0, 1.4.3 | >= 3.6 | | ||
| 1.3.0 to 1.3.2 | 1.3.0 | 1.4.3 | >= 3.6 | | ||
|
||
## Installation | ||
``` | ||
pip install grakn-client | ||
``` | ||
|
@@ -90,23 +80,23 @@ with GraknClient(uri="localhost:48555") as client: | |
with client.session(keyspace="social_network") as session: | ||
## Insert a Person using a WRITE transaction | ||
with session.transaction().write() as write_transaction: | ||
insert_iterator = write_transaction.query('insert $x isa person, has email "[email protected]";') | ||
insert_iterator = write_transaction.query('insert $x isa person, has email "[email protected]";').get() | ||
concepts = [ans.get("x") for ans in insert_iterator] | ||
print("Inserted a person with ID: {0}".format(concepts[0].id)) | ||
## to persist changes, write transaction must always be committed (closed) | ||
write_transaction.commit() | ||
|
||
## Read the person using a READ only transaction | ||
with session.transaction().read() as read_transaction: | ||
answer_iterator = read_transaction.query("match $x isa person; get; limit 10;") | ||
answer_iterator = read_transaction.query("match $x isa person; get; limit 10;").get() | ||
|
||
for answer in answer_iterator: | ||
person = answer.map().get("x") | ||
print("Retrieved person with id " + person.id) | ||
|
||
## Or query and consume the iterator immediately collecting all the results | ||
with session.transaction().read() as read_transaction: | ||
answer_iterator = read_transaction.query("match $x isa person; get; limit 10;") | ||
answer_iterator = read_transaction.query("match $x isa person; get; limit 10;").get() | ||
persons = [ans.get("x") for ans in answer_iterator] | ||
for person in persons: | ||
print("Retrieved person with id "+ person.id) | ||
|
@@ -143,7 +133,25 @@ To view examples of running various Graql queries using the Grakn Client Python, | |
|
||
{% include api/generic.html data=site.data.03_client_api.references.transaction language="python" %} | ||
|
||
{% include api/generic.html data=site.data.03_client_api.references.options language="python" %} | ||
|
||
{% include api/generic.html data=site.data.03_client_api.references.iterator language="python" %} | ||
|
||
{% include api/answers.html data=site.data.03_client_api.references.answer language="python" %} | ||
|
||
|
||
## Dependencies | ||
|
||
| Client Python | Grakn Core | Grakn KGMS | Python | | ||
| :------------: | :-------------------------: | :----------: | :----: | | ||
| 1.8.0 | 1.8.0 | N/A | >= 3.5 | | ||
| 1.7.2 | 1.7.1, 1.7.2 | N/A | >= 2.7 | | ||
| 1.7.1 | 1.7.1 | N/A | >= 2.7 | | ||
| 1.7.0 | 1.7.1 | N/A | >= 2.7 | | ||
| 1.6.0 to 1.6.1 | 1.6.0 to 1.6.2 | 1.6.2 | >= 2.7 | | ||
| 1.5.4 | 1.5.8, 1.5.9 | 1.5.8 | >= 2.7 | | ||
| 1.5.3 | 1.5.2 to 1.5.7 | 1.5.2 to 1.5.7 | >= 2.7 | | ||
| 1.5.2 | 1.5.2, 1.5.3 | 1.5.2 | >= 2.7 | | ||
| 1.5.1 | 1.5.0 | N/A | >= 2.7 | | ||
| 1.4.2 | 1.3.0 to 1.4.3 | 1.2.0, 1.4.3 | >= 3.6 | | ||
| 1.3.0 to 1.3.2 | 1.3.0 | 1.4.3 | >= 3.6 | |
Oops, something went wrong.