Sure it is simple in the Java API as you have full control, via PathExpanders and Evaluators, see here:
http://neo4j.com/docs/stable/tutorials-java-embedded-graph-algo.html http://neo4j.com/docs/stable/tutorials-java-embedded-traversal.html#examples-uniqueness-of-paths-in-traversals Michael On Sun, Nov 23, 2014 at 7:03 PM, Milton Yutaka Nishiyama Junior < yutak...@gmail.com> wrote: > Hi Michael and Gabriel, > > Is it possible to make such similar queries using Java API ? or the > graphAlgorithms ?, in the last case I understood that you can only use the > parameters: node and distance. > > I would like to find all paths starting in one node, and exclude all paths > that have a node with the property "key". > > What I have done is to use the algorithm shortestPath to recover all paths, > and after that by programming, exclude the ones that contain the improper > node, and use the remaining paths. > > Thanks, > > Milton > > On Wednesday, November 19, 2014 12:04:29 AM UTC-2, Michael Hunger wrote: >> >> try this >> >> MATCH (topic:attribute) WHERE id(topic) IN [37, 38] >> >>> MATCH p = (topic)-[rel: describedBy*0..4]-(node: attribute >> >> where none(n IN nodes(p)[..-1] where n.key = "enrichment" OR n.key = >>> "classification") >> >> RETURN p; >> >> >> The problem is I want to remove paths where any of the nodes in the path >> (other than the end node) have the property "key" with either the value >> "enrichment" or "classification". >> >> On Tue, Nov 18, 2014 at 6:46 PM, Gabriel Bassett <gabe.the...@gmail.com> >> wrote: >> >>> I am having trouble creating an appropriate Cypher query. I would like >>> to return the sub-graph of all edges & nodes within a certain distance of a >>> topic node. This could easily be done with something like: >>>> >>>> START (topic: attribute)-[rel: describedBy*0..4]-(node: attribute >>> >>> WHERE id(topic) IN [37, 38] >>> >>> RETURN rel; >>> >>> The problem is I want to remove paths where any of the nodes in the path >>> (other than the end node) have the property "key" with either the value >>> "enrichment" or "classification". >>> >>> I've tried removing paths using: >>> >>>> MATCH path=(topic: attribute)-[rel: >>>> describedBy|influences*0..4]-(intermediate: >>>> attribute)-[rel: describedBy|influences*0..4]-(node: attribute) >>>> WHERE id(topic) IN [37,38] AND NOT intermediate in [x IN nodes(path) >>>> WHERE x.key IN ['enrichment', 'classification'] | x] and length(path) < 5 >>>> RETURN rel; >>> >>> >>> I've tried filtering at each potential distance in the path: >>> >>>> MATCH (topic: attribute)-[rel:describedBy|influences]-(node: attribute) >>>> WHERE id(topic) IN [37,38] >>> >>> RETURN rel as rels >>>> UNION >>>> MATCH path=(topic: attribute)-[rel: >>>> describedBy|influences*1]-(intermediate: >>>> attribute)-[rel: describedBy|influences*1..3]-(node: attribute) >>>> WHERE id(topic) IN [37,38] AND NOT intermediate.key in ['enrichment', >>>> 'classification'] and length(path) < 5 >>> >>> RETURN rel as rels >>>> UNION >>>> MATCH path=(topic: attribute)-[rel: >>>> describedBy|influences*2]-(intermediate: >>>> attribute)-[rel: describedBy|influences*1..2]-(node: attribute) >>>> WHERE id(topic) IN [37,38] AND NOT intermediate.key in ['enrichment', >>>> 'classification'] and length(path) < 5 >>> >>> RETURN rel as rels >>>> UNION >>>> MATCH path=(topic: attribute)-[rel: >>>> describedBy|influences*3]-(intermediate: >>>> attribute)-[rel: describedBy|influences*1..1]-(node: attribute) >>>> WHERE id(topic) IN [37,38] AND NOT intermediate.key in ['enrichment', >>>> 'classification'] and length(path) < 5 >>> >>> RETURN rel as rels; >>> >>> >>> I was hoping the 2nd match would stop paths that go >>> (37)-[rel]-(32)-[rel*0..3]-(), where 32 has 'key':'enrichment', however it >>> does not. >>> >>> Does anyone have any suggestions how I could formulate a query to stop >>> following a path when it reaches a node with a specific key:value pair? >>> >>> Thank you for the help. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Neo4j" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to neo4j+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to neo4j+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.