【发布时间】:2015-03-28 11:40:58
【问题描述】:
您好,我有一个接口和一个相应的实现类,例如:
public interface IActor extends VertexFrame {
@Property(ActorProps.nodeClass)
public String getNodeClass();
@Property(ActorProps.nodeClass)
public void setNodeClass(String str);
@Property(ActorProps.id)
public String getId();
@Property(ActorProps.id)
public void setId(String id);
@Property(ActorProps.name)
public String getName();
@Property(ActorProps.name)
public void setText(String text);
@Property(ActorProps.uuid)
public String getUuid();
@Property(ActorProps.uuid)
public void setUuid(String uuid);
@Adjacency(label = RelClasses.CoActors, direction = Direction.OUT)
public Iterable<IActor> getCoactors();
}
我使用 OrientDB 看起来像这样。我对 Neo4j 也有类似的实现:
Graph graph = new OrientGraph("remote:localhost/actordb");
FramedGraph<Graph> manager = new FramedGraphFactory().create(graph);
IActor actor = manager.frame(((OrientGraph)graph).getVertexByKey("Actor.uuid",uuid), IActor.class);
上述方法可行,但问题是在这种情况下或类似情况下,由于 Actor 类的两个顶点之间存在关系,可能存在图循环。有没有办法通过注释或其他方式(例如通过管理器)定义在特定 @Adjacency 的 x 步后停止,这样就不会永远存在?如果@GremlinGroovy (https://github.com/tinkerpop/frames/wiki/Gremlin-Groovy) 注释是答案,你能举个例子吗?
【问题讨论】:
-
没有足够的信息来重现此问题。请提供您正在使用的库的版本。 (重要,因为
com.tinkerpop.blueprints:blueprints-orient-graph:2.4.0库中没有getVertexByKey方法。我怀疑您的问题可能是这样的:“getVertexByKey()不起作用”-github.com/orientechnologies/orientdb/issues/3128
标签: neo4j orientdb gremlin tinkerpop tinkerpop-frames