spring data neo4j - What is the correct way to obtain TraversalDescription? -
i using springrestgraphdatabase
, sdn 3.1.0
, neo4j 2.1.2
.
i struggling find way how obtain traversaldescription
instance. see traversaldescription traversaldescription = traversal.description()
deprecated. works!
other way suggested elsewhere:
traversaldescription traversaldescription = new traversaldescriptionimpl();
does not work since traversaldescriptionimpl
removed neo4j 2.x
the third way suggested in neo4j
user guide through graphdatabaseservice
:
traversaldescription traversaldescription = graphdatabaseservice.traversaldescription()
but getting:
caused by: java.lang.unsupportedoperationexception: builtin paths supported @ org.neo4j.rest.graphdb.traversal.resttraversal.evaluator(resttraversal.java:96)
any ideas?
thanks, milan
traversaldescription = graphdatabaseservice.traversaldescription()
is indeed correct way obtain traversaldescription()
in neo4j 2.x (either embedded or rest).
the problem indicated in message you're getting not you're unable obtain traversaldescription
, , in fact confirms obtaining one, trying unsupportedoperation
it.
without seeing more of code, can't tell is, check out relevant source code (github):
public resttraversaldescription filter(predicate<path> pathpredicate) { if (pathpredicate == evaluators.all()) return add("return_filter",tomap("language","builtin", "name","all")); if (pathpredicate == evaluators.excludestartposition()) return add("return_filter",tomap("language","builtin", "name","all_but_start_node")); throw new unsupportedoperationexception("only builtin paths supported"); } public resttraversaldescription evaluator(pathevaluator evaluator) { if (evaluator == evaluators.all()) return add("return_filter",tomap("language","builtin", "name","all")); if (evaluator == evaluators.excludestartposition()) return add("return_filter",tomap("language","builtin", "name","all_but_start_node")); throw new unsupportedoperationexception("only builtin paths supported"); } public resttraversaldescription evaluator(evaluator evaluator) { if (evaluator == evaluators.all()) return add("return_filter",tomap("language","builtin", "name","all")); if (evaluator == evaluators.excludestartposition()) return add("return_filter",tomap("language","builtin", "name","all_but_start_node")); throw new unsupportedoperationexception("only builtin paths supported"); }
you'll know of these methods throwing exception based on parameter you're passing in (or @ line number given in stack trace), alter implementation make sure 1 of if's evaluates true throw doesn't reached.
Comments
Post a Comment