OrientDB activity feed query with TRAVERSE
<p>im new on orientDB, i start to use this database with the graph mode and i want to create a query to get the activity feed of a specific user. usually in the nosql databases i duplicate a key of any new activity in the activity node of each follower. but i see that in the graph database is possible to avoid this process because i can get any activity with the TRAVERSE method. i have a series of differents vertex linked by a series of different EDGES. my graph is this</p>

<p><a href="https://i.stack.imgur.com/dKtc3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dKtc3.jpg" alt="enter image description here"></a></p>

<p>any user is a vertex that can follow another user, can create new events and can left a comment to other events. any edge that start from a user is a child class of the parent <code>"UserEdgeActivity"</code>, my question is that, how can i get the activities of users who i follow? 
any EDGE have three properties <code>created: datetime, in: LINK, out: LINK</code></p>

<p>to retrieve all edge activites by my followings i use this query</p>

<pre><code>SELECT FROM(TRAVERSE outE("UserEdgeActivity") FROM (SELECT FROM OUser WHERE name="admin")) WHERE $depth &gt; 0 AND out!=#5:5 AND in!=#5:5 ORDER BY created DESC
</code></pre>

<p>Unfortunately, the query returns a null result, but the user "admin" follow different users that did different activities.
my goal is to retrive all follow, event or comment actions that my following contact had make ordered by date, but excluding incoming activities towards the user "admin" or coming out from him.
i think that this is possible with the traverse method. what is the exact query to do this?</p>

<p>UPDATE:</p>

<p>solved with this query</p>

<pre><code>SELECT FROM(TRAVERSE out("NewFollow"), outE("UserEdgeActivity") FROM (SELECT FROM OUser WHERE name=? LIMIT 1) WHILE $depth &lt; 3) WHERE $depth &gt; 0 AND out.name!=? AND (in["@class"]!="OUser" OR in.name!=?)AND @class!="OUser" AND (@class!="NewComment" OR (@class="NewComment" AND in.out("NewCommentToEvent")[0].in("NewEvent")[0]["name"]!=?)) ORDER BY created DESC
</code></pre>