You can use triggers with apoc, that check e.g. when a node with label
:Yellow is added:

CALL apoc.trigger.add('create-new-yellow-node','
UNWIND apoc.trigger.nodesByLabel({createdNodes},'Yellow') AS this
MATCH (this)<-[:CHILD_OF*]-(p) WHERE p.value = this.value *SET ...*
', {phase:'before'})

Michael

On Tue, Mar 20, 2018 at 6:35 PM, Ynoa <ynoapar...@gmail.com> wrote:

>
>
>
>    - *Neo4j version*: 3.3.1 Enterprise
>    - *Driver*: Javascript-driver
>    - *Used Language*: Typescript / Angular 2
>    - *OS*: Windows 10
>
>
>
> I have a series of nodes with RED being the Root-node, and YELLOW is
> always the parent of ONLY a green node (GREEN always the child of ONLY
> YELLOW).
>
> For this example the nodes contain a single char.
>
>
> <https://lh3.googleusercontent.com/-w83k-1OIJRQ/WrFEUUDKskI/AAAAAAAACAU/PkHWgBwRG-0H_zWHWB8H_esMWFk4_lg5wCLcBGAs/s1600/nodeexample.PNG>
>
>
>
>
> Each time a YELLOW node is created with a given value, I want to traverse
> the tree, and compare all visited nodes with the value in the newly created
> YELLOW-node. If they contain the same value, and then do something wether
> this is true or not.
>
>
>
> I have read about the traversal API (java only, apparently) which allows
> me to imperatively manage the traversal, and apply a function to each node
> visited (visitor function). This would be good to use in this case.
>
> But I use the javascript driver, and coding in Typescript, so I don't have
> this option. It seems I have to rely on Cypher, and here's my question(s):
>
>
>
>    - Using Cypher, how do I control traversal in way, that I can apply a
>    function to each visited node in a given tree?
>    - Are there other ways of achieving the traversal if I can't do this
>    with Cypher?
>
>
> Any help or links to helpful articles or the neo4j documentation would be
> greatly appreciated.  In the meantime, I will keep trying :)
>
> Kind Regards
>  Joe
>
> --
> 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.

Reply via email to