Hi Michael, In order to reduce the number or rows resulting from complex queries, I bundle up the results of sub queries into a Map object. I then return a collection of Map objects which can then be easily converted into Go structs. I believe that you were the one that suggested this approach to me.
Here is how I am doing most of my queries: MATCH (f:file {id: "foobar"}) WITH f, {accessedrole: "", accessedby: ""} AS r OPTIONAL MATCH (f)-[:CREATED]->(a:activity) WITH f, { accessedrole: r.accessedrole, accessedby: r.accessedby, createdat: a.createdat, createdby: {id: a.contactid, object: "contact"}} AS r OPTIONAL MATCH (f)-[:HISTORY]->(a:activity) WITH f, { accessedrole: r.accessedrole, accessedby: r.accessedby, createdat: r.createdat, createdby: r.createdby, updatedat: a.createdat, updatedby: {id: a.contactid, object: "contact"}} AS r OPTIONAL MATCH (f)-[:TAG]->(x) WITH f, COLLECT(x) AS xs, r WITH f, { accessedrole: r.accessedrole, accessedby: r.accessedby, createdat: r.createdat, createdby: r.createdby, updatedat: r.updatedat, updatedby: r.updatedby, tags: [x IN xs | {id: x.id, object: x.object, name: x.name}] } AS r RETURN COLLECT({ id: f.id, object: f.object, projectid: f.projectid, no: f.no, name: f.name, description: f.description, url: f.url, mime: f.mime, thumbnail: f.thumbnail, size: f.size, accessedrole: r.accessedrole, accessedby: r.accessedby, createdat: r.createdat, createdby: r.createdby, updatedat: r.updatedat, updatedby: r.updatedby, tags: r.tags }) AS r On Tuesday, April 7, 2015 at 2:09:27 PM UTC-7, Michael Hunger wrote: > > Hey Bill, > > interesting what's your use-case for this? > > Thanks so much, > > Michael > > Am 07.04.2015 um 21:24 schrieb bi...@levelstory.com <javascript:>: > > Is there any way to add additional properties to an existing Map object? > > I thought I could use SET, but it doesn't work on maps: > > WITH {a: "foo"} AS result > SET result.b = "bar" > RETURN result > > Type mismatch: expected Node or Relationship but was Map (line 1, column > 31) > > Because of this, I'm currently doing this everywhere which makes the > queries hard to read: > > WITH {a: "foo"} AS result > WITH {a: result.a, b: "bar"} AS result > RETURN result > > > Thanks, > bill > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to neo4j+un...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.