【问题标题】:Using Tinkerpop Frames, how do I get all of the incoming or outgoing edges of a Vertex regardless of their label?使用 Tinkerpop Frames,无论标签如何,我如何获取 Vertex 的所有传入或传出边缘?
【发布时间】:2012-05-29 20:24:25
【问题描述】:

Tinkerpop Frames wiki 说,可以为顶点提供下面的注释,以获取给定人“认识”的所有人。但是,无论连接他们的边缘是什么标签,我如何找到与给定人相关的所有人?这可能吗?

 @Adjacency(label="knows")
 public Iterable<Person> getKnowsPeople();

谢谢!

【问题讨论】:

    标签: neo4j gremlin


    【解决方案1】:

    你不能不修改底层框架。在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;
        }
    } 
    

    如果您需要您请求的功能,请修改此语句以返回所有顶点或使用某种约定(如标签值中的星号)来执行某些基于表达式的绑定。

    https://github.com/tinkerpop/frames/blob/master/src/main/java/com/tinkerpop/frames/annotations/AdjacencyAnnotationHandler.java

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-02
      • 2017-01-01
      • 1970-01-01
      • 2017-02-23
      • 2011-12-13
      • 1970-01-01
      • 1970-01-01
      • 2021-02-08
      相关资源
      最近更新 更多