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

时间:2016-10-18 10:15:13

标签: scala graph-databases gremlin tinkerpop gremlin-server

我的顶点有多个边有相同的标签。边缘具有 age1 age2 时间等属性。

示例:

A - > B => age1 = 10, age2 = 10且时间 = t1

A - > B => age1 = 20, age2 = 30且时间 = t1

A - > B => age1 = 30, age2 = 50且时间 = t1

我需要用特定时间的边缘形成两个列表[List []]

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

1 number of rows in section 1
1 number of rows in section 0
1 number of rows in section 1
1 number of rows in section 0
1 number of rows in section 1
1 number of rows in section 0
1  VC workouts array count
Method .valueChanged activated
1 anArray before appending
2.0 stepper value before appending
Optional("2") circuitNumber
2 after appending
1 number of rows in section 1
1 number of rows in section 0
2 new workout.count
2 workouts.count
Method .valueChanged completed
2  VC workouts array count
Method .valueChanged activated
2 anArray before appending
3.0 stepper value before appending
Optional("3") circuitNumber
3 after appending
2 number of rows in section 1
1 number of rows in section 0
3 new workout.count
3 workouts.count
Method .valueChanged completed
3  VC workouts array count
Method .valueChanged activated
3 anArray before appending
4.0 stepper value before appending
Optional("4") circuitNumber
4 after appending
3 number of rows in section 1
1 number of rows in section 0
4 new workout.count
4 workouts.count
Method .valueChanged completed
4  VC workouts array count
Method .valueChanged activated
4 anArray before appending
5.0 stepper value before appending
Optional("5") circuitNumber
5 after appending
4 number of rows in section 1
1 number of rows in section 0
5 new workout.count
5 workouts.count
Method .valueChanged completed
5  VC workouts array count

它给出了一些编译错误。 我在查询中做错了什么

编译错误:

  

找不到参数p的隐含值:   shapeless.ops.hlist.Prepend [shapeless.HNil,不成形。:: [A,shapeless.HNil]]         。凡(_值("时间")为(P.gt(结束时间)))的值。(" AGE-1&#34)。如(" X" )

1 个答案:

答案 0 :(得分:0)

下面解决了这个问题

Scala gremlin:

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

Gremlin控制台:

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