From 237276c18d11f25b170255ee8fa51afd36ed441c Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 3 Jun 2015 17:10:50 +0200 Subject: [PATCH] fixed graph examples --- Documentation/Scripts/generateExamples.py | 2 +- js/common/modules/org/arangodb/general-graph.js | 13 ++++++++----- js/server/modules/org/arangodb/aql.js | 4 +--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Documentation/Scripts/generateExamples.py b/Documentation/Scripts/generateExamples.py index 924e93c978..7e9c1f0814 100644 --- a/Documentation/Scripts/generateExamples.py +++ b/Documentation/Scripts/generateExamples.py @@ -531,7 +531,7 @@ def generateArangoshShutdown(): print ''' if (allErrors.length > 0) { print(allErrors); - throw new Error('troubles during generating documentation data; see above.'); + throw new Error('trouble during generating documentation data; see above.'); } ''' diff --git a/js/common/modules/org/arangodb/general-graph.js b/js/common/modules/org/arangodb/general-graph.js index 830b93e037..00ab8e62c2 100644 --- a/js/common/modules/org/arangodb/general-graph.js +++ b/js/common/modules/org/arangodb/general-graph.js @@ -3057,7 +3057,9 @@ Graph.prototype._commonNeighbors = function(vertex1Example, vertex2Example, opti /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphModuleCommonNeighborsAmount1} /// var examples = require("org/arangodb/graph-examples/example-graph.js"); /// var graph = examples.loadGraph("routeplanner"); -/// graph._countCommonNeighbors({isCapital : true}, {isCapital : true}); +/// var example = { isCapital: true }; +/// var options = { includeData: true }; +/// graph._countCommonNeighbors(example, example, options, options); /// ~ examples.dropGraph("routeplanner"); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @@ -3067,8 +3069,8 @@ Graph.prototype._commonNeighbors = function(vertex1Example, vertex2Example, opti /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphModuleCommonNeighborsAmount2} /// var examples = require("org/arangodb/graph-examples/example-graph.js"); /// var graph = examples.loadGraph("routeplanner"); -/// | graph._countCommonNeighbors('germanCity/Hamburg', {}, {direction : 'outbound', maxDepth : 2}, -/// {direction : 'outbound', maxDepth : 2}); +/// var options = { direction: 'outbound', maxDepth: 2, includeData: true }; +/// graph._countCommonNeighbors('germanCity/Hamburg', {}, options, options); /// ~ examples.dropGraph("routeplanner"); /// @END_EXAMPLE_ARANGOSH_OUTPUT /// @@ -3084,8 +3086,8 @@ Graph.prototype._countCommonNeighbors = function(vertex1Example, vertex2Example, + ',@ex2' + ',@options1' + ',@options2' - + ') FOR a in ATTRIBUTES(e) FOR b in ATTRIBUTES(e[a]) ' - + 'SORT ATTRIBUTES(e)[0] RETURN [a, b, LENGTH(e[a][b]) ]'; + + ') FOR a in ATTRIBUTES(e) FOR b in ATTRIBUTES(e[a]) ' + + 'SORT ATTRIBUTES(e)[0] RETURN [a, b, LENGTH(e[a][b]) ]'; optionsVertex1 = optionsVertex1 || {}; optionsVertex2 = optionsVertex2 || {}; var bindVars = { @@ -3095,6 +3097,7 @@ Graph.prototype._countCommonNeighbors = function(vertex1Example, vertex2Example, "ex1": ex1, "ex2": ex2 }; + var result = db._query(query, bindVars, {count: true}).toArray(), tmp = {}, tmp2={}, returnHash = []; result.forEach(function (r) { diff --git a/js/server/modules/org/arangodb/aql.js b/js/server/modules/org/arangodb/aql.js index 40b50b4077..4a866f2c0d 100644 --- a/js/server/modules/org/arangodb/aql.js +++ b/js/server/modules/org/arangodb/aql.js @@ -7161,7 +7161,7 @@ function AQL_GRAPH_VERTICES (graphName, /// @END_EXAMPLE_ARANGOSH_OUTPUT /// /// A route planner example, all common outbound neighbors of Hamburg with any other location -/// which have a maximal depth of 2 : +/// which have a maximal depth of 2: /// /// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphCommonNeighbors2} /// var examples = require("org/arangodb/graph-examples/example-graph.js"); @@ -7184,9 +7184,7 @@ function AQL_GRAPH_COMMON_NEIGHBORS (graphName, 'use strict'; options1 = options1 || {}; - options1.includeData = false; options2 = options2 || {}; - options2.includeData = false; let graph_module = require("org/arangodb/general-graph"); let graph = graph_module._graph(graphName); let vertexCollections = graph._vertexCollections().map(function (c) { return c.name();});