没有这样的属性:类Script4的ToInputStream [英] No such property: ToInputStream for class: Script4
问题描述
我有一种情况想要将图形数据导入数据库。我正在使用Docker的cassandra(版本3)和elasticsearch(版本6.6.0)运行janusgraph(最新版本)。建议使用gryo格式。因此,我尝试了此命令
I have a situation where I want to import my graph data to database.I am having janusgraph(latest version) running with cassandra(version 3) and elasticsearch(version 6.6.0) using Docker.I have been suggested to use gryo format.So I have tried this command
graph.io(IoCore.gryo()).reader().create().readGraph(ToInputStream.from("my_graph.kryo"), graph);
但最终出现错误
No such property: ToInputStream for class: Script4
文档I紧随其后的是此处。请查看一下,并按照正确的步骤进行操作。
The documentation I am following is here.Please take a look and put me in a right procedure. Thanks in advance!
推荐答案
ToInputStream
不是Gremlin的函数,或者JanusGraph。我相信这只是IBM Compose的功能,因此除非您在该特定平台上运行JanusGraph,否则此命令将不起作用。
ToInputStream
is not a function of Gremlin or JanusGraph. I believe that it is only a function of IBM Compose so unless you are running JanusGraph on that specific platform, this command will not work.
使用TinkerPop 3.4的JanusGraph版本.x将支持 io()
步骤,这是加载gryo(以及graphson和graphml)文件的首选方式。
Versions of JanusGraph that utilize TinkerPop 3.4.x will support the io()
step and this is the preferred manner in which to load gryo (as well as graphson and graphml) files.
Graph graph = ... // setup JanusGraph instance
GraphTraversalSource g = traversal().withGraph(graph); // might use withRemote() here instead depending on how you are connecting I suppose
g.io("graph.kryo").read().iterate()
请注意,如果您是远程连接-似乎由于错误而向Docker实例发送了脚本-请确保该 graph.kryo Docker可以访问文件路径。这就是Compose的 ToInputStream
的优点,因为它允许您访问远程源。
Note that if you are connecting remotely - it seems you are sending scripts to the Docker instance given your error - then be sure that that "graph.kryo" file path is accessible to Docker. That's what's nice about ToInputStream
from Compose as it allows you to access remote sources.
这篇关于没有这样的属性:类Script4的ToInputStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!