title: Orientdb - where clause with multiple edges
body: <p>i'm still quite new at this so I will just go to the case.</p>
  
  <p>In our application we have notes that can be shared between users and stored in folders. Single note can obviously be in multiple folders (which cannot be shared). Till now for displaying notes in folder we were using this query:</p>
  
  <pre><code>(select expand(both(\'InFolder\')) from @folder_rid)
  </code></pre>
  
  <p>But now, we are developing some "advanced filters" where we want to show notes that are inside specific folder or those notes which are not in in. Notes can also be tagged (by single tag) so it was quite easy using "where clause"</p>
  
  <pre><code>SELECT FROM (select expand(both(\'CanView\')) from @user_rid) where out(\'HasTag\').@rid = @tag_rid
  </code></pre>
  
  <p>or</p>
  
  <pre><code>SELECT FROM (select expand(both(\'CanView\')) from @user_rid) where out(\'HasTag\').@rid &lt;&gt; @tag_rid
  </code></pre>
  
  <p>And now the problem. Since note can be stored in multiple folders above approach does not work. It works when I specify on which position in this array of edges(?) target folder should be:</p>
  
  <pre><code>SELECT FROM (select expand(both(\'CanView\')) from @user_rid) where out(\'InFolder\')[0].@rid = @folder_rid
  SELECT FROM (select expand(both(\'CanView\')) from @user_rid) where out(\'InFolder\')[1].@rid = @folder_rid
  </code></pre>
  
  <p>But obviously this is not the way to do this.
  I found (<a href="http://orientdb.com/orientdb-improved-sql-filtering/" rel="nofollow">http://orientdb.com/orientdb-improved-sql-filtering/</a>) that i can use ranges to do this, like</p>
  
  <pre><code>SELECT FROM (select expand(both(\'CanView\')) from @user_rid) where out(\'InFolder\')[0-2].@rid = @folder_rid
  </code></pre>
  
  <p>But it just calculates the value inside square brackets(oO).
  I also tried with [1,2,3] and using infos from <a href="https://code.google.com/p/orient/wiki/Document_Field_Part" rel="nofollow">https://code.google.com/p/orient/wiki/Document_Field_Part</a>
  but I couldn't get it to work.</p>
  
  <p>What is the correct syntax to do this or is this whole approach just bad. If problem is in the basics what is the good way to do this? Thanks for help and sorry for all mistakes I did in grammar.</p>