mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-14 14:59:07 +02:00
implement relationship queries
This commit is contained in:
@@ -59,15 +59,11 @@ var HardDeletePersonCypherQuery string
|
||||
//go:embed queries/get_relationship.cypher
|
||||
var GetRelationshipCypherQuery string
|
||||
|
||||
// Requires id1, id2, Relationship parameters.
|
||||
// Requires childId, parentId, childRelationship, parentRelationship parameters.
|
||||
// returns relationships
|
||||
//
|
||||
//go:embed queries/create_directed_relationship.cypher
|
||||
var CreateDirectedRelationshipCypherQuery string
|
||||
|
||||
// Requires id1, id2, Relationship1, Relationship2 parameters.
|
||||
//
|
||||
//go:embed queries/create_two_directed_relationships.cypher
|
||||
var CreateTwoDirectedRelationshipCypherQuery string
|
||||
//go:embed queries/create_child_parent_relationships.cypher
|
||||
var CreateChildParentRelationshipCypherQuery string
|
||||
|
||||
// Requires id parameter.
|
||||
//
|
||||
|
@@ -0,0 +1,6 @@
|
||||
MATCH (a:Person), (b:Person)
|
||||
WHERE id(a) = $childId AND id(b) = $parentId AND $parentId != $childId
|
||||
MERGE (a)-[r1:Child]->(b)-[r2:Parent]->(a)
|
||||
ON CREATE SET r1 = $childRelationship
|
||||
ON CREATE SET r2 = $parentRelationship
|
||||
RETURN collect(r1)+collect(r2) as relationships;
|
@@ -1,5 +0,0 @@
|
||||
MATCH (a:Person)
|
||||
OPTIONAL MATCH (b:Person)
|
||||
WHERE id(a) = $id1 AND id(b) = $id2
|
||||
CREATE (a)-[r:Relationship $Relationship]->(b)
|
||||
RETURN r AS relationship;
|
@@ -1,4 +0,0 @@
|
||||
MATCH (a:Person), (b:Person)
|
||||
WHERE id(a) = $id1 AND id(b) = $id2
|
||||
CREATE (a)-[r:Relationship $Relationship]-(b)
|
||||
RETURN r as relationship
|
@@ -0,0 +1,6 @@
|
||||
MATCH (a:Person), (b:Person)
|
||||
WHERE id(a) = $id1 AND id(b) = $id2 AND $id1 != $id2
|
||||
MERGE (a)-[r1:Sibling]->(b)-[r2:Sibling]->(a)
|
||||
ON CREATE SET r1 = $Relationship1
|
||||
ON CREATE SET r2 = $Relationship2
|
||||
RETURN collect(r1)+collect(r2) as relationships;
|
@@ -0,0 +1,4 @@
|
||||
MATCH (a:Person)-[:Parent]->(b:Person)-[:Child]->(c:Person)
|
||||
WHERE id(a) = $childId AND id(b) = $parentId AND $parentId != $childId AND id(c) != id(a)
|
||||
MERGE (a)-[r1:Sibling]->(c)-[r2:Sibling]->(a)
|
||||
RETURN collect(r1)+collect(r2) as relationships;
|
@@ -0,0 +1,6 @@
|
||||
MATCH (a:Person), (b:Person)
|
||||
WHERE id(a) = $id1 AND id(b) = $id2 AND $id1 != $id2
|
||||
MERGE (a)-[r1:Spouse]->(b)-[r2:Spouse]->(a)
|
||||
ON CREATE SET r1 = $Relationship1
|
||||
ON CREATE SET r2 = $Relationship2
|
||||
RETURN collect(r1)+collect(r2) as relationships;
|
@@ -1,5 +0,0 @@
|
||||
MATCH (a:Person), (b:Person)
|
||||
WHERE id(a) = $id1 AND id(b) = $id2
|
||||
CREATE (a)-[r1:Relationship $Relationship1]->(b)
|
||||
CREATE (b)-[r2:Relationship $Relationship2]->(a)
|
||||
RETURN r1 as relationship1, r2 as relationship2
|
Reference in New Issue
Block a user