Join Gremlin,在一个Id上连接多个顶点,并在Titan graph db中添加一条边

Join Gremlin,在一个Id上连接多个顶点,并在Titan graph db中添加一条边,join,graph,gremlin,titan,edges,Join,Graph,Gremlin,Titan,Edges,有这些顶点映射 **a**) ( County, StreetName, GroupName, Type, BaseRecId, Latitude, StreetSuffix, Longitude, StreetNumber, Zip, City ) **b**) ( SalesPrice, SalesRecId, BaseRecId, SalesDate ) 当属性properties=g.V('GroupName','PROPERTY')。next()=>V[148

有这些顶点映射

 **a**) ( County, StreetName, GroupName, Type, BaseRecId, Latitude,
          StreetSuffix, Longitude, StreetNumber, Zip, City )
 **b**) ( SalesPrice, SalesRecId, BaseRecId, SalesDate )

属性匹配时,我需要从顶点a到顶点b创建边(1到多个)。

首先选择组a的所有顶点,然后选择组b的匹配顶点,最后将它们链接在一起:

g.V().hasNot("BaseRecId", null).hasNot("GroupName", null).as("a").transform({
  g.V("BaseRecId", it.getProperty("BaseRecId")).hasNot("SalesRecId", null)
}).scatter().linkIn("label", "a")
此查询中的假设:

  • 组a中的每个顶点都有一个组名
  • 组b中的每个顶点都有一个SalesRecId
  • BaseRecId已编制索引(这是可选的,但会显著加快速度)

这应该适用于小图形。对于较大的图形,请使用Faunus。

rexster[groovy]>properties=g.V('GroupName','PROPERTY')。next()=>V[14860]rexster[groovy]>sales=g.V('GroupName',null)。next()=>V[24012]rexster[groovy]>g.addEdge(properties,sales,'selled')=>e[uIv-3RG-58][14860-selled->24012]rexster[groovy]>g.commit()。非常感谢!!!