0

我刚刚尝试从 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,并设置了类路径:

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

.

4

1 回答 1

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 对您隐藏了这些东西)。

于 2014-04-16T19:09:41.480 回答