我刚尝试在gremlin控制台上运行Frames上的简单演示:
TinkerGraph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraphFactory factory = new FramedGraphFactory(new GremlinGroovyModule());
添加import com.tinkerpop.frames.*;
后(是的,tinkerpop框架在我的类路径中)
但控制台无法识别FramedGraphFactory类。
事实上,如果我运行
gremlin> show classes
命令,它回复说没有加载任何内容。任何线索?
由于
PS详情:我在Ubuntu上,下载了gremlin-groovy-2.4.0。
我还下载了jar jar,并设置了classpath:
echo $CLASSPATH
/home/dev/frames-2.5.0.jar
然后启动gremlin并导入框架:
import com.tinkerpop.frames.*
终于
TinkerGraph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraphFactory factory = new FramedGraphFactory(new GremlinGroovyModule());
产生
groovysh_evaluate: 50: unable to resolve class FramedGraphFactory
@ line 50, column 30.
FramedGraphFactory factory = new FramedGraphFactory(new GremlinGroovyModule()); //(1) Factories should be reused for performance and memory conservation.
^
groovysh_evaluate: 50: unable to resolve class GremlinGroovyModule
@ line 50, column 53
答案 0 :(得分:1)
试试这个:
gremlin> Grape.grab([group:"com.tinkerpop",module:"frames",version:"2.4.0"])
==>null
gremlin> graph = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> import com.tinkerpop.frames.*
==>import com.tinkerpop.gremlin.*
==>import com.tinkerpop.gremlin.java.*
==>import com.tinkerpop.gremlin.pipes.filter.*
...
==>import groovy.grape.Grape
==>import com.tinkerpop.frames.*
gremlin> import com.tinkerpop.frames.modules.gremlingroovy.*
==>import com.tinkerpop.gremlin.*
==>import com.tinkerpop.gremlin.java.*
==>import com.tinkerpop.gremlin.pipes.filter.*
==>import com.tinkerpop.gremlin.pipes.sideeffect.*
...
gremlin> factory = new FramedGraphFactory(new GremlinGroovyModule());
==>com.tinkerpop.frames.FramedGraphFactory@645c1312
如果您已经复制了jar,则在开始时省略Grape
的使用,但如果您复制,请确保您拥有所有Frames依赖项而不仅仅是Frames jar本身(Grape隐藏了这些东西)