Discussion Forum

Syntax error when running my demo

hello every one, I hope you’re doing well !
So this’s my first time creating a database using grakn and i had some errors, I hope i can resolve it with you.


person sub entity
key ide
has city
has name
has gender
has email
has phonenumber;

customer sub person
has job
plays is_coordinated
plays is_crediting
plays is_opening
plays is_withdawing
plays is_consulting
plays is_transfering
plays is_creating
plays is_closing
plays is_activating
plays is_desactivating;

director sub person
plays is_managing
has task;

employee sub person
has task
plays is_managed
plays is_coordinating
plays is_searching;

managing sub relation
has timetable
relates is_manging
relates is_managed;

coordination sub relation
has timetable
relates is_coordinating
relates is_coordinated;

branch sub entity
has name
has address
has startingdate
plays provider;

account sub entity
has acc_num
has type
has description
has process
has balance
has opened-at
plays is_opened
plays is_closed;

accounting sub relation
has timetable
relates is_opening
relates is_opened
relates is_consulting
relates is_consulted
relates is_closing
relates is_closed
relates provider;

loan sub entity
has type
has description
plays is_credited
plays is_withdrawed;

loaning sub relation
relates provider
relates is_crediting
relates is_credited
relates is_withdrawing
relates is_withdrawed
has timetable
has process;

moneytransaction sub relation
relates is_transfering
relates is_searching
key id_tran
has process
has ammount;

card sub entity
has type
has card_num
has expiration_date
has secret_code
plays is_created
plays is_activated
plays is_desactivated;

havingcard sub relation
has timetable
relates provider
relates is_created
relates is_activated
relates is_desactivated
relates is_creating
relates is_closing
relates is_activating
relates is_desactivating;

name sub attribute datatype string;
opened_at sub attribute datatype date;
age sub attribute datatype long;
balance sub attribute datatype string;
process sub attribute datatype string;
address sub attribute datatype string;
type sub attribute datatype string;
gender sub attribute datatype string;
phonenumber sub attribute datatype long;
email sub attribute datatype string;
card_num sub attribute datatype long;
expiration_date sub attribute datatype date;
secret_code sub attribute datatype long;
acc_num sub attribute datatype long;
ammount sub attribute datatype string;
description sub attribute datatype string;
startingdate sub attribute datatype date;
task sub attribute datatype string;
timetable sub attribute datatype string;
id_tran sub attribute datatype string;
job sub attribute datatype string;

Hi there - welcome!

Have you gone through the docs and examples?

First of all you appear to be using 1.x syntax and a VERY old server, which we aren’t supporting anymore. However, migrating to 2.x syntax will not be a big leap. The docs have some schema examples that will show for example that you need commas between each constraint (eg between card sub entity, has type, has card_num...; )
You’ll also see that we have new syntax for has which has become owns in the schema, plus making an owns an key uses an annotation-style @key, and finally that plays now uses relation-scoped roles: person ... , plays coordination:is_coordinated

You can see the summary of 1.x vs 2.x syntax here: Release Graql 2.0.0-alpha · vaticle/typeql · GitHub

Note that as of 2.1 the database is known as TypeDB and query language as TypeQL!

@Amen also just to make sure others don’t face a similar situation, how did you end up with version 1.4x instead of the latest release TypeDB 2.1.1 ?

Thank you so much!