首页 > 解决方案 > 无法在 Grakn 中创建 [id] 属性

问题描述

我正在尝试id像这样定义一个新属性:

define 
id sub attribute, datatype double; 

但是,当我尝试这个时,我得到了这个语法错误:

define id sub attribute, datatype double;
       ^
no viable alternative at input 'id'
syntax error at line 1: 
define id sub attribute, datatype double;
       ^
mismatched input 'id' expecting {'match', 'define', 'undefine', 'insert', 'compute'}
All uncommitted data is cleared

不能创建一个名为的属性id吗?

标签: vaticle-typedbvaticle-typeql

解决方案


id is a reserved keyword in Graql.

Therefore, you cannot have a user-defined type called id, I suggest using identifier instead.

id is used for matching concepts in Grakn by their Grakn-generated id, like so:

match $x id V12345; get;

although the recommended approach is instead to match using a user-defined key.


推荐阅读