1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Michael Hackstein 2014-01-31 09:29:00 +01:00
commit d30585ceb2
4 changed files with 60 additions and 35 deletions

View File

@ -1,28 +1,10 @@
v1.5.0 (XXXX-XX-XX) v1.5.0 (XXXX-XX-XX)
------------------- -------------------
* allow vertex and edge filtering with user-defined functions in TRAVERSAL, * fail if invalid `strategy`, `order` or `itemOrder` attribute values
TRAVERSAL_TREE and SHORTEST_PATH AQL functions: are passed to the AQL TRAVERSAL function. Omitting these attributes
is not considered an error, but specifying an invalid value for any
// using user-defined AQL functions for edge and vertex filtering of these attributes will make an AQL query fail.
RETURN TRAVERSAL(friends, friendrelations, "friends/john", "outbound", {
followEdges: "myfunctions::checkedge",
filterVertices: "myfunctions::checkvertex"
})
// using the following custom filter functions
var aqlfunctions = require("org/arangodb/aql/functions");
aqlfunctions.register("myfunctions::checkedge", function (config, vertex, edge, path) {
return (edge.type !== 'dislikes'); // don't follow these edges
}, false);
aqlfunctions.register("myfunctions::checkvertex", function (config, vertex, path) {
if (vertex.isDeleted || ! vertex.isActive) {
return [ "prune", "exclude" ]; // exclude these and don't follow them
}
return [ ]; // include everything else
}, false);
* added SHORTEST_PATH AQL function * added SHORTEST_PATH AQL function
@ -54,8 +36,6 @@ v1.5.0 (XXXX-XX-XX)
can also be enforced by setting the `X-Arango-Version` HTTP header in a can also be enforced by setting the `X-Arango-Version` HTTP header in a
client request to this API on a per-request basis. client request to this API on a per-request basis.
* issue #748: add vertex filtering to AQL's TRAVERSAL[_TREE]() function
* allow direct access from the `db` object to collections whose names start * allow direct access from the `db` object to collections whose names start
with an underscore (e.g. db._users). with an underscore (e.g. db._users).
@ -167,9 +147,45 @@ v1.5.0 (XXXX-XX-XX)
result of <collection>.getIndexes() for each index. This is result of <collection>.getIndexes() for each index. This is
currently only implemented for hash indices and skiplist indices. currently only implemented for hash indices and skiplist indices.
v1.4.8 (xxxx-xx-xx)
v1.4.9 (XXXX-XX-XX)
------------------- -------------------
* issue #755: TRAVERSAL does not use strategy, order and itemOrder options
these options were not honored when configuring a traversal via the AQL
TRAVERSAL function. Now, these options are used if specified.
* allow vertex and edge filtering with user-defined functions in TRAVERSAL,
TRAVERSAL_TREE and SHORTEST_PATH AQL functions:
// using user-defined AQL functions for edge and vertex filtering
RETURN TRAVERSAL(friends, friendrelations, "friends/john", "outbound", {
followEdges: "myfunctions::checkedge",
filterVertices: "myfunctions::checkvertex"
})
// using the following custom filter functions
var aqlfunctions = require("org/arangodb/aql/functions");
aqlfunctions.register("myfunctions::checkedge", function (config, vertex, edge, path) {
return (edge.type !== 'dislikes'); // don't follow these edges
}, false);
aqlfunctions.register("myfunctions::checkvertex", function (config, vertex, path) {
if (vertex.isDeleted || ! vertex.isActive) {
return [ "prune", "exclude" ]; // exclude these and don't follow them
}
return [ ]; // include everything else
}, false);
* issue #748: add vertex filtering to AQL's TRAVERSAL[_TREE]() function
v1.4.8 (2014-01-31)
-------------------
* install foxx apps in the web interface
* fixed a segfault in the import API * fixed a segfault in the import API

View File

@ -633,14 +633,14 @@ function checkReverse (config) {
result = true; result = true;
} }
} }
else if (config.order === ArangoTraverser.PRE_ORDER) { else if (config.order === ArangoTraverser.PRE_ORDER) {
// pre order // pre order
if (config.itemOrder === ArangoTraverser.BACKWARD && if (config.itemOrder === ArangoTraverser.BACKWARD &&
config.strategy === ArangoTraverser.BREADTH_FIRST) { config.strategy === ArangoTraverser.BREADTH_FIRST) {
result = true; result = true;
} }
else if (config.itemOrder === ArangoTraverser.FORWARD && else if (config.itemOrder === ArangoTraverser.FORWARD &&
config.strategy === ArangoTraverser.DEPTH_FIRST) { config.strategy === ArangoTraverser.DEPTH_FIRST) {
result = true; result = true;
} }
} }
@ -1202,7 +1202,7 @@ ArangoTraverser = function (config) {
} }
if (typeof value === 'string') { if (typeof value === 'string') {
value = value.toLowerCase().replace(/-/, ""); value = value.toLowerCase().replace(/-/, "");
if (map[value] !== null) { if (map[value] !== null && map[value] !== undefined) {
return map[value]; return map[value];
} }
} }

View File

@ -632,14 +632,14 @@ function checkReverse (config) {
result = true; result = true;
} }
} }
else if (config.order === ArangoTraverser.PRE_ORDER) { else if (config.order === ArangoTraverser.PRE_ORDER) {
// pre order // pre order
if (config.itemOrder === ArangoTraverser.BACKWARD && if (config.itemOrder === ArangoTraverser.BACKWARD &&
config.strategy === ArangoTraverser.BREADTH_FIRST) { config.strategy === ArangoTraverser.BREADTH_FIRST) {
result = true; result = true;
} }
else if (config.itemOrder === ArangoTraverser.FORWARD && else if (config.itemOrder === ArangoTraverser.FORWARD &&
config.strategy === ArangoTraverser.DEPTH_FIRST) { config.strategy === ArangoTraverser.DEPTH_FIRST) {
result = true; result = true;
} }
} }
@ -1201,7 +1201,7 @@ ArangoTraverser = function (config) {
} }
if (typeof value === 'string') { if (typeof value === 'string') {
value = value.toLowerCase().replace(/-/, ""); value = value.toLowerCase().replace(/-/, "");
if (map[value] !== null) { if (map[value] !== null && map[value] !== undefined) {
return map[value]; return map[value];
} }
} }

View File

@ -3851,7 +3851,9 @@ function TRAVERSAL_FUNC (func,
maxIterations: params.maxIterations, maxIterations: params.maxIterations,
uniqueness: params.uniqueness, uniqueness: params.uniqueness,
expander: direction, expander: direction,
strategy: params.strategy strategy: params.strategy,
order: params.order,
itemOrder: params.itemOrder
}; };
if (params.followEdges) { if (params.followEdges) {
@ -3923,10 +3925,13 @@ function GRAPH_SHORTEST_PATH (vertexCollection,
direction, direction,
params) { params) {
"use strict"; "use strict";
if (params === undefined) {
params = { };
}
params.strategy = "dijkstra"; params.strategy = "dijkstra";
params.itemorder = "forward"; params.itemorder = "forward";
params.order = "forward";
params.visitor = TRAVERSAL_VISITOR; params.visitor = TRAVERSAL_VISITOR;
if (typeof params.distance === "string") { if (typeof params.distance === "string") {
@ -3959,6 +3964,10 @@ function GRAPH_TRAVERSAL (vertexCollection,
direction, direction,
params) { params) {
"use strict"; "use strict";
if (params === undefined) {
params = { };
}
params.visitor = TRAVERSAL_VISITOR; params.visitor = TRAVERSAL_VISITOR;