From 55d584732642c110eb2f5bde333ac0c032be08f8 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 25 Feb 2020 12:26:28 -0500 Subject: [PATCH 1/3] Add edgeCollections and vertexCollections traversal options. --- 3.7/aql/graphs-traversals.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/3.7/aql/graphs-traversals.md b/3.7/aql/graphs-traversals.md index 2c23f0c1af..d206b7e272 100644 --- a/3.7/aql/graphs-traversals.md +++ b/3.7/aql/graphs-traversals.md @@ -94,6 +94,22 @@ FOR vertex[, edge[, path]] duplicate edge - "none" – no uniqueness check is applied on edges. **Note:** Using this configuration the traversal will follow edges in cycles. + - **edgeCollections** (sting\|array, *optional*): Optionally restrict edge + collections considered while traversing a named graph. If omitted, or an + empty array is specified, then there are no restrictions. + - A string parameter is treated as the equivalent of an array with a single + element. + - Each element of the array should be a string containing the name of an + edge collection. + - **vertexCollections** (sting\|array, *optional*): Optionally restrict + vertex collections the traversal may visit. If omitted, or an empty array is + specified, then there are no restrictions. + - A string parameter is treated as the equivalent of an array with a single + element. + - Each element of the array should be a string containing the name of a + vertex collection. + - The starting vertex is always allowed, even if it does not belong to one + of the collections specified by a restriction. ### Working with collection sets @@ -109,7 +125,8 @@ FOR vertex[, edge[, path]] Instead of `GRAPH graphName` you may specify a list of edge collections. Vertex collections are determined by the edges in the edge collections. The traversal -options are the same as with the [named graph variant](#working-with-named-graphs). +options are the same as with the [named graph variant](#working-with-named-graphs), +though the `edgeCollections` restriction option is redundant in this case. If the same edge collection is specified multiple times, it will behave as if it were specified only once. Specifying the same edge collection is only allowed when From ce4f883b2896e7888496f0a33ebf22bfa1863c40 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 25 Feb 2020 12:34:05 -0500 Subject: [PATCH 2/3] Added new feature note. --- 3.7/release-notes-new-features37.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/3.7/release-notes-new-features37.md b/3.7/release-notes-new-features37.md index f1218e3849..df37c12bed 100644 --- a/3.7/release-notes-new-features37.md +++ b/3.7/release-notes-new-features37.md @@ -66,6 +66,33 @@ Improved the lazy evaluation capabilities of the [ternary operator](aql/operator If the second operand is left out, the expression of the condition is only evaluated once now, instead of once more for the true branch. +### Traversal collection restrictions + +Added traversal options `vertexCollections` and `edgeCollections` to restrict +traversal to certain vertex or edge collections. + +The use case for `vertexCollections` is to not follow any edges that will point +to other than the specified vertex collections, e.g. + + FOR v, e, p IN 1..3 OUTBOUND 'products/123' components + OPTIONS { vertexCollections: [ "bolts", "screws" ] } + +The traversal's start vertex is always considered valid, regardless of whether +it is present in the `vertexCollections` option. + +The use case for `edgeCollections` is to not take into consideration any edges +from edge collections other than the specified ones, e.g. + + FOR v, e, p IN 1..3 OUTBOUND 'products/123' GRAPH 'components' + OPTIONS { edgeCollections: [ "productsToBotls", "productsToScrews" ] } + +This is mostly useful in the context of named graphs, when the named graph +contains many edge collections. Not restricting the edge collections for the +traversal will make the traversal search for edges in all edge collections of +the graph, which can be expensive. In case it is known that only certain edges +from the named graph are needed, the `edgeCollections` option can be a handy +performance optimization. + Cluster ------- From fdf45fc14c35734013c60b125a30befe1b5aa41a Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Fri, 28 Feb 2020 13:51:39 +0100 Subject: [PATCH 3/3] not limited to named graphs --- 3.7/aql/graphs-traversals.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/3.7/aql/graphs-traversals.md b/3.7/aql/graphs-traversals.md index d206b7e272..80fcb7e850 100644 --- a/3.7/aql/graphs-traversals.md +++ b/3.7/aql/graphs-traversals.md @@ -94,16 +94,16 @@ FOR vertex[, edge[, path]] duplicate edge - "none" – no uniqueness check is applied on edges. **Note:** Using this configuration the traversal will follow edges in cycles. - - **edgeCollections** (sting\|array, *optional*): Optionally restrict edge - collections considered while traversing a named graph. If omitted, or an + - **edgeCollections** (string\|array): Optionally restrict edge + collections the traversal may visit. If omitted, or an empty array is specified, then there are no restrictions. - A string parameter is treated as the equivalent of an array with a single element. - Each element of the array should be a string containing the name of an edge collection. - - **vertexCollections** (sting\|array, *optional*): Optionally restrict - vertex collections the traversal may visit. If omitted, or an empty array is - specified, then there are no restrictions. + - **vertexCollections** (string\|array): Optionally restrict vertex + collections the traversal may visit. If omitted, or an empty array is + specified, then there are no restrictions. - A string parameter is treated as the equivalent of an array with a single element. - Each element of the array should be a string containing the name of a