mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
8df7c6d994
|
@ -49,6 +49,7 @@ migrations will also be detailed here.
|
|||
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `graphName` instead.
|
||||
* Replication: the methods `logger.start`, `logger.stop` and `logger.properties` are now deprecated. Using them will raise a warning.
|
||||
* Replication: the HTTP methods `PUT /_api/replication/logger-start`, `PUT /_api/replication/logger-stop`, `GET /_api/replication/logger-config` and `PUT /_api/replication/logger-config` are now deprecated. Using them will raise a warning.
|
||||
* General-Graph: In the module `org/arangodb/general-graph` the functions `_undirectedRelation` and `_directedRelation` is no longer suggested, they will be deprecated int the next version. Both functions have been unified to `_relation`.
|
||||
|
||||
## 2.4
|
||||
|
||||
|
@ -68,6 +69,8 @@ migrations will also be detailed here.
|
|||
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `graphName` instead.
|
||||
* Replication: the methods `logger.start`, `logger.stop` and `logger.properties` are no longer available.
|
||||
* Replication: the HTTP methods `PUT /_api/replication/logger-start`, `PUT /_api/replication/logger-stop`, `GET /_api/replication/logger-config` and `PUT /_api/replication/logger-config` are no longer available.
|
||||
To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`.
|
||||
* General-Graph: In the module `org/arangodb/general-graph` the functions `_undirectedRelation` and `_directedRelation` are deprecated and will throw an error if you use them. Both functions have been unified to `_relation`.
|
||||
|
||||
## 2.5
|
||||
|
||||
|
@ -85,3 +88,4 @@ migrations will also be detailed here.
|
|||
* Traversal: The usage of the traversal datasource `collectionDatasourceFactory` has been removed entirely. Please use `generalGraphDatasourceFactory` instead.
|
||||
* Http: The api `_api/graph` has been removed entirely. Please use the general graph api `_api/gharial` instead.
|
||||
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` has been removed entirely. Please use `graphName` instead.
|
||||
* General-Graph: In the module `org/arangodb/general-graph` the functions `_undirectedRelation` and `_directedRelation` are no longer available by default, if you still want to use them start `arangod` with the option `--server.default-api-compatibility 20300`. Both functions have been unified to `_relation`.
|
||||
|
|
|
@ -8,7 +8,7 @@ In order to create a non empty graph the functionality to create edge definition
|
|||
|
||||
!SECTION Edge Definitions
|
||||
|
||||
An edge definition is a directed or undirected relation of a graph. Each graph can have arbitrary many relations defined within the edge definitions array.
|
||||
An edge definition is always a directed relation of a graph. Each graph can have arbitrary many relations defined within the edge definitions array.
|
||||
|
||||
!SUBSECTION Initialize the list
|
||||
|
||||
|
@ -18,12 +18,27 @@ An edge definition is a directed or undirected relation of a graph. Each graph c
|
|||
|
||||
@startDocuBlock JSF_general_graph_extend_edge_definitions
|
||||
|
||||
!SUBSUBSECTION Relation
|
||||
|
||||
@startDocuBlock JSF_general_graph_relation
|
||||
|
||||
|
||||
!SUBSUBSECTION Undirected Relation
|
||||
|
||||
**Warning: Deprecated**
|
||||
|
||||
This function is deprecated and will be removed soon.
|
||||
Please use [Relation](../General-Graphs/Management.html#relation) instead.
|
||||
|
||||
@startDocuBlock JSF_general_graph_undirectedRelation
|
||||
|
||||
!SUBSUBSECTION Directed Relation
|
||||
|
||||
**Warning: Deprecated**
|
||||
|
||||
This function is deprecated and will be removed soon.
|
||||
Please use [Relation](../General-Graphs/Management.html#relation) instead.
|
||||
|
||||
@startDocuBlock JSF_general_graph_directedRelation
|
||||
|
||||
!SECTION Create a graph
|
||||
|
|
|
@ -1412,7 +1412,7 @@ var _undirectedRelation = function (relationName, vertexCollections) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var _directedRelation = function (
|
||||
var _relation = function (
|
||||
relationName, fromVertexCollections, toVertexCollections) {
|
||||
var err;
|
||||
if (arguments.length < 3) {
|
||||
|
@ -4423,7 +4423,10 @@ Graph.prototype._PRINT = function(context) {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
exports._undirectedRelation = _undirectedRelation;
|
||||
exports._directedRelation = _directedRelation;
|
||||
exports._directedRelation = function () {
|
||||
return _relation.apply(this, arguments);
|
||||
} ;
|
||||
exports._relation = _relation;
|
||||
exports._graph = _graph;
|
||||
exports._edgeDefinitions = _edgeDefinitions;
|
||||
exports._extendEdgeDefinitions = _extendEdgeDefinitions;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
var FoxxController = require("org/arangodb/foxx").Controller,
|
||||
controller = new FoxxController(applicationContext),
|
||||
cluster = require("org/arangodb/cluster"),
|
||||
ArangoError = require("org/arangodb").ArangoError,
|
||||
actions = require("org/arangodb/actions"),
|
||||
Model = require("org/arangodb/foxx").Model,
|
||||
|
@ -42,6 +43,41 @@
|
|||
toId = function(c, k) {
|
||||
return c + "/" + k;
|
||||
},
|
||||
collectionRepresentation = function(collection, showProperties, showCount, showFigures) {
|
||||
var result = {};
|
||||
result.id = collection._id;
|
||||
result.name = collection.name();
|
||||
result.isSystem = (result.name.charAt(0) === '_');
|
||||
if (showProperties) {
|
||||
var properties = collection.properties();
|
||||
result.doCompact = properties.doCompact;
|
||||
result.isVolatile = properties.isVolatile;
|
||||
result.journalSize = properties.journalSize;
|
||||
result.keyOptions = properties.keyOptions;
|
||||
result.waitForSync = properties.waitForSync;
|
||||
if (cluster.isCoordinator()) {
|
||||
result.shardKeys = properties.shardKeys;
|
||||
result.numberOfShards = properties.numberOfShards;
|
||||
}
|
||||
}
|
||||
|
||||
if (showCount) {
|
||||
result.count = collection.count();
|
||||
}
|
||||
|
||||
if (showFigures) {
|
||||
var figures = collection.figures();
|
||||
|
||||
if (figures) {
|
||||
result.figures = figures;
|
||||
}
|
||||
}
|
||||
|
||||
result.status = collection.status();
|
||||
result.type = collection.type();
|
||||
|
||||
return result;
|
||||
},
|
||||
buildError = function(err, code) {
|
||||
return {
|
||||
error: true,
|
||||
|
@ -365,9 +401,17 @@
|
|||
controller.get("/:graph/vertex", function(req, res) {
|
||||
var name = req.params("graph");
|
||||
var g = Graph._graph(name);
|
||||
setResponse(res, "collections", _.map(g._vertexCollections(), function(c) {
|
||||
return c.name();
|
||||
}).sort(), actions.HTTP_OK);
|
||||
var mapFunc;
|
||||
if (req.params("collectionObjects")) {
|
||||
mapFunc = function(c) {
|
||||
return collectionRepresentation(c, false, false, false);
|
||||
};
|
||||
} else {
|
||||
mapFunc = function(c) {
|
||||
return c.name();
|
||||
};
|
||||
}
|
||||
setResponse(res, "collections", _.map(g._vertexCollections(), mapFunc).sort(), actions.HTTP_OK);
|
||||
})
|
||||
.pathParam("graph", {
|
||||
type: graphName
|
||||
|
|
|
@ -1302,6 +1302,9 @@ AQLGenerator.prototype.next = function() {
|
|||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Deprecated block
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph_undirectedRelation
|
||||
/// @brief Define an undirected relation.
|
||||
|
@ -1343,6 +1346,9 @@ AQLGenerator.prototype.next = function() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Deprecated block
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var _undirectedRelation = function (relationName, vertexCollections) {
|
||||
var err;
|
||||
if (arguments.length < 2) {
|
||||
|
@ -1372,8 +1378,9 @@ var _undirectedRelation = function (relationName, vertexCollections) {
|
|||
to: stringToArray(vertexCollections)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Deprecated block
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph_directedRelation
|
||||
/// @brief Define a directed relation.
|
||||
|
@ -1410,8 +1417,49 @@ var _undirectedRelation = function (relationName, vertexCollections) {
|
|||
///
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_general_graph_relation
|
||||
/// @brief Define a directed relation.
|
||||
///
|
||||
/// `graph_module._relation(relationName, fromVertexCollections, toVertexCollections)`
|
||||
///
|
||||
/// The *relationName* defines the name of this relation and references to the underlying edge collection.
|
||||
/// The *fromVertexCollections* is an Array of document collections holding the start vertices.
|
||||
/// The *toVertexCollections* is an Array of document collections holding the target vertices.
|
||||
/// Relations are only allowed in the direction from any collection in *fromVertexCollections*
|
||||
/// to any collection in *toVertexCollections*.
|
||||
///
|
||||
/// @PARAMS
|
||||
///
|
||||
/// @PARAM{relationName, string, required}
|
||||
/// The name of the edge collection where the edges should be stored.
|
||||
/// Will be created if it does not yet exist.
|
||||
///
|
||||
/// @PARAM{fromVertexCollections, array, required}
|
||||
/// One or a list of collection names. Source vertices for the edges
|
||||
/// have to be stored in these collections. Collections will be created if they do not exist.
|
||||
///
|
||||
/// @PARAM{toVertexCollections, array, required}
|
||||
/// One or a list of collection names. Target vertices for the edges
|
||||
/// have to be stored in these collections. Collections will be created if they do not exist.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphRelationDefinition}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// graph_module._relation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphRelationDefinitionSingle}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// graph_module._relation("has_bought", "Customer", "Product");
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
/// @endDocuBlock
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _directedRelation = function (
|
||||
var _relation = function (
|
||||
relationName, fromVertexCollections, toVertexCollections) {
|
||||
var err;
|
||||
if (arguments.length < 3) {
|
||||
|
@ -1499,8 +1547,8 @@ var _listObjects = function() {
|
|||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphEdgeDefinitions}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// directed_relation = graph_module._directedRelation("lives_in", "user", "city");
|
||||
/// undirected_relation = graph_module._undirectedRelation("knows", "user");
|
||||
/// directed_relation = graph_module._relation("lives_in", "user", "city");
|
||||
/// undirected_relation = graph_module._relation("knows", "user", "user");
|
||||
/// edgedefinitions = graph_module._edgeDefinitions(directed_relation, undirected_relation);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
|
@ -1541,8 +1589,8 @@ var _edgeDefinitions = function () {
|
|||
///
|
||||
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphEdgeDefinitionsExtend}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// directed_relation = graph_module._directedRelation("lives_in", "user", "city");
|
||||
/// undirected_relation = graph_module._undirectedRelation("knows", "user");
|
||||
/// directed_relation = graph_module._relation("lives_in", "user", "city");
|
||||
/// undirected_relation = graph_module._relation("knows", "user", "user");
|
||||
/// edgedefinitions = graph_module._edgeDefinitions(directed_relation);
|
||||
/// edgedefinitions = graph_module._extendEdgeDefinitions(undirected_relation);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
|
@ -1604,7 +1652,7 @@ var sortEdgeDefinition = function(edgeDefinition) {
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphCreateGraphHowTo3}
|
||||
/// ~ var graph_module = require("org/arangodb/general-graph");
|
||||
/// ~ var graph = graph_module._create("myGraph");
|
||||
/// var rel = graph_module._directedRelation("isCustomer", ["shop"], ["customer"]);
|
||||
/// var rel = graph_module._relation("isCustomer", ["shop"], ["customer"]);
|
||||
/// graph._extendEdgeDefinitions(rel);
|
||||
/// graph;
|
||||
/// ~ graph_module._drop("myGraph", true);
|
||||
|
@ -1653,7 +1701,7 @@ var sortEdgeDefinition = function(edgeDefinition) {
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphCreateGraph2}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// | graph = graph_module._create("myGraph",
|
||||
/// [graph_module._undirectedRelation("myRelation", ["male", "female"])], ["sessions"]);
|
||||
/// [graph_module._relation("myRelation", ["male", "female"])], ["sessions"]);
|
||||
/// ~ graph_module._drop("myGraph", true);
|
||||
/// @END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
///
|
||||
|
@ -3899,8 +3947,8 @@ Graph.prototype._diameter = function(options) {
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__extendEdgeDefinitions}
|
||||
/// var graph_module = require("org/arangodb/general-graph")
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var ed1 = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = graph_module._directedRelation("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var ed1 = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = graph_module._relation("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var graph = graph_module._create("myGraph", [ed1]);
|
||||
/// graph._extendEdgeDefinitions(ed2);
|
||||
/// ~ var blub = graph_module._drop("myGraph", true);
|
||||
|
@ -4080,8 +4128,8 @@ var changeEdgeDefinitionsForGraph = function(graph, edgeDefinition, newCollectio
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__editEdgeDefinition}
|
||||
/// var graph_module = require("org/arangodb/general-graph")
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var original = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var modified = graph_module._directedRelation("myEC1", ["myVC2"], ["myVC3"]);
|
||||
/// var original = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var modified = graph_module._relation("myEC1", ["myVC2"], ["myVC3"]);
|
||||
/// var graph = graph_module._create("myGraph", [original]);
|
||||
/// graph._editEdgeDefinitions(modified);
|
||||
/// ~ var blub = graph_module._drop("myGraph", true);
|
||||
|
@ -4159,8 +4207,8 @@ Graph.prototype._editEdgeDefinitions = function(edgeDefinition) {
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__deleteEdgeDefinition}
|
||||
/// var graph_module = require("org/arangodb/general-graph")
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var ed1 = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = graph_module._directedRelation("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var ed1 = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = graph_module._relation("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var graph = graph_module._create("myGraph", [ed1, ed2]);
|
||||
/// graph._deleteEdgeDefinition("myEC1");
|
||||
/// db._collection("myEC1");
|
||||
|
@ -4172,8 +4220,8 @@ Graph.prototype._editEdgeDefinitions = function(edgeDefinition) {
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__deleteEdgeDefinitionWithDrop}
|
||||
/// var graph_module = require("org/arangodb/general-graph")
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var ed1 = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = graph_module._directedRelation("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var ed1 = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed2 = graph_module._relation("myEC2", ["myVC1"], ["myVC3"]);
|
||||
/// var graph = graph_module._create("myGraph", [ed1, ed2]);
|
||||
/// graph._deleteEdgeDefinition("myEC1", true);
|
||||
/// db._collection("myEC1");
|
||||
|
@ -4257,7 +4305,7 @@ Graph.prototype._deleteEdgeDefinition = function(edgeCollection, dropCollection)
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__addVertexCollection}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var ed1 = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed1 = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var graph = graph_module._create("myGraph", [ed1]);
|
||||
/// graph._addVertexCollection("myVC3", true);
|
||||
/// ~ var blub = graph_module._drop("myGraph", true);
|
||||
|
@ -4317,7 +4365,7 @@ Graph.prototype._addVertexCollection = function(vertexCollectionName, createColl
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__orphanCollections}
|
||||
/// var graph_module = require("org/arangodb/general-graph")
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var ed1 = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed1 = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var graph = graph_module._create("myGraph", [ed1]);
|
||||
/// graph._addVertexCollection("myVC3", true);
|
||||
/// graph._orphanCollections();
|
||||
|
@ -4356,7 +4404,7 @@ Graph.prototype._orphanCollections = function() {
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__removeVertexCollections}
|
||||
/// var graph_module = require("org/arangodb/general-graph")
|
||||
/// ~ if (graph_module._exists("myGraph")){var blub = graph_module._drop("myGraph", true);}
|
||||
/// var ed1 = graph_module._directedRelation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var ed1 = graph_module._relation("myEC1", ["myVC1"], ["myVC2"]);
|
||||
/// var graph = graph_module._create("myGraph", [ed1]);
|
||||
/// graph._addVertexCollection("myVC3", true);
|
||||
/// graph._addVertexCollection("myVC4", true);
|
||||
|
@ -4421,8 +4469,13 @@ Graph.prototype._PRINT = function(context) {
|
|||
// --SECTION-- MODULE EXPORTS
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// Deprecated function (announced 2.3)
|
||||
exports._undirectedRelation = _undirectedRelation;
|
||||
exports._directedRelation = _directedRelation;
|
||||
/// Deprecated function (announced 2.3)
|
||||
exports._directedRelation = function () {
|
||||
return _relation.apply(this, arguments);
|
||||
} ;
|
||||
exports._relation = _relation;
|
||||
exports._graph = _graph;
|
||||
exports._edgeDefinitions = _edgeDefinitions;
|
||||
exports._extendEdgeDefinitions = _extendEdgeDefinitions;
|
||||
|
@ -4451,9 +4504,9 @@ exports._listObjects = _listObjects;
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph_create_graph_example1}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// var edgeDefinitions = graph_module._edgeDefinitions();
|
||||
/// graph_module._extendEdgeDefinitions(edgeDefinitions, graph_module._undirectedRelation("friend_of", ["Customer"]));
|
||||
/// graph_module._extendEdgeDefinitions(edgeDefinitions, graph_module._relation("friend_of", "Customer", "Customer"));
|
||||
/// | graph_module._extendEdgeDefinitions(
|
||||
/// | edgeDefinitions, graph_module._directedRelation(
|
||||
/// | edgeDefinitions, graph_module._relation(
|
||||
/// "has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]));
|
||||
/// graph_module._create("myStore", edgeDefinitions);
|
||||
/// ~ graph_module._drop("myStore");
|
||||
|
@ -4468,7 +4521,7 @@ exports._listObjects = _listObjects;
|
|||
/// @EXAMPLE_ARANGOSH_OUTPUT{general_graph_create_graph_example2}
|
||||
/// var graph_module = require("org/arangodb/general-graph");
|
||||
/// | var edgeDefinitions = graph_module._edgeDefinitions(
|
||||
/// | graph_module._undirectedRelation("friend_of", ["Customer"]), graph_module._directedRelation(
|
||||
/// | graph_module._relation("friend_of", ["Customer"]), graph_module._relation(
|
||||
/// "has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]));
|
||||
/// graph_module._create("myStore", edgeDefinitions);
|
||||
/// ~ graph_module._drop("myStore");
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
var createTraversalExample = function() {
|
||||
var g = Graph._create("knows_graph",
|
||||
[Graph._undirectedRelation("knows", "persons")]
|
||||
[Graph._relation("knows", "persons", "persons")]
|
||||
);
|
||||
var a = g.persons.save({name: "Alice", _key: "alice"})._id;
|
||||
var b = g.persons.save({name: "Bob", _key: "bob"})._id;
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
var createSocialGraph = function() {
|
||||
var edgeDefinition = [];
|
||||
edgeDefinition.push(Graph._undirectedRelation("relation", ["female", "male"]));
|
||||
edgeDefinition.push(Graph._relation("relation", ["female", "male"], ["female", "male"]));
|
||||
var g = Graph._create("social", edgeDefinition);
|
||||
var a = g.female.save({name: "Alice", _key: "alice"});
|
||||
var b = g.male.save({name: "Bob", _key: "bob"});
|
||||
|
@ -65,13 +65,13 @@
|
|||
|
||||
var createRoutePlannerGraph = function() {
|
||||
var edgeDefinition = [];
|
||||
edgeDefinition.push(Graph._directedRelation(
|
||||
edgeDefinition.push(Graph._relation(
|
||||
"germanHighway", ["germanCity"], ["germanCity"])
|
||||
);
|
||||
edgeDefinition.push(
|
||||
Graph._directedRelation("frenchHighway", ["frenchCity"], ["frenchCity"])
|
||||
Graph._relation("frenchHighway", ["frenchCity"], ["frenchCity"])
|
||||
);
|
||||
edgeDefinition.push(Graph._directedRelation(
|
||||
edgeDefinition.push(Graph._relation(
|
||||
"internationalHighway", ["frenchCity", "germanCity"], ["frenchCity", "germanCity"])
|
||||
);
|
||||
var g = Graph._create("routeplanner", edgeDefinition);
|
||||
|
|
|
@ -53,8 +53,8 @@ function GeneralGraphCreationSuite() {
|
|||
var vn4 = "UnitTestVerticies4";
|
||||
var gn = "UnitTestGraph";
|
||||
var edgeDef = graph._edgeDefinitions(
|
||||
graph._undirectedRelation(rn, vn1),
|
||||
graph._directedRelation(rn1,
|
||||
graph._relation(rn, [vn1], [vn1]),
|
||||
graph._relation(rn1,
|
||||
[vn1, vn2], [vn3, vn4]
|
||||
)
|
||||
);
|
||||
|
@ -110,7 +110,7 @@ function GeneralGraphCreationSuite() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
test_undirectedRelation : function () {
|
||||
var r = graph._undirectedRelation(rn, [vn1, vn2]);
|
||||
var r = graph._relation(rn, [vn1, vn2], [vn1, vn2]);
|
||||
|
||||
assertEqual(r, {
|
||||
collection: rn,
|
||||
|
@ -121,7 +121,7 @@ function GeneralGraphCreationSuite() {
|
|||
},
|
||||
|
||||
test_undirectedRelationWithSingleCollection : function () {
|
||||
var r = graph._undirectedRelation(rn, vn1);
|
||||
var r = graph._relation(rn, vn1, vn1);
|
||||
|
||||
assertEqual(r, {
|
||||
collection: rn,
|
||||
|
@ -133,33 +133,21 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_undirectedRelationWithMissingName : function () {
|
||||
try {
|
||||
graph._undirectedRelation("", [vn1, vn2]);
|
||||
graph._relation("", [vn1, vn2], [vn1, vn2]);
|
||||
fail();
|
||||
}
|
||||
catch (err) {
|
||||
assertEqual(err.errorMessage, "Invalid parameter type. arg1 must not be empty");
|
||||
assertEqual(err.errorMessage, "Invalid parameter type. arg1 must be non empty string");
|
||||
}
|
||||
},
|
||||
|
||||
test_undirectedRelationWithTooFewArgs : function () {
|
||||
test_relationWithTooFewArgs : function () {
|
||||
try {
|
||||
graph._undirectedRelation([vn1, vn2]);
|
||||
graph._relation([vn1, vn2]);
|
||||
fail();
|
||||
}
|
||||
catch (err) {
|
||||
assertEqual(err.errorMessage, "Invalid number of arguments. Expected: 2");
|
||||
}
|
||||
},
|
||||
|
||||
test_undirectedRelationWithInvalidSecondArg : function () {
|
||||
try {
|
||||
var param = {};
|
||||
param[vn1] = vn2;
|
||||
graph._undirectedRelation(rn, param);
|
||||
fail();
|
||||
}
|
||||
catch (err) {
|
||||
assertEqual(err.errorMessage, "Invalid parameter type. arg2 must not be empty");
|
||||
assertEqual(err.errorMessage, "Invalid number of arguments. Expected: 3");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -167,7 +155,7 @@ function GeneralGraphCreationSuite() {
|
|||
var g = graph._create(
|
||||
gn,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(rn1, [vn2, vn1], [vn4, vn3])
|
||||
graph._relation(rn1, [vn2, vn1], [vn4, vn3])
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -178,7 +166,7 @@ function GeneralGraphCreationSuite() {
|
|||
},
|
||||
|
||||
test_directedRelation : function () {
|
||||
var r = graph._directedRelation(rn,
|
||||
var r = graph._relation(rn,
|
||||
[vn1, vn2], [vn3, vn4]);
|
||||
|
||||
assertEqual(r, {
|
||||
|
@ -191,7 +179,7 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_directedRelationWithMissingName : function () {
|
||||
try {
|
||||
graph._directedRelation("",
|
||||
graph._relation("",
|
||||
[vn1, vn2], [vn3, vn4]);
|
||||
fail();
|
||||
}
|
||||
|
@ -202,7 +190,7 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_directedRelationWithTooFewArgs : function () {
|
||||
try {
|
||||
graph._directedRelation([vn1, vn2], [vn3, vn4]);
|
||||
graph._relation([vn1, vn2], [vn3, vn4]);
|
||||
fail();
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -210,11 +198,11 @@ function GeneralGraphCreationSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
test_directedRelationWithInvalidSecondArg : function () {
|
||||
test_relationWithInvalidSecondArg : function () {
|
||||
try {
|
||||
var param = {};
|
||||
param[vn1] = vn2;
|
||||
graph._directedRelation(rn, param, vn3);
|
||||
graph._relation(rn, param, vn3);
|
||||
fail();
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -224,11 +212,11 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
},
|
||||
|
||||
test_directedRelationWithInvalidThirdArg : function () {
|
||||
test_relationWithInvalidThirdArg : function () {
|
||||
try {
|
||||
var param = {};
|
||||
param[vn1] = vn2;
|
||||
graph._directedRelation(rn, vn3, param);
|
||||
graph._relation(rn, vn3, param);
|
||||
fail();
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -243,8 +231,8 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
//with args
|
||||
assertEqual(graph._edgeDefinitions(
|
||||
graph._undirectedRelation(rn, vn1),
|
||||
graph._directedRelation(rn1,
|
||||
graph._relation(rn, vn1, vn1),
|
||||
graph._relation(rn1,
|
||||
[vn1, vn2], [vn3, vn4])
|
||||
), [
|
||||
{
|
||||
|
@ -268,12 +256,12 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
//with args
|
||||
var ed =graph._edgeDefinitions(
|
||||
graph._undirectedRelation("relationName", "vertexC1"),
|
||||
graph._directedRelation("relationName",
|
||||
graph._relation("relationName", "vertexC1", "vertexC1"),
|
||||
graph._relation("relationName",
|
||||
["vertexC1", "vertexC2"], ["vertexC3", "vertexC4"])
|
||||
);
|
||||
graph._extendEdgeDefinitions(ed,
|
||||
graph._undirectedRelation("relationName", "vertexC1")
|
||||
graph._relation("relationName", "vertexC1", "vertexC1")
|
||||
);
|
||||
assertEqual(ed, [
|
||||
{
|
||||
|
@ -303,8 +291,8 @@ function GeneralGraphCreationSuite() {
|
|||
var a = graph._create(
|
||||
gn,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(rn, vn1),
|
||||
graph._directedRelation(rn1, [vn1, vn2], [vn3, vn4])
|
||||
graph._relation(rn, vn1, vn1),
|
||||
graph._relation(rn1, [vn1, vn2], [vn3, vn4])
|
||||
)
|
||||
);
|
||||
assertTrue(a.__vertexCollections.hasOwnProperty(vn1));
|
||||
|
@ -356,8 +344,8 @@ function GeneralGraphCreationSuite() {
|
|||
graph._create(
|
||||
"",
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation("relationName", "vertexC1"),
|
||||
graph._directedRelation("relationName2",
|
||||
graph._relation("relationName", "vertexC1", "vertexC1"),
|
||||
graph._relation("relationName2",
|
||||
["vertexC1", "vertexC2"], ["vertexC3", "vertexC4"]
|
||||
)
|
||||
)
|
||||
|
@ -433,7 +421,7 @@ function GeneralGraphCreationSuite() {
|
|||
if(graph._exists(gn)) {
|
||||
graph._drop(gn, true);
|
||||
}
|
||||
var edgeDef2 = [graph._directedRelation(rn, vn1, vn2)];
|
||||
var edgeDef2 = [graph._relation(rn, vn1, vn2)];
|
||||
var g = graph._create(gn, edgeDef2);
|
||||
var v1 = g[vn1].save({_key: "1"})._id;
|
||||
var v2 = g[vn2].save({_key: "2"})._id;
|
||||
|
@ -471,7 +459,7 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
|
||||
test_deleteEdgeDefinitionFromExistingGraph1: function() {
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
g1 = graph._create(gN1, [dr1]);
|
||||
|
||||
try {
|
||||
|
@ -487,9 +475,9 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_deleteEdgeDefinitionFromExistingGraph2: function() {
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._directedRelation(ec3, [vc4], [vc5]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._relation(ec3, [vc4], [vc5]),
|
||||
g1 = graph._create(gN1, [dr1, dr2, dr3]);
|
||||
|
||||
assertEqual([dr1, dr2, dr3], g1.__edgeDefinitions);
|
||||
|
@ -506,9 +494,9 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_deleteEdgeDefinitionFromExistingGraphAndDropIt: function() {
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._directedRelation(ec3, [vc4], [vc5]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._relation(ec3, [vc4], [vc5]),
|
||||
g1 = graph._create(gN1, [dr1, dr2, dr3]);
|
||||
|
||||
assertEqual([dr1, dr2, dr3], g1.__edgeDefinitions);
|
||||
|
@ -530,8 +518,8 @@ function GeneralGraphCreationSuite() {
|
|||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc2]),
|
||||
dr2 = graph._directedRelation(ec1, [vc2], [vc3]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc2]),
|
||||
dr2 = graph._relation(ec1, [vc2], [vc3]),
|
||||
g1 = graph._create(gN1, [dr1]);
|
||||
|
||||
try {
|
||||
|
@ -552,9 +540,9 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_extendEdgeDefinitionFromExistingGraph2: function() {
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]),
|
||||
dr2a = graph._directedRelation(ec2, [vc3], [vc4]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec2, [vc3], [vc4, vc5]),
|
||||
dr2a = graph._relation(ec2, [vc3], [vc4]),
|
||||
g1 = graph._create(gN1, [dr1]),
|
||||
g2 = graph._create(gN2, [dr2]);
|
||||
|
||||
|
@ -588,9 +576,9 @@ function GeneralGraphCreationSuite() {
|
|||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._directedRelation(ec3, [vc3], [vc4]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec2, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._relation(ec3, [vc3], [vc4]),
|
||||
g1 = graph._create(gN1, [dr1]),
|
||||
g2 = graph._create(gN2, [dr2]);
|
||||
|
||||
|
@ -615,8 +603,8 @@ function GeneralGraphCreationSuite() {
|
|||
} catch(ignore) {
|
||||
}
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec2, [vc4, vc3, vc1, vc2], [vc4, vc3, vc1, vc2]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec2, [vc4, vc3, vc1, vc2], [vc4, vc3, vc1, vc2]),
|
||||
g1 = graph._create(gN1, [dr1]);
|
||||
|
||||
g1._extendEdgeDefinitions(dr2);
|
||||
|
@ -629,8 +617,8 @@ function GeneralGraphCreationSuite() {
|
|||
},
|
||||
|
||||
test_editEdgeDefinitionFromExistingGraph1: function() {
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec2, [vc3], [vc4, vc5]),
|
||||
g1 = graph._create(gN1, [dr1]);
|
||||
|
||||
try {
|
||||
|
@ -646,9 +634,9 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_editEdgeDefinitionFromExistingGraph2: function() {
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1, vc2], [vc3, vc4]),
|
||||
dr2 = graph._directedRelation(ec2, [vc1], [vc4]),
|
||||
dr3 = graph._directedRelation(ec1, [vc5], [vc5]),
|
||||
var dr1 = graph._relation(ec1, [vc1, vc2], [vc3, vc4]),
|
||||
dr2 = graph._relation(ec2, [vc1], [vc4]),
|
||||
dr3 = graph._relation(ec1, [vc5], [vc5]),
|
||||
g1 = graph._create(gN1, [dr1, dr2]),
|
||||
g2 = graph._create(gN2, [dr1]);
|
||||
|
||||
|
@ -663,9 +651,9 @@ function GeneralGraphCreationSuite() {
|
|||
|
||||
test_editEdgeDefinitionFromExistingGraph3: function() {
|
||||
|
||||
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._directedRelation(ec1, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._directedRelation(ec2, [vc2], [vc2, vc3]),
|
||||
var dr1 = graph._relation(ec1, [vc1], [vc1, vc2]),
|
||||
dr2 = graph._relation(ec1, [vc3], [vc4, vc5]),
|
||||
dr3 = graph._relation(ec2, [vc2], [vc2, vc3]),
|
||||
g1 = graph._create(gN1, [dr1, dr3]),
|
||||
g2 = graph._create(gN2, [dr1]);
|
||||
|
||||
|
@ -719,10 +707,10 @@ function GeneralGraphAQLQueriesSuite() {
|
|||
|
||||
var createInclExcl = function() {
|
||||
dropInclExcl();
|
||||
var inc = graph._directedRelation(
|
||||
var inc = graph._relation(
|
||||
included, [v1], [v1, v2]
|
||||
);
|
||||
var exc = graph._directedRelation(
|
||||
var exc = graph._relation(
|
||||
excluded, [v1], [v3]
|
||||
);
|
||||
var g = graph._create(graphName, [inc, exc]);
|
||||
|
@ -998,8 +986,8 @@ function ChainedFluentAQLResultsSuite() {
|
|||
var g;
|
||||
|
||||
var edgeDef = [];
|
||||
edgeDef.push(graph._undirectedRelation(isFriend, user));
|
||||
edgeDef.push(graph._directedRelation(hasBought, user, product));
|
||||
edgeDef.push(graph._relation(isFriend, user, user));
|
||||
edgeDef.push(graph._relation(hasBought, user, product));
|
||||
|
||||
|
||||
var findBoughts = function(result, list) {
|
||||
|
@ -1475,7 +1463,7 @@ function ChainedFluentAQLResultsSuite() {
|
|||
} catch (ignore) {
|
||||
}
|
||||
var g2 = graph._create(emptyGN, [
|
||||
graph._undirectedRelation(emptyEdges, emptyVertices)
|
||||
graph._relation(emptyEdges, emptyVertices, emptyVertices)
|
||||
]);
|
||||
g2[emptyVertices].save({_key: "highlander"});
|
||||
var res = g2._vertices(emptyVertices + "/highlander").edges().restrict(emptyEdges).toArray();
|
||||
|
@ -1894,8 +1882,8 @@ function EdgesAndVerticesSuite() {
|
|||
g = graph._create(
|
||||
unitTestGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(ec1, vc1),
|
||||
graph._directedRelation(ec2,
|
||||
graph._relation(ec1, vc1, vc1),
|
||||
graph._relation(ec2,
|
||||
[vc1, vc2], [vc3, vc4]
|
||||
)
|
||||
)
|
||||
|
@ -1913,7 +1901,7 @@ function EdgesAndVerticesSuite() {
|
|||
graph._create(
|
||||
myGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(myEdgeColName, myVertexColName)
|
||||
graph._relation(myEdgeColName, myVertexColName, myVertexColName)
|
||||
)
|
||||
);
|
||||
graph._drop(myGraphName, true);
|
||||
|
@ -1929,7 +1917,7 @@ function EdgesAndVerticesSuite() {
|
|||
graph._create(
|
||||
myGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(myEdgeColName, myVertexColName)
|
||||
graph._relation(myEdgeColName, myVertexColName, myVertexColName)
|
||||
)
|
||||
);
|
||||
graph._drop(myGraphName);
|
||||
|
@ -1943,7 +1931,7 @@ function EdgesAndVerticesSuite() {
|
|||
graph._create(
|
||||
myGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(ec1, vc1)
|
||||
graph._relation(ec1, vc1, vc1)
|
||||
)
|
||||
);
|
||||
assertTrue(graph._exists(myGraphName));
|
||||
|
@ -1959,7 +1947,7 @@ function EdgesAndVerticesSuite() {
|
|||
graph._create(
|
||||
myGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(ec1, vc2)
|
||||
graph._relation(ec1, vc2, vc2)
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
|
@ -1984,8 +1972,8 @@ function EdgesAndVerticesSuite() {
|
|||
graph._create(
|
||||
myGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(myED, myVD1),
|
||||
graph._undirectedRelation(myED, myVD2)
|
||||
graph._relation(myED, myVD1, myVD1),
|
||||
graph._relation(myED, myVD2, myVD2)
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
|
@ -2185,7 +2173,7 @@ function EdgesAndVerticesSuite() {
|
|||
var g2 = graph._create(
|
||||
myGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(myEC02,
|
||||
graph._relation(myEC02,
|
||||
[ec1], [myVC01]
|
||||
)
|
||||
)
|
||||
|
@ -2236,18 +2224,18 @@ function EdgesAndVerticesSuite() {
|
|||
} catch (ignore) {
|
||||
}
|
||||
|
||||
db._createEdgeCollection(eC1)
|
||||
db._createEdgeCollection(eC2)
|
||||
db._createEdgeCollection(eC3)
|
||||
db._createEdgeCollection(eC4)
|
||||
db._create(vC1)
|
||||
db._create(vC2)
|
||||
db._create(vC3)
|
||||
db._create(vC4)
|
||||
db._createEdgeCollection(eC1);
|
||||
db._createEdgeCollection(eC2);
|
||||
db._createEdgeCollection(eC3);
|
||||
db._createEdgeCollection(eC4);
|
||||
db._create(vC1);
|
||||
db._create(vC2);
|
||||
db._create(vC3);
|
||||
db._create(vC4);
|
||||
var vertex1 = db[vC1].save({});
|
||||
var vertexId1 = vertex1._id;
|
||||
vertexId1 = vertex1._id;
|
||||
var vertex2 = db[vC1].save({});
|
||||
var vertexId2 = vertex2._id;
|
||||
vertexId2 = vertex2._id;
|
||||
var vertex3 = db[vC1].save({});
|
||||
var vertexId3 = vertex3._id;
|
||||
var vertex4 = db[vC1].save({});
|
||||
|
@ -2260,25 +2248,25 @@ function EdgesAndVerticesSuite() {
|
|||
var g1 = graph._create(
|
||||
gN1,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(eC1, [eC4], [vC1])
|
||||
graph._relation(eC1, [eC4], [vC1])
|
||||
)
|
||||
);
|
||||
var g2 = graph._create(
|
||||
gN2,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(eC2, [eC1], [vC2])
|
||||
graph._relation(eC2, [eC1], [vC2])
|
||||
)
|
||||
);
|
||||
var g3 = graph._create(
|
||||
gN3,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(eC3, [eC2], [vC3])
|
||||
graph._relation(eC3, [eC2], [vC3])
|
||||
)
|
||||
);
|
||||
var g4 = graph._create(
|
||||
gN4,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(eC4, [eC3], [vC4])
|
||||
graph._relation(eC4, [eC3], [vC4])
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -2390,7 +2378,7 @@ function GeneralGraphCommonNeighborsSuite() {
|
|||
testGraph = graph._create(
|
||||
"bla3",
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(eColName,
|
||||
graph._relation(eColName,
|
||||
[v1ColName, v2ColName],
|
||||
[v1ColName, v2ColName]
|
||||
)
|
||||
|
@ -2576,7 +2564,7 @@ function OrphanCollectionSuite() {
|
|||
g1 = graph._create(
|
||||
gN1,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(
|
||||
graph._relation(
|
||||
eC1, [vC1], [vC1, vC2]
|
||||
)
|
||||
)
|
||||
|
@ -2584,7 +2572,7 @@ function OrphanCollectionSuite() {
|
|||
g2 = graph._create(
|
||||
gN2,
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation(
|
||||
graph._relation(
|
||||
eC2, [vC3], [vC1]
|
||||
)
|
||||
)
|
||||
|
@ -2791,8 +2779,8 @@ function MeasurementsSuite() {
|
|||
g = graph._create(
|
||||
unitTestGraphName,
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(ec1, vc1),
|
||||
graph._directedRelation(ec2,
|
||||
graph._relation(ec1, vc1, vc1),
|
||||
graph._relation(ec2,
|
||||
[vc1, vc2], [vc3, vc4]
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1923,8 +1923,8 @@ function GeneralGraphTraversalSuite () {
|
|||
cleanUp();
|
||||
|
||||
var edgeDef = [];
|
||||
edgeDef.push(generalGraph._directedRelation(enDir, vnA, vnBDH));
|
||||
edgeDef.push(generalGraph._undirectedRelation(enUndir, [vnBDH, vnCEFGI]));
|
||||
edgeDef.push(generalGraph._relation(enDir, vnA, vnBDH));
|
||||
edgeDef.push(generalGraph._relation(enUndir, [vnBDH, vnCEFGI], [vnBDH, vnCEFGI]));
|
||||
g = generalGraph._create(gn, edgeDef);
|
||||
|
||||
saveVertex(vnA, "A");
|
||||
|
|
|
@ -40,6 +40,15 @@ var assertQueryError = helper.assertQueryError;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ahuacatlQueryGeneralEdgesTestSuite() {
|
||||
|
||||
var v1 = "UnitTestsAhuacatlVertex1";
|
||||
var v2 = "UnitTestsAhuacatlVertex2";
|
||||
var v3 = "UnitTestsAhuacatlVertex3";
|
||||
var v4 = "UnitTestsAhuacatlVertex4";
|
||||
var e1 = "UnitTestsAhuacatlEdge1";
|
||||
var e2 = "UnitTestsAhuacatlEdge2";
|
||||
var or = "UnitTestsAhuacatlOrphan";
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -47,21 +56,21 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
setUp: function () {
|
||||
db._drop("UnitTestsAhuacatlVertex1");
|
||||
db._drop("UnitTestsAhuacatlVertex2");
|
||||
db._drop("UnitTestsAhuacatlVertex3");
|
||||
db._drop("UnitTestsAhuacatlVertex4");
|
||||
db._drop("UnitTestsAhuacatlEdge1");
|
||||
db._drop("UnitTestsAhuacatlEdge2");
|
||||
db._drop("UnitTestsAhuacatlOrphan");
|
||||
db._drop(v1);
|
||||
db._drop(v2);
|
||||
db._drop(v3);
|
||||
db._drop(v4);
|
||||
db._drop(e1);
|
||||
db._drop(e2);
|
||||
db._drop(or);
|
||||
|
||||
var vertex1 = db._create("UnitTestsAhuacatlVertex1");
|
||||
var vertex2 = db._create("UnitTestsAhuacatlVertex2");
|
||||
var vertex3 = db._create("UnitTestsAhuacatlVertex3");
|
||||
var vertex4 = db._create("UnitTestsAhuacatlVertex4");
|
||||
var edge1 = db._createEdgeCollection("UnitTestsAhuacatlEdge1");
|
||||
var edge2 = db._createEdgeCollection("UnitTestsAhuacatlEdge2");
|
||||
var oprhan = db._create("UnitTestsAhuacatlOrphan");
|
||||
var vertex1 = db._create(v1);
|
||||
var vertex2 = db._create(v2);
|
||||
var vertex3 = db._create(v3);
|
||||
var vertex4 = db._create(v4);
|
||||
var edge1 = db._createEdgeCollection(e1);
|
||||
var edge2 = db._createEdgeCollection(e2);
|
||||
var oprhan = db._create(or);
|
||||
|
||||
vertex1.save({ _key: "v1", hugo: true});
|
||||
vertex1.save({ _key: "v2", hugo: true});
|
||||
|
@ -77,14 +86,14 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
|
|||
collection.save(from, to, { what: from.split("/")[1] + "->" + to.split("/")[1] });
|
||||
}
|
||||
|
||||
makeEdge("UnitTestsAhuacatlVertex1/v1", "UnitTestsAhuacatlVertex1/v2", edge1);
|
||||
makeEdge("UnitTestsAhuacatlVertex1/v2", "UnitTestsAhuacatlVertex1/v1", edge1);
|
||||
makeEdge("UnitTestsAhuacatlVertex1/v1", "UnitTestsAhuacatlVertex3/v5", edge2);
|
||||
makeEdge("UnitTestsAhuacatlVertex1/v2", "UnitTestsAhuacatlVertex3/v5", edge2);
|
||||
makeEdge("UnitTestsAhuacatlVertex2/v3", "UnitTestsAhuacatlVertex3/v6", edge2);
|
||||
makeEdge("UnitTestsAhuacatlVertex2/v4", "UnitTestsAhuacatlVertex4/v7", edge2);
|
||||
makeEdge("UnitTestsAhuacatlVertex2/v3", "UnitTestsAhuacatlVertex3/v5", edge2);
|
||||
makeEdge("UnitTestsAhuacatlVertex2/v3", "UnitTestsAhuacatlVertex4/v8", edge2);
|
||||
makeEdge(v1 + "/v1", v1 + "/v2", edge1);
|
||||
makeEdge(v1 + "/v2", v1 + "/v1", edge1);
|
||||
makeEdge(v1 + "/v1", v3 + "/v5", edge2);
|
||||
makeEdge(v1 + "/v2", v3 + "/v5", edge2);
|
||||
makeEdge(v2 + "/v3", v3 + "/v6", edge2);
|
||||
makeEdge(v2 + "/v4", v4 + "/v7", edge2);
|
||||
makeEdge(v2 + "/v3", v3 + "/v5", edge2);
|
||||
makeEdge(v2 + "/v3", v4 + "/v8", edge2);
|
||||
|
||||
try {
|
||||
db._collection("_graphs").remove("_graphs/bla3");
|
||||
|
@ -93,13 +102,13 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
|
|||
graph._create(
|
||||
"bla3",
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"),
|
||||
graph._directedRelation("UnitTestsAhuacatlEdge2",
|
||||
["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"],
|
||||
["UnitTestsAhuacatlVertex3", "UnitTestsAhuacatlVertex4"]
|
||||
graph._relation(e1, v1, v1),
|
||||
graph._relation(e2,
|
||||
[v1, v2],
|
||||
[v3, v4]
|
||||
)
|
||||
),
|
||||
["UnitTestsAhuacatlOrphan"]
|
||||
[or]
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -108,13 +117,13 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
tearDown: function () {
|
||||
db._drop("UnitTestsAhuacatlVertex1");
|
||||
db._drop("UnitTestsAhuacatlVertex2");
|
||||
db._drop("UnitTestsAhuacatlVertex3");
|
||||
db._drop("UnitTestsAhuacatlVertex4");
|
||||
db._drop("UnitTestsAhuacatlEdge1");
|
||||
db._drop("UnitTestsAhuacatlEdge2");
|
||||
db._drop("UnitTestsAhuacatlOrphan");
|
||||
db._drop(v1);
|
||||
db._drop(v2);
|
||||
db._drop(v3);
|
||||
db._drop(v4);
|
||||
db._drop(e1);
|
||||
db._drop(e2);
|
||||
db._drop(or);
|
||||
db._collection("_graphs").remove("_graphs/bla3");
|
||||
},
|
||||
|
||||
|
@ -125,8 +134,8 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
|
|||
testEdgesAny: function () {
|
||||
|
||||
var actual;
|
||||
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'any'}) RETURN e");
|
||||
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex1/v1');
|
||||
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', '" + v1 + "/v1', {direction : 'any'}) RETURN e");
|
||||
assertEqual(actual[0]._id, v1 + '/v1');
|
||||
|
||||
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', {}, {direction : 'any', vertexCollectionRestriction : 'UnitTestsAhuacatlOrphan'}) RETURN e");
|
||||
assertEqual(actual[0]._id, 'UnitTestsAhuacatlOrphan/orphan');
|
||||
|
@ -309,7 +318,7 @@ function ahuacatlQueryGeneralCommonTestSuite() {
|
|||
graph._create(
|
||||
"bla3",
|
||||
graph._edgeDefinitions(
|
||||
graph._directedRelation("UnitTestsAhuacatlEdge1",
|
||||
graph._relation("UnitTestsAhuacatlEdge1",
|
||||
["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"],
|
||||
["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"]
|
||||
)
|
||||
|
@ -496,8 +505,8 @@ function ahuacatlQueryGeneralPathsTestSuite() {
|
|||
var g = graph._create(
|
||||
"bla3",
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"),
|
||||
graph._directedRelation("UnitTestsAhuacatlEdge2",
|
||||
graph._relation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex1"),
|
||||
graph._relation("UnitTestsAhuacatlEdge2",
|
||||
["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"],
|
||||
["UnitTestsAhuacatlVertex3", "UnitTestsAhuacatlVertex4"]
|
||||
)
|
||||
|
@ -725,8 +734,8 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
|
|||
var g = graph._create(
|
||||
"werKenntWen",
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(KenntAnderenBerliner, "UnitTests_Berliner"),
|
||||
graph._directedRelation(KenntAnderen,
|
||||
graph._relation(KenntAnderenBerliner, "UnitTests_Berliner", "UnitTests_Berliner"),
|
||||
graph._relation(KenntAnderen,
|
||||
["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"],
|
||||
["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"]
|
||||
)
|
||||
|
@ -1690,8 +1699,8 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
var g = graph._create(
|
||||
"werKenntWen",
|
||||
graph._edgeDefinitions(
|
||||
graph._undirectedRelation(KenntAnderenBerliner, "UnitTests_Berliner"),
|
||||
graph._directedRelation(KenntAnderen,
|
||||
graph._relation(KenntAnderenBerliner, "UnitTests_Berliner", "UnitTests_Berliner"),
|
||||
graph._relation(KenntAnderen,
|
||||
["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"],
|
||||
["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue