如何使用by()步骤从相同结果的边和顶点获得两个不同的属性?

时间:2017-02-21 10:55:50

标签: titan gremlin tinkerpop

enter image description here如果一位教授在三个部门工作,他需要检索部门名称和经验,其中有哪些经验存在于边缘。我需要同时检索部门名称和经验?< / p>

如果我使用选择步骤,则给出结果

g.V().has('personId','1cdbdcf4-9223-37a9-ad6f-70875dbadc37')
.union(constant(true)
,identity().out('favourite')
.as('professor',"distance","experience")
.select('professor',"distance","experience")
.by(__.valueMap('professerId','Name','rating','imageUrl').fold())
.by(identity().out('PrimaryAddress')
.map({it.get().value('geoPoint').getPoint()
.distance(Geoshape.point(new BigDecimal(17.364426),new BigDecimal(78.38968)).getPoint())}))
.by(identity().outE('areaOfExpertise')
.choose(label).option('areaOfExpertise'
,identity()
.as('areaOfExpertise','subject')
.select('areaOfExpertise','subject')
.by(values('teachingSince').fold())
.by(inV().valueMap('SubjectName')))
.fold()))
.unfold()

如果我不使用选择步骤

g.V().has('personId','1cdbdcf4-9223-37a9-ad6f-70875dbadc37')
.union(constant(true)
,identity().out('favourite')
.as('professor',"distance","experience")
.select('Professor',"distance","experience")
.by(__.valueMap('professorId','Name','rating','imageUrl').fold())
.by(identity().out('PrimaryAddress')
.map({it.get().value('geoPoint').getPoint()
.distance(Geoshape.point(new BigDecimal(17.364426),new BigDecimal(78.38968)).getPoint())}))
.by(identity().outE('areaOfExpertise')
.as('areaOfExpertise','problem')
.select('areaOfExpertise','subject')
.by(values('teachingSince').fold())
.by(inV().valueMap('subjectName'))
.fold()))
.unfold()

它返回&#34; java.util.ArrayList无法强制转换为org.apache.tinkerpop.gremlin.structure.Element&#34;

0 个答案:

没有答案