switch to using built in object id in memgraph

This commit is contained in:
2025-03-15 11:01:24 +01:00
parent f5e7292728
commit 85cae6f503
9 changed files with 12 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
MATCH (a:Person), (b:Person)
WHERE a.id = $id1 AND b.id = $id2
WHERE id(a) = $id1 AND id(b) = $id2
CREATE (a)-[r:Relationship $Relationship]->(b)
RETURN r as relationship

View File

@@ -1,4 +1,4 @@
MATCH (a:Person), (b:Person)
WHERE a.id = $id1 AND b.id = $id2
WHERE id(a) = $id1 AND id(b) = $id2
CREATE (a)-[r:Relationship $Relationship]-(b)
RETURN r as relationship

View File

@@ -1,5 +1,5 @@
MATCH (a:Person), (b:Person)
WHERE a.id = $id1 AND b.id = $id2
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

View File

@@ -1,4 +1,5 @@
MATCH (n:Person { id: $id })-[p:Parent*1..]->(family:Person)
MATCH (n:Person)-[p:Parent*1..]->(family:Person)
WHERE id(n) = $id
OPTIONAL MATCH (family)-[c:Child]->(children:Person)
WITH family, p, children, c, n
OPTIONAL MATCH (children)<-[p2:Parent]-(OtherParents:Person)

View File

@@ -1 +1 @@
MATCH (n:Person) WHERE n.id = $id RETURN n as person
MATCH (n:Person) WHERE id(n) = $id RETURN n as person

View File

@@ -1,2 +1,3 @@
MATCH (n {id: $id1})-[r]-(o {id: $id2})
MATCH (n)-[r]-(o)
WHERE id(n) = $id1 AND id(o) = $id2
RETURN r as relationship

View File

@@ -1,2 +1,3 @@
MATCH (n:DeletedPerson {id: $id})
MATCH (n:DeletedPerson)
WHERE id(n) = $id
DETACH DELETE n;

View File

@@ -1,14 +1,11 @@
CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.id);
CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.last_name);
CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.first_name);
CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.born);
CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.mothers_first_name);
CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.mothers_last_name);
CREATE CONSTRAINT ON (n:Person) ASSERT n.id IS UNIQUE;
CREATE CONSTRAINT ON (n:Person) ASSERT n.google_id IS UNIQUE;
CREATE CONSTRAINT ON (n:Person) ASSERT n.last_name, n.first_name, n.born, n.mothers_first_name, n.mothers_last_name IS UNIQUE;
CREATE INDEX ON :Person(id);
CREATE INDEX ON :Person(google_id);
CREATE INDEX ON :Person(last_name);
CREATE INDEX ON :Person(first_name);

View File

@@ -1,3 +1,4 @@
MATCH (n:Person $props)
MATCH (n:Person)
WHERE id(n) = $id
SET n += $props
RETURN n AS person