Skip to content

sheikheddy/grakn-python

 
 

Repository files navigation

Grakn Python Client

A Python client for Grakn.

Requires Python 3.6 and Grakn 1.0.

Installation

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.

Quickstart

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': ...}}]
...
>>>

About

Grakn Python Driver

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.8%
  • Makefile 1.2%