title: Combining collection results of multiple MATCH cypher queries
body: <p>I have a graph in which, there can exist three patters of paths between <code>(:srcType)</code> and <code>(:destType)</code>:</p>
  
  <ol>
  <li><p><strong>Pattern 1</strong><br>
  <code>(:srcType)&lt;-[]-()&lt;-[]-(srcParent)&lt;-[]-(center)-[]-&gt;(destParent)-[]-&gt;()-[]-&gt;(:destType)</code><br>
  Notice that, here the direction of relationships reverses as path goes through <code>(center)</code>:<code>&lt;-[]-(center)-[]-&gt;</code></p></li>
  <li><p><strong>Pattern 2</strong><br>
  In this pattern <code>(srcParent)</code> it self is a center. Thus direction of relationships reverses across <code>(srcParent)</code>:<br>
      <code>(:srcType)&lt;-[]-()&lt;-[]-(srcParent)-[]-&gt;(destParent)-[]-&gt;()-[]-&gt;(:destType)</code>  </p></li>
  <li><p><strong>Pattern 3</strong><br>
  In this pattern <code>(destParent)</code> it self is a center. Thus direction of relationships reverses across <code>(destParent)</code>:<br>
  <code>(:srcType)&lt;-[]-()&lt;-[]-(srcParent)&lt;-[]-(destParent)-[]-&gt;()-[]-&gt;(:destType)</code>  </p></li>
  </ol>
  
  <p>I am giving id of <code>(:srcType)</code> and trying to obtain all <code>(:destType)</code> nodes. Note that given one <code>(:srcType)</code> it can have one <code>(:destType)</code> node associated with it following first pattern, another following 2nd pattern and few more following third pattern. I am trying to retrieve single collection containing all these <code>(:destType)</code> nodes. So I have combined above queries as follows:</p>
  
  <pre><code>MATCH (src:srcType)&lt;-[]-()&lt;-[]-(srcParent)&lt;-[]-(center)-[]-&gt;(destParent)-[]-&gt;()-[]-&gt;(dest1:destType)
  WHERE id(src)=3
  WITH dest1
  MATCH (src:srcType)&lt;-[]-()&lt;-[]-(srcParent)-[]-&gt;(destParent)-[]-&gt;()-[]-&gt;(dest2:destType)
  WHERE id(src)=3
  WITH dest1, dest2
  MATCH (src:srcType)&lt;-[]-()&lt;-[]-(srcParent)&lt;-[]-(destParent)-[]-&gt;()-[]-&gt;(dest3:destType)
  WHERE id(src)=3
  RETURN dest1, dest2, dest3
  </code></pre>
  
  <p>So here I am matching each pattern one by one in <code>MATCH</code> clauses and feeding <code>(:destType)</code>s output of one <code>MATCH</code> to next one using <code>WITH</code> clause. At the end I am returning all <code>destType</code>s. </p>
  
  <p><strong>Q1.</strong> But this is not executing. When I run one of the pattern (single <code>WITH</code>), it correctly returns whichever <code>(:destType)</code> that matches the path. But with above query it returns 0 rows. Why is it so?</p>
  
  <p><strong>Q2.</strong> Also instead of returning all <code>destType</code>s, I want to return single collection containing elements of all of them. Knowing that collections can be merged using <code>+</code>, is it possible to return something like below?</p>
  
  <pre><code>RETURN destType1+destType2+destType2
  </code></pre>
  
  <p><strong>Note</strong><br>
  I will need to add different filters for each pattern afterwards. So the future query may look something like this:</p>
  
  <pre><code>MATCH (src:srcType)&lt;-[]-()&lt;-[]-(srcParent)&lt;-[]-(center)-[]-&gt;(destParent)-[]-&gt;()-[]-&gt;(dest1:destType)
  WHERE id(src)=3 AND srcParent.prop1='a'
  WITH dest1
  MATCH (src:srcType)&lt;-[]-()&lt;-[]-(srcParent)-[]-&gt;(destParent)-[]-&gt;()-[]-&gt;(dest2:destType)
  WHERE id(src)=3 AND destParent.prop2='b'
  WITH dest1, dest2
  MATCH (src:srcType)&lt;-[]-()&lt;-[]-(srcParent)&lt;-[]-(destParent)-[]-&gt;()-[]-&gt;(dest3:destType)
  WHERE id(src)=3 AND srcParent.prop3='c'
  RETURN dest1, dest2, dest3
  </code></pre>