简体   繁体   English

多边缘创建-Gremlin REST服务器

[英]Multiple edge creation - Gremlin REST server

I am using a simple Gremlin RESTful server and I am sending simple commands inside a POST request. 我使用的是简单的Gremlin RESTful服务器,并且在POST请求中发送了简单的命令。 For example, if I want to create edges (in my specific format), I have the following template: 例如,如果要创建边缘(以我的特定格式),则可以使用以下模板:

const nodeCommandFormat = "graph.addVertex('%s', '%s', 'evid', '%s');" ; ;

Sending a long string with chained commands like this works fine, all the edges are created. 使用这样的链接命令发送长字符串可以正常工作,所有边均已创建。 My question is: why it does not work with the edges creation? 我的问题是:为什么它不能与边缘创建一起使用? Until now, I tried with this two commands: 到目前为止,我尝试使用以下两个命令:

const newEdgeCommandFormat = "gV().has('evid', '%s').addE('next').to(gV().has('evid', '%s')).property('count', 1);" ; ;

or 要么

x = gV().has('evid', ...).next(); y = gV().has('evid', ...).next(); x.addEdge('next', y, 'count', 1) x = gV().has('evid', ...).next(); y = gV().has('evid', ...).next(); x.addEdge('next', y, 'count', 1) ; x = gV().has('evid', ...).next(); y = gV().has('evid', ...).next(); x.addEdge('next', y, 'count', 1) ;

However, if I concatenate 100 commands like this, only the edge corresponding to the last command is created. 但是,如果我这样连接100个命令,则只会创建对应于最后一个命令的边。 Why is that? 这是为什么? On the other hand, I also receive errors like this: 另一方面,我也收到如下错误:

  • Using first type of edge creatio n: [WARN] HttpGremlinEndpointHandler - Invalid request - responding with 500 Internal Server Error and The provided traverser does not map to a value: v[3091]->[TinkerGraphStep(vertex,[evid.eq(6ba0b28797dd79a2ee198d8ff280c4ff)])] 使用第一种边缘创建方法 :[WARN] HttpGremlinEndpointHandler-无效请求-响应500内部服务器错误,并且提供的遍历程序未映射到值:v [3091]-> [TinkerGraphStep(vertex,[evid.eq(6ba0b28797dd79a2ee198d8ff280c4ff )])]
  • Using the second type of edge creation : java.util.NoSuchElementException at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:204) 使用边缘创建的第二种类型 :org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:204)处的java.util.NoSuchElementException

How do I achive dynamic edge creation using Gremlin REST server? 如何使用Gremlin REST服务器实现动态边缘创建?

PS All my nodes have "evid" property (event-id) which is the md5 value of an object. PS我所有的节点都有“ evid”属性(event-id),它是对象的md5值。 I use this as an identifier for my nodes. 我将其用作节点的标识符。

Thank you! 谢谢!

.iterate() your traversals. .iterate()您的遍历。 This is highlighted in the Getting Started tutorial right at the end of the "The First 5 Minutes" section. 在“ 开始 5分钟”部分末尾的“ 入门指南”中突出显示了此内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM