【发布时间】:2012-05-29 20:24:25
【问题描述】:
Tinkerpop Frames wiki 说,可以为顶点提供下面的注释,以获取给定人“认识”的所有人。但是,无论连接他们的边缘是什么标签,我如何找到与给定人相关的所有人?这可能吗?
@Adjacency(label="knows")
public Iterable<Person> getKnowsPeople();
谢谢!
【问题讨论】:
Tinkerpop Frames wiki 说,可以为顶点提供下面的注释,以获取给定人“认识”的所有人。但是,无论连接他们的边缘是什么标签,我如何找到与给定人相关的所有人?这可能吗?
@Adjacency(label="knows")
public Iterable<Person> getKnowsPeople();
谢谢!
【问题讨论】:
你不能不修改底层框架。在AdjacencyAnnotationHandler.processVertex方法中,你会发现Frames只是调用了目标Blueprints Vertex的getVertices()方法:
if (ClassUtilities.isGetMethod(method)) {
final FramedVertexIterable r = new FramedVertexIterable(framedGraph,
vertex.getVertices(
adjacency.direction(), adjacency.label()),
ClassUtilities.getGenericClass(method));
if (ClassUtilities.returnsIterable(method)) {
return r;
} else {
return r.iterator().hasNext() ? r.iterator().next() : null;
}
}
如果您需要您请求的功能,请修改此语句以返回所有顶点或使用某种约定(如标签值中的星号)来执行某些基于表达式的绑定。
【讨论】: