简体   繁体   English

从边列表中选择多个边属性值并放入列表[List]

[英]select multiple edge property values from list of edges and put in list[List]

I am having vertices with multiple edges having same labels. 我有多个边具有相同标签的顶点。 Edges having properties like age1 , age2 and time in it. 边缘具有age1age2time等属性。

Example: 例:

A-->B => age1 = 10, age2 =10 and time = t1 A - > B => age1 = 10, age2 = 10, time = t1

A-->B => age1 = 20, age2 =30 and time = t1 A - > B => age1 = 20, age2 = 30, time = t1

A-->B => age1 = 30, age2 =50 and time = t1 A - > B => age1 = 30, age2 = 50, time = t1

I need to form two list[List[]] with the above the edges with specific time 我需要用特定时间的上边缘形成两个列表[List []]

eg : List[[10,10][20,30][30,50]] 例如: 列表[[10,10] [20,30] [30,50]]

graph.traversal.V().has(ID,"A").bothE("interference").
where(_.values("time").is(P.gt("sometime"))).values("age1").as("x").values("age2").as("y").select("x","y").toList()

It is giving some compilation error. 它给出了一些编译错误。 Am i doing something wrong in the query 我在查询中做错了什么

Compilation Error: 编译错误:

could not find implicit value for parameter p: shapeless.ops.hlist.Prepend[shapeless.HNil,shapeless.::[A,shapeless.HNil]] .where(_.values("time").is(P.gt(endtime))).values("age1").as("x") 找不到参数p的隐含值:shapeless.ops.hlist.Prepend [shapeless.HNil,shapeless。:: [A,shapeless.HNil]] .where(_。values(“time”)。is(P.gt (结束时间)))。值( “AGE-1”)。作为( “X”)

Below solves this problem 下面解决了这个问题

Scala gremlin: Scala gremlin:

 graph.traversal.V().has(ID,"A").bothE("interference").
    where(_.values("time").is(P.gt("sometime"))).valueMap("age1","age2").toList()

Gremlin console: Gremlin控制台:

graph.traversal().V().has('ID', 'a').bothE("interference").valueMap('age1','age2')
==>{age2=50, age1=10}
==>{age2=50, age1=30}
==>{age2=20, age1=60}

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

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