Hugegraph中edgelabel的sortKey方法如何调用?
Expected behavior 期望表现
成功调用
Actual behavior 实际表现
失败
Steps to reproduce the problem 复现步骤
schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date","weight")..sortKey("date")ifNotExist().create();
Status of loaded data 数据状态
这个方法很重要,但是guide里面没有具体的介绍,非常希望把这个方法重视一下
Specifications of environment 环境信息
- hugegraph version: { v0.7.4}
- operating system: {ubuntu 18.04, 64 CPUs, 64G RAM}
- hugegraph backend: {RocksDB, cluster with 20 nodes, 3 x 1TB HDD disk each node}
同问
使用sortKey时必须显式地指明Frequency为multiTimes的,方法是加上.multiTimes(),在你这个例子里面就是schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date","weight").multiTimes().sortKey("date").ifNotExist().create();
然后就可以在两个点之间创建多条created边,比如:
marko.addEdge("knows", vadas, "date", "20160110", "weight", 0.5);
marko.addEdge("knows", vadas, "date", "20170110", "weight", 0.5);
marko.addEdge("knows", vadas, "date", "20180110", "weight", 0.5);
哇,感谢感谢~关于sortKey还有其他的方法么?我可以记录一下,积累到一定程度可以拿出来更新下项目的doc
但是这个方法可以用loader传输数据么?我的会报错: 不加multiTime时: Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy53.sortKey() is applicable for argument types: (java.lang.String) values: [date]
加上multiTime时: Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy53.mutiTimes() is applicable for argument types: () values: [] Possible solutions: multiTimes()
@mengquanrun 可以用loader传输数据的。不好意思,方法名是sortKeys("date"),打掉了一个字母。
schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date","weight").multiTimes().sortKeys("date").ifNotExist().create();
加上multiTime之后也是会出现错误: Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy53.sortKey() is applicable for argument types: (java.lang.String) values: [date] Possible solutions: sortKeys([Ljava.lang.String;), notify()
ok,成功,感谢,doc上应该写呐,这是一个很有用的方法~edgeid那里只有一句话就代过了~
我的用loader会报错, [main] [ERROR] com.baidu.hugegraph.loader.impl.importer.VertexSchema [] - The schema has already in database, and its frequency is different from your input. 同时显示导入了0条数据