5 Matching Annotations
- Feb 2020
-
-
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 asdb/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
-
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;
...
-
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
-