No viable alternative at input 'type' with Grakn

531 Views Asked by At

In my Grakn schema, I am inserting this:

device sub entity,
    has type, 
    plays active-device;

However, when I try to insert this, I get this error:

graql.lang.exception.GraqlException: syntax error at line 72: 
    has type, 
     ^
no viable alternative at input 'type'
syntax error at line 72: 
    has type, 
     ^
mismatched input 'type' expecting {'match', 'define', 'undefine', 'insert', 'compute'}
    at graql.lang.exception.GraqlException.create(GraqlException.java:54)
    at graql.lang.parser.Parser.parseQuery(Parser.java:114)
    at graql.lang.parser.Parser.parseQueryListEOF(Parser.java:127)
    at graql.lang.Graql.parseList(Graql.java:64)
    at grakn.console.ConsoleSession.executeQuery(ConsoleSession.java:206)
    at grakn.console.ConsoleSession.load(ConsoleSession.java:132)
    at grakn.console.GraknConsole.run(GraknConsole.java:103)
    at grakn.console.GraknConsole.main(GraknConsole.java:139)

I don't think I have any syntax errors, why is this throwing an error?

1

There are 1 best solutions below

0
On

type is a reserved keyword in Grakn. When person is defined, and you call match $x type person; get;, a single result is returned: the concept type with label person.

Try naming your attribute device-type instead.