From 3e783ffe54ee9b313ed372dbca4ebaf7a5a9034b Mon Sep 17 00:00:00 2001 From: Scott Newton Date: Thu, 24 May 2018 11:04:38 +0100 Subject: [PATCH] Both queries follow new org concordance model --- people/cypher.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/people/cypher.go b/people/cypher.go index b6c5147..f48dc21 100644 --- a/people/cypher.go +++ b/people/cypher.go @@ -122,7 +122,7 @@ func (pcw CypherDriver) Read(uuid string, transactionID string) (Person, bool, e { id:coalesce(co.prefUUID, o.uuid), types:coalesce(labels(co), labels(o)), prefLabel:coalesce(co.prefLabel, o.prefLabel)} as o, { id:m.uuid, types:labels(m), prefLabel:m.prefLabel, title:m.title, changeEvents:[{startedAt:m.inceptionDate}, {endedAt:m.terminationDate}] } as m, { id:r.uuid, types:labels(r), prefLabel:r.prefLabel, changeEvents:[{startedAt:rr.inceptionDate}, {endedAt:rr.terminationDate}] } as r - WITH canonical, m, o, collect(r) as r ORDER BY o.uuid DESC + WITH canonical, m, o, collect(r) as r ORDER BY o.id DESC WITH canonical, collect({m:m, o:o, r:r}) as m WITH m, { ID:canonical.prefUUID, types:labels(canonical), prefLabel:canonical.prefLabel, labels:canonical.aliases, birthYear:canonical.birthYear, salutation:canonical.salutation, emailAddress:canonical.emailAddress, @@ -164,12 +164,13 @@ func (pcw CypherDriver) ReadOldConcordanceModel(uuid string, transactionID strin MATCH (identifier)-[:IDENTIFIES]->(p:Person) OPTIONAL MATCH (p)<-[:HAS_MEMBER]-(m:Membership) OPTIONAL MATCH (m)-[:HAS_ORGANISATION]->(o:Organisation) + OPTIONAL MATCH (o)-[:EQUIVALENT_TO]->(co:Organisation) OPTIONAL MATCH (m)-[rr:HAS_ROLE]->(r:MembershipRole) WITH p, - { id:o.uuid, types:labels(o), prefLabel:o.prefLabel} as o, + { id:coalesce(co.prefUUID, o.uuid), types:coalesce(labels(co), labels(o)), prefLabel:coalesce(co.prefLabel, o.prefLabel)} as o, { id:m.uuid, types:labels(m), prefLabel:m.prefLabel, title:m.title, changeEvents:[{startedAt:m.inceptionDate}, {endedAt:m.terminationDate}] } as m, { id:r.uuid, types:labels(r), prefLabel:r.prefLabel, changeEvents:[{startedAt:rr.inceptionDate}, {endedAt:rr.terminationDate}] } as r - WITH p, m, o, collect(r) as r ORDER BY o.uuid DESC + WITH p, m, o, collect(r) as r ORDER BY o.id DESC WITH p, collect({m:m, o:o, r:r}) as m WITH m, { id:p.uuid, types:labels(p), prefLabel:p.prefLabel, labels:p.aliases, birthYear:p.birthYear, salutation:p.salutation, emailAddress:p.emailAddress,