我正在做一个小型 POC 项目,我想在其中使用 Amazon 的 Neptune Graph 表示一个村庄的道路网络。
我打算在此图中将交叉路口用作顶点,将街道用作边。一个简单的表示是:
Intersection {
id: 1089238983,
name: 'Madrid & 99th'
labels: ['has_pedestrian_signals', 'four_way_intersection']
}
Street {
id: 9808787868,
name: 'Madrid St'
from_int_id: 1089238983,
to_int_id: 1089238973,
labels: ['has_hospital_on_street', 'is_snow_route', 'is_one_way_street']
}
事情是AWS's documentation声明边只能有 1 个标签。
我希望最终能够根据边的属性进行遍历。我曾尝试寻找将更多数据合并到 Tinkerpop 图表中的方法,但没有找到任何有用的方法。
如果有任何建议,我将不胜感激。
最佳答案
Gremlin 确实像支持顶点属性一样支持边属性。 http://tinkerpop.apache.org/docs/3.4.6/reference/#addedge-step
// define 'a' and 'b' vertices
g.addE('friendlyCollaborator').from('a').to('b').
property(id,23).property('project',select('c').values('name'))
唯一的标注是,与仅读取边缘标签相比,获取边缘属性是一个额外的跃点。
例如:
g.V(1).outE('knows') -> Gets the matching out edge in 2 hops.
g.V(1).outE().hasProperty('knows') -> An added hop to get to your edge.
关于amazon-web-services - 有没有办法在 Amazon Neptune Graph 的边缘存储更多信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61072354/