About "conflicting directions specified for collection"

15 views
Skip to first unread message

Beansprouts

unread,
Aug 26, 2016, 2:53:40 AM8/26/16
to ArangoDB

This is a small part of my graph,every vertex may has a parent and children.

my case : we have a start vertex,then we need to find other verties have the same parent with the start vertex.

In old version,we can do this by an aql: for sv in subject filter v.name="C3" for v,e,p in 2 any sv outbound r_parent,inbound r_parent return p

But,in version 3.0.4 the same aql cannot work as before,just got a exception message "conflicting directions specified for collection".

It's a new feature! 

But,I think it's an bug.


Jan

unread,
Aug 26, 2016, 3:04:03 AM8/26/16
to ArangoDB
Hi,

I have tried the query and got some parse errors in the part before the traversal.
I think the first part should read

    FOR sv IN subject FILTER sv.name == "C3"

(filtering on "sv" and not "v", and using a double equal sign to make the expression a comparison and not an assignment).

Apart from that, the traversal part specifies "sv" as the edge collection and "any" as the traversal direction. Then it specifies "r_parent" for outbound traversal and "r_parent" again for inbound traversal.
Though the combination of the "inbound" and "outbound" directions is the same as "any", I think the traversal part can be simplified to just

  FOR v,e,p IN 2 ANY sv r_parent RETURN p

The query parser just checks for whether multiple directions are specified for the same collection and will report an error if this is so.

Best regards
Jan

Beansprouts

unread,
Aug 26, 2016, 3:16:18 AM8/26/16
to ArangoDB
Sorry,I made a misstake on the first part of my aql.
if i just use an "any" direction,the set of results will be bigger than that i need.



在 2016年8月26日星期五 UTC+8下午3:04:03,Jan写道:

Jan

unread,
Aug 26, 2016, 3:36:33 AM8/26/16
to ArangoDB
Hi,

I think the results of

    FOR sv IN subject FILTER sv.name == "C3" FOR v,e,p IN 2 ANY sv r_parent RETURN p

should be identical to the results of

    FOR sv IN subject FILTER sv.name == "C3" FOR v,e,p IN 2 ANY sv INBOUND r_parent OUTBOUND r_parent RETURN p

apart from order of results inside the result set.
This also assumes that there are no edges in r_parent that have identical values in _from and _to in the same edge (self-referencing edges).

Can you provide some example data for which the query just using the collection once with "any" produces too many results?

Best regards
Jan

Beansprouts

unread,
Aug 26, 2016, 4:05:14 AM8/26/16
to ArangoDB
Oh,I am quite at fault. Thanks.

在 2016年8月26日星期五 UTC+8下午3:36:33,Jan写道:

Simran Brucherseifer

unread,
Aug 29, 2016, 7:42:48 AM8/29/16
to ArangoDB
Shouldn't there be two traversals? One to get from the start node to the parent node (outbound), and then another from that parent node down to all children (inbound)?
Reply all
Reply to author
Forward
0 new messages