用Gremlin加载Titan图 [英] Load Titan graph with Gremlin

查看:3169
本文介绍了用Gremlin加载Titan图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用TitanDB创建新的。
Im使用它与cassandra& Java:

Im toataly new with TitanDB. Im using it with cassandra & Java:

配置文件:

storage.backend=cassandra
storage.hostname=@CASSANDRA_CLUSTER_INNER_ADDRESS@

Java代码:

TitanGraph tg = TitanFactory.open(/*the configuration above*/);
if (tg.isOpen()) {
    TitanManagement tm = tg.getManagementSystem();
    PropertyKey key = tm.getPropertyKey(name);
    /* The rest of the nice working code */
}

Java代码工作正常,我可以查询图,做CRUD操作等...

The Java code works fine, I can query the graph, do CRUD operations etc...

现在,我想在不使用JAVA的情况下查询图。
首先,我尝试使用 cqlsh ,我看到了:

Now, I want to query the graph without using JAVA. At first I tried using cqlsh there I saw this:

Keyspace titan
--------------
edgestore        graphindex        system_properties        systemlog  txlog
edgestore_lock_  graphindex_lock_  system_properties_lock_  titan_ids

后,我明白了,我需要使用工具像 gremlin 正确地查询TitanDB 。
但是当我通过gremlin连接TitanDB时,我收到这个消息:

after digging in it I understood that I need to use tool like gremlin to query the TitanDB properly. But when I'm tring to connect the TitanDB via gremlin I get this message:

    gremlin> TitanFactory.open("cassandra.local")
No such property: TitanFactory for class: groovysh_evaluate
Display stack trace? [yN] y
groovy.lang.MissingPropertyException: No such property: TitanFactory for class: groovysh_evaluate
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
        at groovysh_evaluate.run(groovysh_evaluate:51)
        at groovysh_evaluate$run.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
        at groovysh_evaluate$run.call(Unknown Source)
        at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:67)
        at org.codehaus.groovy.tools.shell.Interpreter$evaluate.call(Unknown Source)
        at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:152)
        at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:114)
        at org.codehaus.groovy.tools.shell.Shell$leftShift$0.call(Unknown Source)
        at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:88)
        at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1079)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:148)
        at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:100)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137)
        at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:57)
        at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1079)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:148)
        at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:66)
        at com.tinkerpop.gremlin.groovy.console.Console.<init>(Console.java:60)
        at com.tinkerpop.gremlin.groovy.console.Console.main(Console.java:102)

我的问题是:
我如何让Gremlin知道TitanFactory - 最后我如何使用gremlin在我现有的TitanDB v。0.5.4?

My question is: How can I get Gremlin to know TitanFactory - and finally how can I work with gremlin on my existing TitanDB v. 0.5.4?

谢谢。 b $ b

推荐答案

如果你从TinkerPop网站下载了Gremlin 2.x,我会看到你的错误,因为它没有Titan库类路径。

If you downloaded Gremlin 2.x from the TinkerPop site, I would expect to see the error you had because it does not have the Titan libraries on the classpath.

您应该从thinkaurelius下载Titan 0.5.4下载并按照Gremlin Shell文档。

You should get the Titan 0.5.4 download from thinkaurelius and follow along with the Gremlin Shell documentation.

http://s3.thinkaurelius.com/docs/titan/0.5.4/getting-started.html#_downloading_titan_and_running_the_gremlin_shell

这篇关于用Gremlin加载Titan图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆