How to remove labels from the variable path?

I have the following query:

MATCH path = (parent:Person)-[:HAS]->(child:Person)
OPTIONAL MATCH (child)-[:STUDY_AT]->(school:School)
...


the problem here is that neo4j in OPTIONAL MATCH looks at not only school children but parents too, and this is a big problem when the database is very large, because in the first database returns not only child nodes but the parent nodes together with the school

Is there any way how to remove (child) parent nodes, or select only (child)?
July 9th 19 at 10:16
1 answer
July 9th 19 at 10:18
Most likely iznochalno designed not exactly excluding this case.
That parents, that the children all belong to the same type (layble). That's the problem.
It would be correct.

MATCH path = (parent:Parent)-[:HAS]->(child:Child)
OPTIONAL MATCH (child)-[:STUDY_AT]->(school:School)

...

Now we need UPDATE which will make this request possible.

MATCH path = (parent:Person)-[:HAS]->(child:Person)
set child:Child, parent:Parent

Find more questions by tags Neo4j