标签: tinkerpop

在 Docker 镜像中设置 TinkerPop 配置

我正在使用 TinkerPop 的本地实现和 docker imagetinkerpop/gremlin-server:3.4.1 来与 nodeJs 中的图形数据库进行本地交互。

我需要将 IDManager 设置为 ANY,以便它可以接受自定义顶点 ID 的字符串值(目前它仅适用于数字类型)。

我知道我需要设置 TinkerGraph gremlin.tinkergraph.vertexIdManager 的配置,但我不确定如何在我的 docker-compose 文件中使用正确的配置对其进行初始化。 http://tinkerpop.apache.org/docs/current/reference/#_configuration_4

有人知道怎么做吗?

谢谢

gremlin tinkerpop docker gremlin-server

1
推荐指数
1
解决办法
1452
查看次数

Gremlin再次使用管道输出作为输入

我有一个看起来像的图表

a --father_of--> 1 --wife_of--> b --father_of-->2 --wife_of--> c --father_of--> 3--wife_of--> d --father_of --> 5--wife_of-->e
Run Code Online (Sandbox Code Playgroud)

我想写一个查询,它给了我从树开始的所有父亲

我可以写一个级别

g.V('name','a').out(father_of).out(wife_of) 这给了b

如何编写一个递归查询,将b作为管道的输入,以便查询给出节点b,c,d和e.

neo4j graph-databases gremlin titan tinkerpop

0
推荐指数
1
解决办法
128
查看次数

以下GRAPHSON格式无法正常工作

我正在尝试使用follwing命令将以下graphSon格式转换为图形实例

    graph.io(IoCore.graphson()).reader().create().readGraph(stream, graph);
Run Code Online (Sandbox Code Playgroud)

但是在运行时将GRaphSON转换为下面给出的图形实例

{"id":0,
"label":"buyer",
"outE":
    {"email_is":
        [{"id":0,"inV":1,
            "properties":{"weight":1}
            }
        ]}
,"properties":
    {"buyer":
        [{
            "id":0,"value":"buyer0"
        }]
    ,"age":
        [{
            "id":1,"value":10}]
        }}              
{"id":1,
"label":"email",
"inE":
    { "email_is":
        [{"id":1,"outV":0,
        "properties":{"weight":1}}
        ]}

,"properties":
    {"email":
    [{"id":2,
    "value":"email0"
    }]
    }}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

java.lang.reflect.InvocationTargetException
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.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)Caused by: java.lang.IllegalArgumentException: Invalid vertex provided: null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.addEdge(AbstractVertex.java:149)
at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.addEdge(AbstractVertex.java:23)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.lambda$null$57(GraphSONReader.java:114)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.lambda$readGraph$58(GraphSONReader.java:108)
at java.util.HashMap$EntrySet.forEach(HashMap.java:1035)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.readGraph(GraphSONReader.java:108)
at pluradj.titan.tinkerpop3.example.JavaExample2.main(JavaExample2.java:50)
... 6 more
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我一个更简单的方法来制作GRAPHSON文件,因为使用StringWriter和JSONWRiter类是一项非常繁琐的任务.

gremlin titan tinkerpop tinkerpop3

0
推荐指数
1
解决办法
662
查看次数

尝试在titan graph db中使用索引时出错

使用以下命令使用索引以获得更好的性能来查询titan db中的节点.

TitanManagement mgmt = graph.openManagement();
PropertyKey buyer = mgmt.makePropertyKey("buyer").dataType(String.class).cardinality(Cardinality.SINGLE).make();
TitanGraphIndex buyeri = mgmt.buildIndex("buyer", Vertex.class).addKey(buyer).buildCompositeIndex();
mgmt.setConsistency(buyeri, ConsistencyModifier.LOCK);
g.V().has("buyer","buyer", "buyer10").out("order_is").values("order").fill(list);     
Run Code Online (Sandbox Code Playgroud)

使用titan 1.0.0,gremlin查询语言,在运行此查询时会抛出错误:

java.lang.reflect.InvocationTargetException
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.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)Caused by: com.thinkaurelius.titan.core.SchemaViolationException: Adding this property for key [~T$SchemaName] and value [rtbuyer] violates a uniqueness constraint [SystemIndex#~T$SchemaName]
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:780)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:706)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.makeSchemaVertex(StandardTitanTx.java:836)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.makePropertyKey(StandardTitanTx.java:856)
at com.thinkaurelius.titan.graphdb.types.StandardPropertyKeyMaker.make(StandardPropertyKeyMaker.java:86)
at pluradj.titan.tinkerpop3.example.JavaExample2.main(JavaExample2.java:56)
Run Code Online (Sandbox Code Playgroud)

更新如下所述@jason Plurad回答

我用过

 PropertyKey buyer = (!mgmt.containsPropertyKey("buyer")) ?
        mgmt.makePropertyKey("buyer").dataType(String.class).cardinality(Cardinality.SINGLE).make() :
        mgmt.getPropertyKey("buyer");
    TitanGraphIndex buyeri = mgmt.getGraphIndex("buyeri");
    if (buyeri …
Run Code Online (Sandbox Code Playgroud)

gremlin titan tinkerpop rexster

0
推荐指数
1
解决办法
1631
查看次数

如何在 Gremlin 服务器上使用 ferma OGM?

你能告诉我 - 是否可以在 Gremlin 服务器上使用 OGM FERMA 框架(TinkerPop 3.2.6,后端有 JanusGraphDB)?

现在我使用 gremlin 客户端以这种方式向 G-server 发送查询:

GryoMapper mapper = GryoMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create();
MessageSerializer serializer = new GryoMessageSerializerV1d0(GryoMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()));

/* Create gremlin cluster... */
Cluster cluster = Cluster.build("123.22.22.111").port(8182).serializer(serializer).create();
Client client = cluster.connect();
ResultSet res = client.submit("g.V().label()");
Run Code Online (Sandbox Code Playgroud)

...因此我不知道如何直接获得图形实例(如在 ferma 教程中):

FramedGraph fg = new DelegatingFramedGraph(graph, true, types);
Run Code Online (Sandbox Code Playgroud)

... 使用遍历来获取 ferma 注释类的实例。

tinkerpop gremlin-server janusgraph

0
推荐指数
1
解决办法
545
查看次数

简单的外连接,如 gremlin 查询不返回任何结果

我写了下面的简单查询来遍历 Person 到 Country,但它没有返回任何结果。

g.V().hasLabel("Person").as("p").out("from").hasLabel("Country").as("c").select("p", "c")
Run Code Online (Sandbox Code Playgroud)

在实际数据中,只Person存在顶点,不存在Country顶点或from边。我预计至少会回来p- 基本上我想做一个左外连接。但是,如果我有Countryfrom数据,以及,查询返回结果

我也尝试了另一个查询match,但除非有实际数据,否则仍然没有结果:

g.V().hasLabel("Person").has("name","bob").match(__.as("p").out("from").hasLabel("Country").as("c")).select("p", "c")
Run Code Online (Sandbox Code Playgroud)

我正在对 Datastax Enterprise Graph 运行这些查询。

知道为什么它没有返回任何结果吗?

gremlin tinkerpop datastax-enterprise-graph

0
推荐指数
1
解决办法
1042
查看次数

Amazon Neptune 与 Tinkerpop 兼容吗?为什么以及如何?

我正在尝试学习一些关于图形语言和查询语言 Gremlin 的知识。这是来自文档:

Amazon Neptune 与 Apache TinkerPop3 和 Gremlin 3.4.1 兼容。这意味着您可以连接到 Neptune 数据库实例并使用 Gremlin 遍历语言来查询图形(请参阅 Apache TinkerPop3 文档中的图形)。

海王星和 tinkerpop 2 不是相互竞争的图形数据库吗?一个数据库与另一个数据库兼容意味着什么?

也很好奇……为什么 apache 会发布它的查询语言 Gremlin 以用于其他数据库?这背后的想法是什么?

编辑

哦,我明白了,tinkerpop 是某种与海王星兼容的图形框架......无论如何。

graph-databases gremlin tinkerpop tinkerpop3 amazon-neptune

-1
推荐指数
1
解决办法
162
查看次数