如何使用甚至进行以下查询:
gremlin> t = new Table()
gremlin> g.v(1).out('knows').as('x').out('created').as('y').table(t)
==>v[5]
==>v[3]
gremlin> t
==>[x:v[4], y:v[5]]
==>[x:v[4], y:v[3]]我找不到table :(
提前感谢
发布于 2014-06-02 18:04:54
虽然Daniel的答案似乎适用于Java,但它并不适用于Scala包装器。因此,我使用了select方法:
import scala.collection.JavaConversions._
import com.tinkerpop.gremlin.scala._
graph.V.has("type", "VTM").as("vtm")
.both("has").has("type", "VMP").as("vmp")
.both("has").has("type", "AMP").as("amp")
.both("has").has("type", "SUPPLIER").as("supplier")
.select.cast(classOf[Row[Vertex]]).toList foreach { row =>
println(row.getColumn("vtm"))
println(row.getColumn("vmp"))
println(row.getColumn("amp"))
println(row.getColumn("supplier"))
}不要忘记隐式转换的导入。
如果我做错了什么告诉我。
发布于 2014-05-30 14:44:33
这在Java中几乎是一样的。
Table t = new Table();
Vertex v1 = graph.getVertex(1);
new GremlinPipeline<Vertex, Vertex>(v1).out("knows").as("x").out("created").as("y").table(t).iterate();干杯,丹尼尔
https://stackoverflow.com/questions/23937053
复制相似问题