将数据插入grakn模式



我已经创建了下面的grakn模式

define  
contract sub relation,     
relates manufacturer,     
relates product;  
drug sub entity,    
plays product,    
has product_name,    
has code;  
company sub entity,    
plays manufacturer,    
has manufacturer_name;
  
product_name sub attribute,  
datatype string;  
manufacturer_name sub attribute,  
datatype string;  
code sub attribute,  
datatype string;

我有3 csv(药品、公司和合同(

  1. 药物具有product_name(唯一(和代码
  2. 公司有制造商名称(唯一(
  3. 合同具有product_name和manufacturer_name(两者结合在一起是唯一的(

我使用的是grakn提供的相同的migrate.py[修改表的名称]。在摄取过程中,会弹出以下错误。

&lt_终止于的RPC的集合:status=状态代码.INVALID_ARGUMENTdetails="GraqlSemanticException名称没有'isa'、'sub'或'id'。请检查服务器日志中的堆栈跟踪。"debug_error_string="{"created":"@11588172437.178000000","description":"从对等ipv4:127.0.1:48555收到错误","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"GraqlSemanticException名称没有"isa"、"sub"或"id"。请检查服务器日志中的堆栈跟踪。","grpc_status":3}">

在grakn提供的phone_calls示例中,我看到ID正在生成(它是自动生成的吗?(我需要在字段(公司、合同和药品(中插入数据。如果需要,我可以分享我写的migrate.py。

请检查migrate.py和csv文件中使用的名称。两者应该相同,以便将数据插入grakn数据库。示例:如果您的查询是:
'insert $company isa company, has name "' + company["name"] + '";'

因此,在csv文件中,标题应该是"name"。希望这能有所帮助。

最新更新