Skip to content

Commit

Permalink
Both queries follow new org concordance model
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Newton committed May 24, 2018
1 parent 2ed3128 commit 3e783ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions people/cypher.go
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3e783ff

Please sign in to comment.