From 639e657897f8fb225dfe4109a73894a5617e5237 Mon Sep 17 00:00:00 2001 From: gschwab Date: Fri, 20 Jun 2014 08:56:59 +0200 Subject: [PATCH 1/4] renamed _undirectedRelationDefinition(...) -> _undirectedRelation(..) --- .../Users/General-Graphs/Management.mdpp | 2 +- .../js/modules/org/arangodb/general-graph.js | 14 +++--- .../modules/org/arangodb/general-graph.js | 16 +++--- .../arangodb/graph-examples/example-graph.js | 4 +- js/common/tests/shell-general-graph.js | 50 +++++++++---------- js/common/tests/shell-graph-traversal.js | 2 +- js/server/tests/ahuacatl-general-graph.js | 8 +-- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Documentation/Books/Users/General-Graphs/Management.mdpp b/Documentation/Books/Users/General-Graphs/Management.mdpp index 10bbbec594..a1a65bbab8 100644 --- a/Documentation/Books/Users/General-Graphs/Management.mdpp +++ b/Documentation/Books/Users/General-Graphs/Management.mdpp @@ -20,7 +20,7 @@ The edge definitions for a graph is an Array containing arbitrary many directed !SUBSUBSECTION Undirected Relation -@startDocuBlock JSF_general_graph_undirectedRelationDefinition@startDocuBlock +@startDocuBlock JSF_general_graph_undirectedRelationDefinition !SUBSUBSECTION Directed Relation diff --git a/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js b/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js index 190b4e7f06..e4edd9ce4a 100644 --- a/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js +++ b/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js @@ -1299,9 +1299,9 @@ AQLGenerator.prototype.next = function() { // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// -/// @startDocuBlock JSF_general_graph_undirectedRelationDefinition +/// @startDocuBlock JSF_general_graph_undirectedRelation /// -/// `general-graph._undirectedRelationDefinition(relationName, vertexCollections)` +/// `general-graph._undirectedRelation(relationName, vertexCollections)` /// *Define an undirected relation.* /// /// Defines an undirected relation with the name *relationName* using the @@ -1315,24 +1315,24 @@ AQLGenerator.prototype.next = function() { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphUndirectedRelationDefinition1} /// var graph = require("org/arangodb/general-graph"); -/// graph._undirectedRelationDefinition("friend", "user"); +/// graph._undirectedRelation("friend", "user"); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// /// To define a relation between several vertex collections: /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphUndirectedRelationDefinition2} /// var graph = require("org/arangodb/general-graph"); -/// graph._undirectedRelationDefinition("marriage", ["female", "male"]); +/// graph._undirectedRelation("marriage", ["female", "male"]); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @endDocuBlock /// //////////////////////////////////////////////////////////////////////////////// -var _undirectedRelationDefinition = function (relationName, vertexCollections) { +var _undirectedRelation = function (relationName, vertexCollections) { if (arguments.length < 2) { - throw "method _undirectedRelationDefinition expects 2 arguments"; + throw "method _undirectedRelation expects 2 arguments"; } if (typeof relationName !== "string" || relationName === "") { @@ -2933,7 +2933,7 @@ Graph.prototype._PRINT = function(context) { // --SECTION-- MODULE EXPORTS // ----------------------------------------------------------------------------- -exports._undirectedRelationDefinition = _undirectedRelationDefinition; +exports._undirectedRelation = _undirectedRelation; exports._directedRelationDefinition = _directedRelationDefinition; exports._graph = _graph; exports._edgeDefinitions = _edgeDefinitions; diff --git a/js/common/modules/org/arangodb/general-graph.js b/js/common/modules/org/arangodb/general-graph.js index 711da8147b..faa355a12d 100644 --- a/js/common/modules/org/arangodb/general-graph.js +++ b/js/common/modules/org/arangodb/general-graph.js @@ -1299,9 +1299,9 @@ AQLGenerator.prototype.next = function() { // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// -/// @startDocuBlock JSF_general_graph_undirectedRelationDefinition +/// @startDocuBlock JSF_general_graph_undirectedRelation /// -/// `general-graph._undirectedRelationDefinition(relationName, vertexCollections)` +/// `general-graph._undirectedRelation(relationName, vertexCollections)` /// *Define an undirected relation.* /// /// Defines an undirected relation with the name *relationName* using the @@ -1315,24 +1315,24 @@ AQLGenerator.prototype.next = function() { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphUndirectedRelationDefinition1} /// var graph = require("org/arangodb/general-graph"); -/// graph._undirectedRelationDefinition("friend", "user"); +/// graph._undirectedRelation("friend", "user"); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// /// To define a relation between several vertex collections: /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphUndirectedRelationDefinition2} /// var graph = require("org/arangodb/general-graph"); -/// graph._undirectedRelationDefinition("marriage", ["female", "male"]); +/// graph._undirectedRelation("marriage", ["female", "male"]); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @endDocuBlock /// //////////////////////////////////////////////////////////////////////////////// -var _undirectedRelationDefinition = function (relationName, vertexCollections) { +var _undirectedRelation = function (relationName, vertexCollections) { if (arguments.length < 2) { - throw "method _undirectedRelationDefinition expects 2 arguments"; + throw "method _undirectedRelation expects 2 arguments"; } if (typeof relationName !== "string" || relationName === "") { @@ -1533,7 +1533,7 @@ var _extendEdgeDefinitions = function (edgeDefinition) { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphCreateGraph2} /// var graph = require("org/arangodb/general-graph"); -/// g = graph._create("mygraph", [graph._undirectedRelationDefinition("relation", ["male", "female"])], ["sessions"]); +/// g = graph._create("mygraph", [graph._undirectedRelation("relation", ["male", "female"])], ["sessions"]); /// ~ graph._drop("mygraph"); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @@ -3339,7 +3339,7 @@ Graph.prototype._PRINT = function(context) { // --SECTION-- MODULE EXPORTS // ----------------------------------------------------------------------------- -exports._undirectedRelationDefinition = _undirectedRelationDefinition; +exports._undirectedRelation = _undirectedRelation; exports._directedRelationDefinition = _directedRelationDefinition; exports._graph = _graph; exports._edgeDefinitions = _edgeDefinitions; diff --git a/js/common/modules/org/arangodb/graph-examples/example-graph.js b/js/common/modules/org/arangodb/graph-examples/example-graph.js index dc143693fe..d215e2556a 100644 --- a/js/common/modules/org/arangodb/graph-examples/example-graph.js +++ b/js/common/modules/org/arangodb/graph-examples/example-graph.js @@ -33,7 +33,7 @@ var createTraversalExample = function() { var g = Graph._create("knows_graph", - [Graph._undirectedRelationDefinition("knows", "persons")] + [Graph._undirectedRelation("knows", "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._undirectedRelationDefinition("relation", ["female", "male"])); + edgeDefinition.push(Graph._undirectedRelation("relation", ["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"}); diff --git a/js/common/tests/shell-general-graph.js b/js/common/tests/shell-general-graph.js index a3d9e60319..b35fe2dd67 100644 --- a/js/common/tests/shell-general-graph.js +++ b/js/common/tests/shell-general-graph.js @@ -54,7 +54,7 @@ function GeneralGraphCreationSuite() { var vn4 = "UnitTestVerticies4"; var gn = "UnitTestGraph"; var edgeDef = graph._edgeDefinitions( - graph._undirectedRelationDefinition(rn, vn1), + graph._undirectedRelation(rn, vn1), graph._directedRelationDefinition(rn1, [vn1, vn2], [vn3, vn4] ) @@ -110,8 +110,8 @@ function GeneralGraphCreationSuite() { /// @brief test: Graph Creation //////////////////////////////////////////////////////////////////////////////// - test_undirectedRelationDefinition : function () { - var r = graph._undirectedRelationDefinition(rn, [vn1, vn2]); + test_undirectedRelation : function () { + var r = graph._undirectedRelation(rn, [vn1, vn2]); assertEqual(r, { collection: rn, @@ -121,8 +121,8 @@ function GeneralGraphCreationSuite() { }, - test_undirectedRelationDefinitionWithSingleCollection : function () { - var r = graph._undirectedRelationDefinition(rn, vn1); + test_undirectedRelationWithSingleCollection : function () { + var r = graph._undirectedRelation(rn, vn1); assertEqual(r, { collection: rn, @@ -132,9 +132,9 @@ function GeneralGraphCreationSuite() { }, - test_undirectedRelationDefinitionWithMissingName : function () { + test_undirectedRelationWithMissingName : function () { try { - graph._undirectedRelationDefinition("", [vn1, vn2]); + graph._undirectedRelation("", [vn1, vn2]); fail(); } catch (err) { @@ -142,21 +142,21 @@ function GeneralGraphCreationSuite() { } }, - test_undirectedRelationDefinitionWithTooFewArgs : function () { + test_undirectedRelationWithTooFewArgs : function () { try { - graph._undirectedRelationDefinition([vn1, vn2]); + graph._undirectedRelation([vn1, vn2]); fail(); } catch (err) { - assertEqual(err, "method _undirectedRelationDefinition expects 2 arguments"); + assertEqual(err, "method _undirectedRelation expects 2 arguments"); } }, - test_undirectedRelationDefinitionWithInvalidSecondArg : function () { + test_undirectedRelationWithInvalidSecondArg : function () { try { var param = {}; param[vn1] = vn2; - graph._undirectedRelationDefinition(rn, param); + graph._undirectedRelation(rn, param); fail(); } catch (err) { @@ -230,7 +230,7 @@ function GeneralGraphCreationSuite() { //with args assertEqual(graph._edgeDefinitions( - graph._undirectedRelationDefinition(rn, vn1), + graph._undirectedRelation(rn, vn1), graph._directedRelationDefinition(rn1, [vn1, vn2], [vn3, vn4]) ), [ @@ -255,12 +255,12 @@ function GeneralGraphCreationSuite() { //with args var ed =graph._edgeDefinitions( - graph._undirectedRelationDefinition("relationName", "vertexC1"), + graph._undirectedRelation("relationName", "vertexC1"), graph._directedRelationDefinition("relationName", ["vertexC1", "vertexC2"], ["vertexC3", "vertexC4"]) ); graph._extendEdgeDefinitions(ed, - graph._undirectedRelationDefinition("relationName", "vertexC1") + graph._undirectedRelation("relationName", "vertexC1") ); assertEqual(ed, [ { @@ -290,7 +290,7 @@ function GeneralGraphCreationSuite() { var a = graph._create( gn, graph._edgeDefinitions( - graph._undirectedRelationDefinition(rn, vn1), + graph._undirectedRelation(rn, vn1), graph._directedRelationDefinition(rn1, [vn1, vn2], [vn3, vn4]) ) ); @@ -343,7 +343,7 @@ function GeneralGraphCreationSuite() { graph._create( "", graph._edgeDefinitions( - graph._undirectedRelationDefinition("relationName", "vertexC1"), + graph._undirectedRelation("relationName", "vertexC1"), graph._directedRelationDefinition("relationName2", ["vertexC1", "vertexC2"], ["vertexC3", "vertexC4"] ) @@ -949,7 +949,7 @@ function ChainedFluentAQLResultsSuite() { var g; var edgeDef = []; - edgeDef.push(graph._undirectedRelationDefinition(isFriend, user)); + edgeDef.push(graph._undirectedRelation(isFriend, user)); edgeDef.push(graph._directedRelationDefinition(hasBought, user, product)); @@ -1820,7 +1820,7 @@ function EdgesAndVerticesSuite() { g = graph._create( unitTestGraphName, graph._edgeDefinitions( - graph._undirectedRelationDefinition(ec1, vc1), + graph._undirectedRelation(ec1, vc1), graph._directedRelationDefinition(ec2, [vc1, vc2], [vc3, vc4] ) @@ -1839,7 +1839,7 @@ function EdgesAndVerticesSuite() { graph._create( myGraphName, graph._edgeDefinitions( - graph._undirectedRelationDefinition(myEdgeColName, myVertexColName) + graph._undirectedRelation(myEdgeColName, myVertexColName) ) ); graph._drop(myGraphName, true); @@ -1855,7 +1855,7 @@ function EdgesAndVerticesSuite() { graph._create( myGraphName, graph._edgeDefinitions( - graph._undirectedRelationDefinition(myEdgeColName, myVertexColName) + graph._undirectedRelation(myEdgeColName, myVertexColName) ) ); graph._drop(myGraphName); @@ -1869,7 +1869,7 @@ function EdgesAndVerticesSuite() { graph._create( myGraphName, graph._edgeDefinitions( - graph._undirectedRelationDefinition(ec1, vc1) + graph._undirectedRelation(ec1, vc1) ) ); assertTrue(graph._exists(myGraphName)); @@ -1885,7 +1885,7 @@ function EdgesAndVerticesSuite() { graph._create( myGraphName, graph._edgeDefinitions( - graph._undirectedRelationDefinition(ec1, vc2) + graph._undirectedRelation(ec1, vc2) ) ); } catch (e) { @@ -1910,8 +1910,8 @@ function EdgesAndVerticesSuite() { graph._create( myGraphName, graph._edgeDefinitions( - graph._undirectedRelationDefinition(myED, myVD1), - graph._undirectedRelationDefinition(myED, myVD2) + graph._undirectedRelation(myED, myVD1), + graph._undirectedRelation(myED, myVD2) ) ); } catch (e) { diff --git a/js/common/tests/shell-graph-traversal.js b/js/common/tests/shell-graph-traversal.js index 83eda88577..9571b0bb9b 100644 --- a/js/common/tests/shell-graph-traversal.js +++ b/js/common/tests/shell-graph-traversal.js @@ -1925,7 +1925,7 @@ function GeneralGraphTraversalSuite () { var edgeDef = []; edgeDef.push(generalGraph._directedRelationDefinition(enDir, vnA, vnBDH)); - edgeDef.push(generalGraph._undirectedRelationDefinition(enUndir, [vnBDH, vnCEFGI])); + edgeDef.push(generalGraph._undirectedRelation(enUndir, [vnBDH, vnCEFGI])); g = generalGraph._create(gn, edgeDef); saveVertex(vnA, "A"); diff --git a/js/server/tests/ahuacatl-general-graph.js b/js/server/tests/ahuacatl-general-graph.js index e9a329aebd..24b41c33db 100644 --- a/js/server/tests/ahuacatl-general-graph.js +++ b/js/server/tests/ahuacatl-general-graph.js @@ -89,7 +89,7 @@ function ahuacatlQueryGeneralEdgesTestSuite() { graph._create( "bla3", graph._edgeDefinitions( - graph._undirectedRelationDefinition("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"), + graph._undirectedRelation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"), graph._directedRelationDefinition("UnitTestsAhuacatlEdge2", ["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"], ["UnitTestsAhuacatlVertex3", "UnitTestsAhuacatlVertex4"] @@ -493,7 +493,7 @@ function ahuacatlQueryGeneralPathsTestSuite() { var g = graph._create( "bla3", graph._edgeDefinitions( - graph._undirectedRelationDefinition("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"), + graph._undirectedRelation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"), graph._directedRelationDefinition("UnitTestsAhuacatlEdge2", ["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"], ["UnitTestsAhuacatlVertex3", "UnitTestsAhuacatlVertex4"] @@ -661,7 +661,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() { var g = graph._create( "werKenntWen", graph._edgeDefinitions( - graph._undirectedRelationDefinition(KenntAnderenBerliner, "UnitTests_Berliner"), + graph._undirectedRelation(KenntAnderenBerliner, "UnitTests_Berliner"), graph._directedRelationDefinition(KenntAnderen, ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"], ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"] @@ -1622,7 +1622,7 @@ function ahuacatlQueryGeneralCycleSSuite() { var g = graph._create( "werKenntWen", graph._edgeDefinitions( - graph._undirectedRelationDefinition(KenntAnderenBerliner, "UnitTests_Berliner"), + graph._undirectedRelation(KenntAnderenBerliner, "UnitTests_Berliner"), graph._directedRelationDefinition(KenntAnderen, ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"], ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"] From dbe0cbbf7f7e512e10a8606bf30a0320e3c1e9e7 Mon Sep 17 00:00:00 2001 From: gschwab Date: Fri, 20 Jun 2014 09:01:35 +0200 Subject: [PATCH 2/4] renamed _directedRelationDefinition(...) -> _directedRelation(..) --- .../js/modules/org/arangodb/general-graph.js | 38 +++---- .../modules/org/arangodb/general-graph.js | 38 +++---- .../arangodb/graph-examples/example-graph.js | 4 +- js/common/tests/shell-general-graph.js | 98 +++++++++---------- js/common/tests/shell-graph-traversal.js | 2 +- js/server/tests/ahuacatl-general-graph.js | 10 +- 6 files changed, 95 insertions(+), 95 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js b/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js index 3e5a464b02..3b74bfe7ea 100644 --- a/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js +++ b/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js @@ -1356,9 +1356,9 @@ var _undirectedRelation = function (relationName, vertexCollections) { /// Define an directed relation. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -/// @startDocuBlock JSF_general_graph_directedRelationDefinition +/// @startDocuBlock JSF_general_graph_directedRelation /// -/// `general-graph._directedRelationDefinition(relationName, fromVertexCollections, toVertexCollections)` +/// `general-graph._directedRelation(relationName, fromVertexCollections, toVertexCollections)` /// *Define a directed relation.* /// /// The *relationName* defines the name of this relation and references to the underlying edge collection. @@ -1371,18 +1371,18 @@ var _undirectedRelation = function (relationName, vertexCollections) { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphDirectedRelationDefinition} /// var graph = require("org/arangodb/general-graph"); -/// graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); +/// graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @endDocuBlock /// //////////////////////////////////////////////////////////////////////////////// -var _directedRelationDefinition = function ( +var _directedRelation = function ( relationName, fromVertexCollections, toVertexCollections) { if (arguments.length < 3) { - throw "method _directedRelationDefinition expects 3 arguments"; + throw "method _directedRelation expects 3 arguments"; } if (typeof relationName !== "string" || relationName === "") { @@ -1445,8 +1445,8 @@ var _list = function() { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphEdgeDefinitions} /// var graph = require("org/arangodb/general-graph"); -/// directed_relation = graph._directedRelationDefinition("lives_in", "user", "city"); -/// undirected_relation = graph._directedRelationDefinition("knows", "user"); +/// directed_relation = graph._directedRelation("lives_in", "user", "city"); +/// undirected_relation = graph._directedRelation("knows", "user"); /// edgedefinitions = graph._edgeDefinitions(directed_relation, undirected_relation); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @@ -1476,8 +1476,8 @@ var _edgeDefinitions = function () { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphEdgeDefinitionsExtend} /// var graph = require("org/arangodb/general-graph"); -/// directed_relation = graph._directedRelationDefinition("lives_in", "user", "city"); -/// undirected_relation = graph._directedRelationDefinition("knows", "user"); +/// directed_relation = graph._directedRelation("lives_in", "user", "city"); +/// undirected_relation = graph._directedRelation("knows", "user"); /// edgedefinitions = graph._edgeDefinitions(directed_relation); /// edgedefinitions = graph._extendEdgeDefinitions(undirected_relation); /// @END_EXAMPLE_ARANGOSH_OUTPUT @@ -2892,8 +2892,8 @@ Graph.prototype._amountCommonProperties = function(vertex1Example, vertex2Exampl /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__extendEdgeDefinitions} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); -/// var ed2 = graph._directedRelationDefinition("myEC2", ["myVC1"], ["myVC3"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); +/// var ed2 = graph._directedRelation("myEC2", ["myVC1"], ["myVC3"]); /// var g = graph._create("myGraph", [ed1]); /// g._extendEdgeDefinitions(ed2); /// ~ var blub = graph._drop("myGraph", true); @@ -3051,8 +3051,8 @@ var changeEdgeDefinitionsForGraph = function(graph, edgeDefinition, newCollectio /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__editEdgeDefinition} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); -/// var ed2 = graph._directedRelationDefinition("myEC1", ["myVC2"], ["myVC3"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); +/// var ed2 = graph._directedRelation("myEC1", ["myVC2"], ["myVC3"]); /// var g = graph._create("myGraph", [ed1, ed2]); /// g._editEdgeDefinition(ed2, true); /// ~ var blub = graph._drop("myGraph", true); @@ -3123,8 +3123,8 @@ Graph.prototype._editEdgeDefinitions = function(edgeDefinition) { /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__deleteEdgeDefinition} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); -/// var ed2 = graph._directedRelationDefinition("myEC2", ["myVC1"], ["myVC3"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); +/// var ed2 = graph._directedRelation("myEC2", ["myVC1"], ["myVC3"]); /// var g = graph._create("myGraph", [ed1, ed2]); /// g._deleteEdgeDefinition("myEC1"); /// ~ var blub = graph._drop("myGraph", true); @@ -3189,7 +3189,7 @@ Graph.prototype._deleteEdgeDefinition = function(edgeCollection) { /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__addVertexCollection} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); /// var g = graph._create("myGraph", [ed1]); /// g._addVertexCollection("myVC3", true); /// ~ var blub = graph._drop("myGraph", true); @@ -3243,7 +3243,7 @@ Graph.prototype._addVertexCollection = function(vertexCollectionName, createColl /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__orphanCollections} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); /// var g = graph._create("myGraph", [ed1]); /// g._addVertexCollection("myVC3", true); /// g._orphanCollections(); @@ -3274,7 +3274,7 @@ Graph.prototype._orphanCollections = function() { /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__removeVertexCollections} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); /// var g = graph._create("myGraph", [ed1]); /// g._addVertexCollection("myVC3", true); /// g._addVertexCollection("myVC4", true); @@ -3338,7 +3338,7 @@ Graph.prototype._PRINT = function(context) { // ----------------------------------------------------------------------------- exports._undirectedRelation = _undirectedRelation; -exports._directedRelationDefinition = _directedRelationDefinition; +exports._directedRelation = _directedRelation; exports._graph = _graph; exports._edgeDefinitions = _edgeDefinitions; exports._extendEdgeDefinitions = _extendEdgeDefinitions; diff --git a/js/common/modules/org/arangodb/general-graph.js b/js/common/modules/org/arangodb/general-graph.js index faa355a12d..5c3684984f 100644 --- a/js/common/modules/org/arangodb/general-graph.js +++ b/js/common/modules/org/arangodb/general-graph.js @@ -1355,9 +1355,9 @@ var _undirectedRelation = function (relationName, vertexCollections) { /// Define an directed relation. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -/// @startDocuBlock JSF_general_graph_directedRelationDefinition +/// @startDocuBlock JSF_general_graph_directedRelation /// -/// `general-graph._directedRelationDefinition(relationName, fromVertexCollections, toVertexCollections)` +/// `general-graph._directedRelation(relationName, fromVertexCollections, toVertexCollections)` /// *Define a directed relation.* /// /// The *relationName* defines the name of this relation and references to the underlying edge collection. @@ -1370,18 +1370,18 @@ var _undirectedRelation = function (relationName, vertexCollections) { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphDirectedRelationDefinition} /// var graph = require("org/arangodb/general-graph"); -/// graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); +/// graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @endDocuBlock /// //////////////////////////////////////////////////////////////////////////////// -var _directedRelationDefinition = function ( +var _directedRelation = function ( relationName, fromVertexCollections, toVertexCollections) { if (arguments.length < 3) { - throw "method _directedRelationDefinition expects 3 arguments"; + throw "method _directedRelation expects 3 arguments"; } if (typeof relationName !== "string" || relationName === "") { @@ -1444,8 +1444,8 @@ var _list = function() { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphEdgeDefinitions} /// var graph = require("org/arangodb/general-graph"); -/// directed_relation = graph._directedRelationDefinition("lives_in", "user", "city"); -/// undirected_relation = graph._directedRelationDefinition("knows", "user"); +/// directed_relation = graph._directedRelation("lives_in", "user", "city"); +/// undirected_relation = graph._directedRelation("knows", "user"); /// edgedefinitions = graph._edgeDefinitions(directed_relation, undirected_relation); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @@ -1475,8 +1475,8 @@ var _edgeDefinitions = function () { /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphEdgeDefinitionsExtend} /// var graph = require("org/arangodb/general-graph"); -/// directed_relation = graph._directedRelationDefinition("lives_in", "user", "city"); -/// undirected_relation = graph._directedRelationDefinition("knows", "user"); +/// directed_relation = graph._directedRelation("lives_in", "user", "city"); +/// undirected_relation = graph._directedRelation("knows", "user"); /// edgedefinitions = graph._edgeDefinitions(directed_relation); /// edgedefinitions = graph._extendEdgeDefinitions(undirected_relation); /// @END_EXAMPLE_ARANGOSH_OUTPUT @@ -2894,8 +2894,8 @@ Graph.prototype._amountCommonProperties = function(vertex1Example, vertex2Exampl /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__extendEdgeDefinitions} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); -/// var ed2 = graph._directedRelationDefinition("myEC2", ["myVC1"], ["myVC3"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); +/// var ed2 = graph._directedRelation("myEC2", ["myVC1"], ["myVC3"]); /// var g = graph._create("myGraph", [ed1]); /// g._extendEdgeDefinitions(ed2); /// ~ var blub = graph._drop("myGraph", true); @@ -3053,8 +3053,8 @@ var changeEdgeDefinitionsForGraph = function(graph, edgeDefinition, newCollectio /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__editEdgeDefinition} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); -/// var ed2 = graph._directedRelationDefinition("myEC1", ["myVC2"], ["myVC3"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); +/// var ed2 = graph._directedRelation("myEC1", ["myVC2"], ["myVC3"]); /// var g = graph._create("myGraph", [ed1, ed2]); /// g._editEdgeDefinition(ed2, true); /// ~ var blub = graph._drop("myGraph", true); @@ -3125,8 +3125,8 @@ Graph.prototype._editEdgeDefinitions = function(edgeDefinition) { /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__deleteEdgeDefinition} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); -/// var ed2 = graph._directedRelationDefinition("myEC2", ["myVC1"], ["myVC3"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); +/// var ed2 = graph._directedRelation("myEC2", ["myVC1"], ["myVC3"]); /// var g = graph._create("myGraph", [ed1, ed2]); /// g._deleteEdgeDefinition("myEC1"); /// ~ var blub = graph._drop("myGraph", true); @@ -3191,7 +3191,7 @@ Graph.prototype._deleteEdgeDefinition = function(edgeCollection) { /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__addVertexCollection} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); /// var g = graph._create("myGraph", [ed1]); /// g._addVertexCollection("myVC3", true); /// ~ var blub = graph._drop("myGraph", true); @@ -3245,7 +3245,7 @@ Graph.prototype._addVertexCollection = function(vertexCollectionName, createColl /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__orphanCollections} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); /// var g = graph._create("myGraph", [ed1]); /// g._addVertexCollection("myVC3", true); /// g._orphanCollections(); @@ -3276,7 +3276,7 @@ Graph.prototype._orphanCollections = function() { /// @EXAMPLE_ARANGOSH_OUTPUT{general_graph__removeVertexCollections} /// var graph = require("org/arangodb/general-graph") /// ~ if (graph._exists("myGraph")){var blub = graph._drop("myGraph", true);} -/// var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]); +/// var ed1 = graph._directedRelation("myEC1", ["myVC1"], ["myVC2"]); /// var g = graph._create("myGraph", [ed1]); /// g._addVertexCollection("myVC3", true); /// g._addVertexCollection("myVC4", true); @@ -3340,7 +3340,7 @@ Graph.prototype._PRINT = function(context) { // ----------------------------------------------------------------------------- exports._undirectedRelation = _undirectedRelation; -exports._directedRelationDefinition = _directedRelationDefinition; +exports._directedRelation = _directedRelation; exports._graph = _graph; exports._edgeDefinitions = _edgeDefinitions; exports._extendEdgeDefinitions = _extendEdgeDefinitions; diff --git a/js/common/modules/org/arangodb/graph-examples/example-graph.js b/js/common/modules/org/arangodb/graph-examples/example-graph.js index d215e2556a..bd0c790b2c 100644 --- a/js/common/modules/org/arangodb/graph-examples/example-graph.js +++ b/js/common/modules/org/arangodb/graph-examples/example-graph.js @@ -65,8 +65,8 @@ var createRoutePlannerGraph = function() { var edgeDefinition = []; - edgeDefinition.push(Graph._directedRelationDefinition("highway", ["city"], ["city"])); - edgeDefinition.push(Graph._directedRelationDefinition( + edgeDefinition.push(Graph._directedRelation("highway", ["city"], ["city"])); + edgeDefinition.push(Graph._directedRelation( "road", ["village", "city"], ["village", "city"]) ); var g = Graph._create("routeplanner", edgeDefinition); diff --git a/js/common/tests/shell-general-graph.js b/js/common/tests/shell-general-graph.js index b35fe2dd67..ccd83a241a 100644 --- a/js/common/tests/shell-general-graph.js +++ b/js/common/tests/shell-general-graph.js @@ -55,7 +55,7 @@ function GeneralGraphCreationSuite() { var gn = "UnitTestGraph"; var edgeDef = graph._edgeDefinitions( graph._undirectedRelation(rn, vn1), - graph._directedRelationDefinition(rn1, + graph._directedRelation(rn1, [vn1, vn2], [vn3, vn4] ) ); @@ -164,8 +164,8 @@ function GeneralGraphCreationSuite() { } }, - test_directedRelationDefinition : function () { - var r = graph._directedRelationDefinition(rn, + test_directedRelation : function () { + var r = graph._directedRelation(rn, [vn1, vn2], [vn3, vn4]); assertEqual(r, { @@ -176,9 +176,9 @@ function GeneralGraphCreationSuite() { }, - test_directedRelationDefinitionWithMissingName : function () { + test_directedRelationWithMissingName : function () { try { - graph._directedRelationDefinition("", + graph._directedRelation("", [vn1, vn2], [vn3, vn4]); fail(); } @@ -187,21 +187,21 @@ function GeneralGraphCreationSuite() { } }, - test_directedRelationDefinitionWithTooFewArgs : function () { + test_directedRelationWithTooFewArgs : function () { try { - graph._directedRelationDefinition([vn1, vn2], [vn3, vn4]); + graph._directedRelation([vn1, vn2], [vn3, vn4]); fail(); } catch (err) { - assertEqual(err, "method _directedRelationDefinition expects 3 arguments"); + assertEqual(err, "method _directedRelation expects 3 arguments"); } }, - test_directedRelationDefinitionWithInvalidSecondArg : function () { + test_directedRelationWithInvalidSecondArg : function () { try { var param = {}; param[vn1] = vn2; - graph._directedRelationDefinition(rn, param, vn3); + graph._directedRelation(rn, param, vn3); fail(); } catch (err) { @@ -211,11 +211,11 @@ function GeneralGraphCreationSuite() { }, - test_directedRelationDefinitionWithInvalidThirdArg : function () { + test_directedRelationWithInvalidThirdArg : function () { try { var param = {}; param[vn1] = vn2; - graph._directedRelationDefinition(rn, vn3, param); + graph._directedRelation(rn, vn3, param); fail(); } catch (err) { @@ -231,7 +231,7 @@ function GeneralGraphCreationSuite() { //with args assertEqual(graph._edgeDefinitions( graph._undirectedRelation(rn, vn1), - graph._directedRelationDefinition(rn1, + graph._directedRelation(rn1, [vn1, vn2], [vn3, vn4]) ), [ { @@ -256,7 +256,7 @@ function GeneralGraphCreationSuite() { //with args var ed =graph._edgeDefinitions( graph._undirectedRelation("relationName", "vertexC1"), - graph._directedRelationDefinition("relationName", + graph._directedRelation("relationName", ["vertexC1", "vertexC2"], ["vertexC3", "vertexC4"]) ); graph._extendEdgeDefinitions(ed, @@ -291,7 +291,7 @@ function GeneralGraphCreationSuite() { gn, graph._edgeDefinitions( graph._undirectedRelation(rn, vn1), - graph._directedRelationDefinition(rn1, [vn1, vn2], [vn3, vn4]) + graph._directedRelation(rn1, [vn1, vn2], [vn3, vn4]) ) ); assertTrue(a.__vertexCollections.hasOwnProperty(vn1)); @@ -344,7 +344,7 @@ function GeneralGraphCreationSuite() { "", graph._edgeDefinitions( graph._undirectedRelation("relationName", "vertexC1"), - graph._directedRelationDefinition("relationName2", + graph._directedRelation("relationName2", ["vertexC1", "vertexC2"], ["vertexC3", "vertexC4"] ) ) @@ -420,7 +420,7 @@ function GeneralGraphCreationSuite() { if(graph._exists(gn)) { graph._drop(gn, true); } - var edgeDef2 = [graph._directedRelationDefinition(rn, vn1, vn2)]; + var edgeDef2 = [graph._directedRelation(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; @@ -458,7 +458,7 @@ function GeneralGraphCreationSuite() { test_deleteEdgeDefinitionFromExistingGraph1: function() { - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]), g1 = graph._create(gN1, [dr1]); try { @@ -474,9 +474,9 @@ function GeneralGraphCreationSuite() { test_deleteEdgeDefinitionFromExistingGraph2: function() { - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]), - dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]), - dr3 = graph._directedRelationDefinition(ec3, [vc4], [vc5]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]), + dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]), + dr3 = graph._directedRelation(ec3, [vc4], [vc5]), g1 = graph._create(gN1, [dr1, dr2, dr3]); assertEqual([dr1, dr2, dr3], g1.__edgeDefinitions); @@ -496,8 +496,8 @@ function GeneralGraphCreationSuite() { } catch(ignore) { } - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc2]), - dr2 = graph._directedRelationDefinition(ec1, [vc2], [vc3]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc2]), + dr2 = graph._directedRelation(ec1, [vc2], [vc3]), g1 = graph._create(gN1, [dr1]); try { @@ -518,9 +518,9 @@ function GeneralGraphCreationSuite() { test_extendEdgeDefinitionFromExistingGraph2: function() { - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]), - dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]), - dr2a = graph._directedRelationDefinition(ec2, [vc3], [vc4]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]), + dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]), + dr2a = graph._directedRelation(ec2, [vc3], [vc4]), g1 = graph._create(gN1, [dr1]), g2 = graph._create(gN2, [dr2]); @@ -554,9 +554,9 @@ function GeneralGraphCreationSuite() { } catch(ignore) { } - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]), - dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]), - dr3 = graph._directedRelationDefinition(ec3, [vc3], [vc4]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]), + dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]), + dr3 = graph._directedRelation(ec3, [vc3], [vc4]), g1 = graph._create(gN1, [dr1]), g2 = graph._create(gN2, [dr2]); @@ -572,8 +572,8 @@ function GeneralGraphCreationSuite() { }, test_editEdgeDefinitionFromExistingGraph1: function() { - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]), - dr2 = graph._directedRelationDefinition(ec2, [vc3], [vc4, vc5]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]), + dr2 = graph._directedRelation(ec2, [vc3], [vc4, vc5]), g1 = graph._create(gN1, [dr1]); try { @@ -589,9 +589,9 @@ function GeneralGraphCreationSuite() { test_editEdgeDefinitionFromExistingGraph2: function() { - var dr1 = graph._directedRelationDefinition(ec1, [vc1, vc2], [vc3, vc4]), - dr2 = graph._directedRelationDefinition(ec2, [vc1], [vc4]), - dr3 = graph._directedRelationDefinition(ec1, [vc5], [vc5]), + var dr1 = graph._directedRelation(ec1, [vc1, vc2], [vc3, vc4]), + dr2 = graph._directedRelation(ec2, [vc1], [vc4]), + dr3 = graph._directedRelation(ec1, [vc5], [vc5]), g1 = graph._create(gN1, [dr1, dr2]), g2 = graph._create(gN2, [dr1]); @@ -611,9 +611,9 @@ function GeneralGraphCreationSuite() { test_editEdgeDefinitionFromExistingGraph3: function() { - var dr1 = graph._directedRelationDefinition(ec1, [vc1], [vc1, vc2]), - dr2 = graph._directedRelationDefinition(ec1, [vc3], [vc4, vc5]), - dr3 = graph._directedRelationDefinition(ec2, [vc2], [vc2, vc3]), + var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]), + dr2 = graph._directedRelation(ec1, [vc3], [vc4, vc5]), + dr3 = graph._directedRelation(ec2, [vc2], [vc2, vc3]), g1 = graph._create(gN1, [dr1, dr3]), g2 = graph._create(gN2, [dr1]); @@ -670,10 +670,10 @@ function GeneralGraphAQLQueriesSuite() { var createInclExcl = function() { dropInclExcl(); - var inc = graph._directedRelationDefinition( + var inc = graph._directedRelation( included, [v1], [v1, v2] ); - var exc = graph._directedRelationDefinition( + var exc = graph._directedRelation( excluded, [v1], [v3] ); var g = graph._create(graphName, [inc, exc]); @@ -950,7 +950,7 @@ function ChainedFluentAQLResultsSuite() { var edgeDef = []; edgeDef.push(graph._undirectedRelation(isFriend, user)); - edgeDef.push(graph._directedRelationDefinition(hasBought, user, product)); + edgeDef.push(graph._directedRelation(hasBought, user, product)); var findBoughts = function(result, list) { @@ -1821,7 +1821,7 @@ function EdgesAndVerticesSuite() { unitTestGraphName, graph._edgeDefinitions( graph._undirectedRelation(ec1, vc1), - graph._directedRelationDefinition(ec2, + graph._directedRelation(ec2, [vc1, vc2], [vc3, vc4] ) ) @@ -2083,7 +2083,7 @@ function EdgesAndVerticesSuite() { var g2 = graph._create( myGraphName, graph._edgeDefinitions( - graph._directedRelationDefinition(myEC02, + graph._directedRelation(myEC02, [ec1], [myVC01] ) ) @@ -2158,25 +2158,25 @@ function EdgesAndVerticesSuite() { var g1 = graph._create( gN1, graph._edgeDefinitions( - graph._directedRelationDefinition(eC1, [eC4], [vC1]) + graph._directedRelation(eC1, [eC4], [vC1]) ) ); var g2 = graph._create( gN2, graph._edgeDefinitions( - graph._directedRelationDefinition(eC2, [eC1], [vC2]) + graph._directedRelation(eC2, [eC1], [vC2]) ) ); var g3 = graph._create( gN3, graph._edgeDefinitions( - graph._directedRelationDefinition(eC3, [eC2], [vC3]) + graph._directedRelation(eC3, [eC2], [vC3]) ) ); var g4 = graph._create( gN4, graph._edgeDefinitions( - graph._directedRelationDefinition(eC4, [eC3], [vC4]) + graph._directedRelation(eC4, [eC3], [vC4]) ) ); @@ -2288,7 +2288,7 @@ function GeneralGraphCommonNeighborsSuite() { testGraph = graph._create( "bla3", graph._edgeDefinitions( - graph._directedRelationDefinition(eColName, + graph._directedRelation(eColName, [v1ColName, v2ColName], [v1ColName, v2ColName] ) @@ -2487,7 +2487,7 @@ function OrphanCollectionSuite() { g1 = graph._create( gN1, graph._edgeDefinitions( - graph._directedRelationDefinition( + graph._directedRelation( eC1, [vC1], [vC1, vC2] ) ) @@ -2495,7 +2495,7 @@ function OrphanCollectionSuite() { g2 = graph._create( gN2, graph._edgeDefinitions( - graph._directedRelationDefinition( + graph._directedRelation( eC2, [vC3], [vC1] ) ) diff --git a/js/common/tests/shell-graph-traversal.js b/js/common/tests/shell-graph-traversal.js index 9571b0bb9b..8e6bfd29a1 100644 --- a/js/common/tests/shell-graph-traversal.js +++ b/js/common/tests/shell-graph-traversal.js @@ -1924,7 +1924,7 @@ function GeneralGraphTraversalSuite () { cleanUp(); var edgeDef = []; - edgeDef.push(generalGraph._directedRelationDefinition(enDir, vnA, vnBDH)); + edgeDef.push(generalGraph._directedRelation(enDir, vnA, vnBDH)); edgeDef.push(generalGraph._undirectedRelation(enUndir, [vnBDH, vnCEFGI])); g = generalGraph._create(gn, edgeDef); diff --git a/js/server/tests/ahuacatl-general-graph.js b/js/server/tests/ahuacatl-general-graph.js index 24b41c33db..8ebd2d4572 100644 --- a/js/server/tests/ahuacatl-general-graph.js +++ b/js/server/tests/ahuacatl-general-graph.js @@ -90,7 +90,7 @@ function ahuacatlQueryGeneralEdgesTestSuite() { "bla3", graph._edgeDefinitions( graph._undirectedRelation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"), - graph._directedRelationDefinition("UnitTestsAhuacatlEdge2", + graph._directedRelation("UnitTestsAhuacatlEdge2", ["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"], ["UnitTestsAhuacatlVertex3", "UnitTestsAhuacatlVertex4"] ) @@ -303,7 +303,7 @@ function ahuacatlQueryGeneralCommonTestSuite() { graph._create( "bla3", graph._edgeDefinitions( - graph._directedRelationDefinition("UnitTestsAhuacatlEdge1", + graph._directedRelation("UnitTestsAhuacatlEdge1", ["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"], ["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"] ) @@ -494,7 +494,7 @@ function ahuacatlQueryGeneralPathsTestSuite() { "bla3", graph._edgeDefinitions( graph._undirectedRelation("UnitTestsAhuacatlEdge1", "UnitTestsAhuacatlVertex1"), - graph._directedRelationDefinition("UnitTestsAhuacatlEdge2", + graph._directedRelation("UnitTestsAhuacatlEdge2", ["UnitTestsAhuacatlVertex1", "UnitTestsAhuacatlVertex2"], ["UnitTestsAhuacatlVertex3", "UnitTestsAhuacatlVertex4"] ) @@ -662,7 +662,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() { "werKenntWen", graph._edgeDefinitions( graph._undirectedRelation(KenntAnderenBerliner, "UnitTests_Berliner"), - graph._directedRelationDefinition(KenntAnderen, + graph._directedRelation(KenntAnderen, ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"], ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"] ) @@ -1623,7 +1623,7 @@ function ahuacatlQueryGeneralCycleSSuite() { "werKenntWen", graph._edgeDefinitions( graph._undirectedRelation(KenntAnderenBerliner, "UnitTests_Berliner"), - graph._directedRelationDefinition(KenntAnderen, + graph._directedRelation(KenntAnderen, ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"], ["UnitTests_Hamburger", "UnitTests_Frankfurter", "UnitTests_Berliner", "UnitTests_Leipziger"] ) From d1f17342c66f8001e0f5961ae2f5608802acb5af Mon Sep 17 00:00:00 2001 From: gschwab Date: Fri, 20 Jun 2014 09:09:13 +0200 Subject: [PATCH 3/4] renamed _[un]directedRelationDefinition(...) -> _[un]directedRelation(..) --- .../Books/Users/General-Graphs/Management.mdpp | 10 +++++----- .../Users/General-Graphs/Management.orig.mdpp | 10 +++++----- Documentation/RefManual/JSModuleGeneralGraph.md | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Documentation/Books/Users/General-Graphs/Management.mdpp b/Documentation/Books/Users/General-Graphs/Management.mdpp index a1a65bbab8..99af161789 100644 --- a/Documentation/Books/Users/General-Graphs/Management.mdpp +++ b/Documentation/Books/Users/General-Graphs/Management.mdpp @@ -20,11 +20,11 @@ The edge definitions for a graph is an Array containing arbitrary many directed !SUBSUBSECTION Undirected Relation -@startDocuBlock JSF_general_graph_undirectedRelationDefinition +@startDocuBlock JSF_general_graph_undirectedRelation !SUBSUBSECTION Directed Relation -@startDocuBlock JSF_general_graph_directedRelationDefinition +@startDocuBlock JSF_general_graph_directedRelation !SUBSECTION Orphan Collections @@ -58,8 +58,8 @@ Example Call: ```js > var graph = require("org/arangodb/graph"); > var edgeDefinitions = graph._edgeDefinitions(); -> graph._extendEdgeDefinitions(edgeDefinitions, graph._undirectedRelationDefinition("friend_of", ["Customer"])); -> graph._extendEdgeDefinitions(edgeDefinitions, graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); +> graph._extendEdgeDefinitions(edgeDefinitions, graph._undirectedRelation("friend_of", ["Customer"])); +> graph._extendEdgeDefinitions(edgeDefinitions, graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); > graph._create("myStore", edgeDefinitions); { _id: "_graphs/123", @@ -72,7 +72,7 @@ alternative call: ```js > var graph = require("org/arangodb/graph"); -> var edgeDefinitions = graph._edgeDefinitions(graph._undirectedRelationDefinition("friend_of", ["Customer"]), graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); +> var edgeDefinitions = graph._edgeDefinitions(graph._undirectedRelation("friend_of", ["Customer"]), graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); > graph._create("myStore", edgeDefinitions); { _id: "_graphs/123", diff --git a/Documentation/Books/Users/General-Graphs/Management.orig.mdpp b/Documentation/Books/Users/General-Graphs/Management.orig.mdpp index 667baa24f1..f41a68fe77 100644 --- a/Documentation/Books/Users/General-Graphs/Management.orig.mdpp +++ b/Documentation/Books/Users/General-Graphs/Management.orig.mdpp @@ -20,11 +20,11 @@ The edge definitions for a graph is an Array containing arbitrary many directed !SUBSUBSECTION Undirected Relation - + !SUBSUBSECTION Directed Relation - + !SUBSECTION Orphan Collections @@ -58,8 +58,8 @@ Example Call: ```js > var graph = require("org/arangodb/graph"); > var edgeDefinitions = graph._edgeDefinitions(); -> graph._extendEdgeDefinitions(edgeDefinitions, graph._undirectedRelationDefinition("friend_of", ["Customer"])); -> graph._extendEdgeDefinitions(edgeDefinitions, graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); +> graph._extendEdgeDefinitions(edgeDefinitions, graph._undirectedRelation("friend_of", ["Customer"])); +> graph._extendEdgeDefinitions(edgeDefinitions, graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); > graph._create("myStore", edgeDefinitions); { _id: "_graphs/123", @@ -72,7 +72,7 @@ alternative call: ```js > var graph = require("org/arangodb/graph"); -> var edgeDefinitions = graph._edgeDefinitions(graph._undirectedRelationDefinition("friend_of", ["Customer"]), graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); +> var edgeDefinitions = graph._edgeDefinitions(graph._undirectedRelation("friend_of", ["Customer"]), graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); > graph._create("myStore", edgeDefinitions); { _id: "_graphs/123", diff --git a/Documentation/RefManual/JSModuleGeneralGraph.md b/Documentation/RefManual/JSModuleGeneralGraph.md index 34f0844183..a3d60efd9c 100644 --- a/Documentation/RefManual/JSModuleGeneralGraph.md +++ b/Documentation/RefManual/JSModuleGeneralGraph.md @@ -67,10 +67,10 @@ To add further edge definitions to the array one must call: #### Undirected Relation -@copydetails JSF_general_graph_undirectedRelationDefinition +@copydetails JSF_general_graph_undirectedRelation ```js -graph._undirectedRelationDefinition(relationName, vertexCollections); +graph._undirectedRelation(relationName, vertexCollections); ``` Define an undirected relation. @@ -80,7 +80,7 @@ Relations are allowed in both directions among all collections in *vertexCollect Example Call: ```js -> graph._undirectedRelationDefinition("eats", ["Human", "Animal"]); +> graph._undirectedRelation("eats", ["Human", "Animal"]); { collection: "eats", from: ["Human", "Animal"], @@ -91,7 +91,7 @@ Example Call: #### Directed Relation ```js -graph._directedRelationDefinition(relationName, fromVertexCollections, toVertexCollections); +graph._directedRelation(relationName, fromVertexCollections, toVertexCollections); ``` Define a directed relation. @@ -102,7 +102,7 @@ Relations are only allowed in the direction from any collection in *fromVertexCo Example Call: ```js -> graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); +> graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); { collection: "has_bought", from: ["Customer", "Company"], @@ -118,8 +118,8 @@ Example Call: ```js > var graph = require("org/arangodb/graph"); > var edgeDefinitions = graph._edgeDefinitions(); -> graph._extendEdgeDefinitions(edgeDefinitions, graph._undirectedRelationDefinition("friend_of", ["Customer"])); -> graph._extendEdgeDefinitions(edgeDefinitions, graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); +> graph._extendEdgeDefinitions(edgeDefinitions, graph._undirectedRelation("friend_of", ["Customer"])); +> graph._extendEdgeDefinitions(edgeDefinitions, graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); > graph._create("myStore", edgeDefinitions); { _id: "_graphs/123", @@ -132,7 +132,7 @@ alternative call: ```js > var graph = require("org/arangodb/graph"); -> var edgeDefinitions = graph._edgeDefinitions(graph._undirectedRelationDefinition("friend_of", ["Customer"]), graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); +> var edgeDefinitions = graph._edgeDefinitions(graph._undirectedRelation("friend_of", ["Customer"]), graph._directedRelation("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"])); > graph._create("myStore", edgeDefinitions); { _id: "_graphs/123", From 6bc1a282f286bf67b6b58e17aa133648d925c223 Mon Sep 17 00:00:00 2001 From: gschwab Date: Fri, 20 Jun 2014 09:27:23 +0200 Subject: [PATCH 4/4] some docu changes --- Documentation/Books/Users/General-Graphs/README.mdpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Documentation/Books/Users/General-Graphs/README.mdpp b/Documentation/Books/Users/General-Graphs/README.mdpp index 36c91fa1d1..9b060979c7 100644 --- a/Documentation/Books/Users/General-Graphs/README.mdpp +++ b/Documentation/Books/Users/General-Graphs/README.mdpp @@ -1,6 +1,6 @@ -!CHAPTER General Graphs +!CHAPTER Graphs -This chapter describes the multi-collection graph module. +This chapter describes the general-graph module. It allows you to define a graph that is spread across several edge and document collections. This allows you to structure your models in line with your domain and group them logically in collections and giving you the power to query them in the same graph queries. There is no need to include the referenced collections within the query, this module will handle it for you. @@ -8,7 +8,6 @@ There is no need to include the referenced collections within the query, this mo !SECTION First Steps with Graphs A Graph consists of *vertices* and *edges*. Edges are stored as documents in *edge -collections*. A vertex can be a document of a *document collection* or of an edge -collection (so edges can be used as vertices). Which collections are used within +collections*. In general a vertex is stored in a document collection. Which collections are used within a graph is defined via *edge definitions*. A graph can have an arbitrary number of edge definitions.