A Python client for Grakn.
Requires Python 3.6 and Grakn 1.0.
To install the Grakn client, simply run:
$ pip install grakn
You will also need access to a Grakn database. Head here to get started with Grakn.
Begin by importing the client:
>>> import grakn
Now you can connect to a knowledge base:
>>> client = grakn.Client(uri='localhost:48555', keyspace='mykb')
You can write to the knowledge base:
>>> client.execute('define person sub entity;')
{}
>>> client.execute('define name sub attribute, datatype string;')
{}
>>> client.execute('define person has name;')
{}
>>> client.execute('insert $bob isa person, has name "Bob";')
[{'bob': {'id': ...}}]
>>>
Or read from it:
>>> tx.execute('match $bob isa person, has name $name; get $name;')
[{'name': {'value': 'Bob', 'id': ...}}]
...
>>>