Hi I dont know whether am doing it right by asking this questions here. But
I did asked it on stackoverflow
<http://stackoverflow.com/questions/42549705/getting-cypher-of-paths-and-rerunning-them>,
but didnt get any response after a day, though there are considerable views
on the question. May be my question is screwed or something like that, but
stackoverflow community is quick to tell even that. So I am just trying my
luck here to illicit some responses.
I have a somewhat unique scenario. I am going to get a node A. From node A,
I want to find path to some other nodes (say set C of nodes). Once I get
these set of paths I want to rerun those paths from the other node B (which
corresponds/similar to node A) to discover all nodes (which corresponds to
set C of nodes) which follow same paths (as from node A to nodes in set C).
For example if for (A) I have got (E),(G) following these paths:
---[:Rel2]--->(F)---[:Rel1]--->(G)
/
(A)---[:Rel1]--->(E)
Then for (B), I should get (J),(H) following the same paths, but should not
get (K) as it does not follow any of the path patterns returned for (A):
---[:Rel2]--->(I)---[:Rel1]--->(J)
/
(B)---[:Rel1]--->(H)
\
---[:Rel2]--->(K)
As of now, I am doing is as follows:
- Given A, run the initial cypher to get the desired paths.
- The paths are returned as instances of org.neo4j.driver.v1.types.Path.
Each Pathinstance is essentially a list of
org.neo4j.driver.v1.types.Path.Segment instances. So iterate over Segment
list
to form cypher string for each corresponding path.
- Use the cypher strings to do MATCH from B.
This is working, however, forming cypher string from the Java lists of
Segment classes gives me a weird feeling. I dont know if this approach is
correct or not. Is there any other better looking approach? Or is this
approach just ok? Is there any recommended approach? Have anyone came
across similar scenario?
[You may view first graph as a part of ("part" because it does not have
schema definition corresponding to instance pa(B)---[:Rel2]--->(K)) a
schema and second graph as an instance of that schema. We first find the
path in schema and then run it on instance.]
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.