mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-12 13:59:08 +02:00
fix descendant queries
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
MATCH (n:Person)
|
||||
WHERE id(n) = $id
|
||||
OPTIONAL MATCH (n)-[p:Parent*..]->(family:Person)
|
||||
OPTIONAL MATCH (family)-[c:Child*1..4]->(children:Person)
|
||||
OPTIONAL MATCH (family)-[s:Sibling]->(siblings:Person)
|
||||
OPTIONAL MATCH (n)-[p:Parent*..]->(ancestors:Person)
|
||||
optional MATCH (n)-[cc:Child*..]->(descendants:Person)
|
||||
OPTIONAL MATCH (ancestors)-[c:Child*1..4]->(children:Person)
|
||||
OPTIONAL MATCH (ancestors)-[s:Sibling]->(siblings:Person)
|
||||
OPTIONAL MATCH (n)-[ds:Sibling]->(direct_siblings:Person)
|
||||
WITH collections.to_set(collect(n)+collect(family)+collect(children)+collect(direct_siblings)+collect(siblings)) as people,
|
||||
collections.to_set(collect(c) + collect(p) + collect(s) + collect(ds)) as relationships
|
||||
WITH collections.to_set(
|
||||
collect(n)+
|
||||
collect(descendants)+
|
||||
collect(ancestors)+
|
||||
collect(children)+
|
||||
collect(direct_siblings)+
|
||||
collect(siblings)
|
||||
) as people,
|
||||
collections.to_set(
|
||||
collect(c) +
|
||||
collect(cc) +
|
||||
collect(p) +
|
||||
collect(s) +
|
||||
collect(ds)
|
||||
) as relationships
|
||||
UNWIND people as ppl
|
||||
RETURN collect({
|
||||
id: id(ppl),
|
||||
|
@@ -1,14 +1,35 @@
|
||||
MATCH (n:Person)
|
||||
WHERE id(n) = $id
|
||||
OPTIONAL MATCH (n)-[p:Parent*..]->(family:Person)
|
||||
OPTIONAL MATCH (family)-[c:Child*1..4]->(children:Person)
|
||||
OPTIONAL MATCH (family)-[s:Sibling]->(siblings:Person)
|
||||
OPTIONAL MATCH (n)-[p:Parent*..]->(ancestors:Person)
|
||||
optional MATCH (n)-[cc:Child*..]->(descendants:Person)
|
||||
OPTIONAL MATCH (ancestors)-[c:Child*1..4]->(children:Person)
|
||||
OPTIONAL MATCH (ancestors)-[s:Sibling]->(siblings:Person)
|
||||
OPTIONAL MATCH (n)-[ds:Sibling]->(direct_siblings:Person)
|
||||
OPTIONAL MATCH (family)-[fsp:Spouse]->(fspouse:Person)
|
||||
OPTIONAL MATCH (ancestors)-[fsp:Spouse]->(fspouse:Person)
|
||||
OPTIONAL MATCH (children)-[csp:Spouse]->(cspouse:Person)
|
||||
OPTIONAL MATCH (n)-[sp:Spouse]->(spouse:Person)
|
||||
WITH collections.to_set(collect(n) + collect(family) + collect(children) + collect(direct_siblings) + collect(fspouse) + collect(cspouse) + collect(spouse) + collect(siblings)) as people,
|
||||
collections.to_set(collect(c) + collect(p) + collect(s) + collect(ds) + collect(fsp) + collect(csp) + collect(sp)) as relationships
|
||||
WITH
|
||||
collections.to_set(
|
||||
collect(n) +
|
||||
collect(descendants) +
|
||||
collect(ancestors) +
|
||||
collect(children) +
|
||||
collect(direct_siblings) +
|
||||
collect(fspouse) +
|
||||
collect(cspouse) +
|
||||
collect(spouse) +
|
||||
collect(siblings)
|
||||
) as people,
|
||||
collections.to_set(
|
||||
collect(c) +
|
||||
collect(cc) +
|
||||
collect(p) +
|
||||
collect(s) +
|
||||
collect(ds) +
|
||||
collect(fsp) +
|
||||
collect(csp) +
|
||||
collect(sp)
|
||||
) as relationships
|
||||
UNWIND people as ppl
|
||||
RETURN collect({
|
||||
id: id(ppl),
|
||||
|
Reference in New Issue
Block a user