neo4j - How to limit parsing depth using Tinkerpop Frames -
hi have interface , corresponding implementation class like:
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(); }
and use orientdb looks that. had similar implementation neo4j well:
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);
above works problem in case or similar, because there relationship between 2 vertices of class actor, there potentially graph loop. there way define either annotation or other way (e.g through manager) stop after x steps specific @adjacency won't go forever? if @gremlingroovy (https://github.com/tinkerpop/frames/wiki/gremlin-groovy) annotation answer please give example ?
i'm not sure understand question/problem. (you "potentially", haven't proven there's problem!)
- is problem there loop in vertex/frames, , (you think) loading object result in infinite loop?
- have been able prove there problem loading vertex/frame loop? (show me code/problem)
as understand it, pipelines lazy-load
objects (only load when required). frames (i imagine) load adjacent frames when requested. basically, far can tell, theres no problem.
example (groovy)
// create framed vertices person nick = createperson(name: 'nick') person michail = createperson(name: 'michail') // create recursive loop nick.addknows(michail) michail.addknows(nick) // handles recursion = true! person nick2 = framedgraph.getvertex(nick.asvertex().id, person) assert nick2.knows.knows.knows.knows.knows.name == 'michail'
Comments
Post a Comment