Its automated reasoning sounds great
You can also use automated reasoning inside Grakn (machine learning)
Its automated reasoning sounds great
You can also use automated reasoning inside Grakn (machine learning)
In Grakn, these algorithms are built-in as native functionalities of the language.
In Grakn, distributed analytics are built-in
code below instantiates a client, opens a session, and runs an insertion query
Start by instantiating a client and opening a session. Afterwards, you can begin to run queries
We will use the python client API to interact with Grakn.
After setting up Grakn keyspace, you can interact with it using Python client API
We just created a Grakn keyspace experiment and defined its schema.
It's good to have a single Grakn keyspace per application (outermost container for data in a Grakn knowledge graph, corresponding closely to a relational database)
Now that we have the schema ready, the next step is to load it into Grakn.
After defining schema, it needs to be loaded into Grakn:
1) Place schema.gql
in the container volume, such as db/schema.gql
.
2) Run:
docker exec -ti grakn bash -c '/grakn-core-all-linux/grakn console --keyspace experiment --file /grakn-core-all-linux/server/db/schema.gql'
3) Observe a similar result:
Loading: /grakn-core-all-linux/server/db/schema.gql
...
{}
Successful commit: schema.gql
An attribute can be abstract if you never assign it directly and use it only as a parent type. Entities can be abstract, too, if they are never instantiated.
Attributes and entities can be abstract
There's just one more step – defining the attribute types
Don't forget to define attribute types, such as:
name sub attribute,
datatype string;
address sub attribute,
datatype string;
timestamp sub attribute, abstract,
datatype date;
created sub timestamp;
last-modified sub timestamp;
last-accessed sub timestamp;
penalty-until sub timestamp;
url sub attribute,
datatype string;
...
Attributes can be assigned to anything, including relations.
We've ended up with three entities: user, badge and location. How to glue them together? Using relations.
Use of relations to glue different entities:
location-of-user sub relation,
relates located-user,
relates user-location;
achievements sub relation,
has score,
relates contributor,
relates award;
Some things are common to multiple users, like a location (e.g. Austin, TX, USA) or the types of badges they've been awarded (bronze, silver, gold). We'll model locations and badges as separate entities.
Modelling separate entities:
location sub entity,
key address,
plays user-location;
badge sub entity,
key color,
plays award;
Graql — Grakn's query language that allows you to model, query and reason over data.
Graql is part of Grakn
What can we have in a schema? There are three types of things
In schema we can have three types of things:
schema – a skeleton structure that represents the logical view of the entire knowledge graph
Before using JSON data in the database, we need to define its schema
To keep things nice and platform agnostic, let’s go with Docker.
You can run Grakn with Docker using 3 simple commands (check below this highlight)
Grakn is a knowledge base for intelligent systems. A quick look at their developer site and examples piqued my curiosity