diff --git a/Documentation/Books/Users/General-Graphs/Management.mdpp b/Documentation/Books/Users/General-Graphs/Management.mdpp
index 4680e145f8..a588aecaa1 100644
--- a/Documentation/Books/Users/General-Graphs/Management.mdpp
+++ b/Documentation/Books/Users/General-Graphs/Management.mdpp
@@ -1,39 +1,59 @@
!CHAPTER Graph Management
-!SECTION Create a graph
+In order to create a graph the philosophy of handling the graph content has to introduced.
+A graph contains a set of edge definitions each referring to one edge collection and
+defining constraints on the vertex collections used as start and end points of the edges.
+Furthermore a graph can contain an arbitrary amount of vertex collections, called orphan collections, that are not used in any edge definition but should be managed by the graph.
+In order to create a graph the functionality to create edge definitions has to be introduced first:
-
+!SECTION Edge Definitions
-The creation of a graph requires the name of the graph and a definition of its edges.
+The edge definitions for a graph is an Array containing arbitrary many directed and/or undirected relations as defined below.
-For every type of edge definition a convenience method exists that can be used to create a graph.
+!SUBSECTION Initialize the list
-```js
-> var graph = require("org/arangodb/graph");
+
+The edge definitions for a graph is an array containing arbitrary many directed
+and/or undirected relations as defined below.
+The list of edge definitions of a graph can be managed by the graph module itself.
+This function is the entry point for the management and will return the correct list.
+
+@EXAMPLES
+
+
-> var g = graph._create(graphName, edgeDefinitions);
```
-
-There are different types of edge defintions:
-
-!SUBSECTION Edge Definitions
-
-
-
-
-To add further edge definitions to the array one must call:
-
-```js
-> graph._extendEdgeDefinitions(edgeDefinitions, edgeDefinition1,......edgeDefinitionN);
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> directed-relation = graph._directedRelationDefinition("lives_in", "user", "city");
+ReferenceError: Invalid left-hand side in assignment
```
+
+
+!SUBSECTION Extend the list
+
+
+
+In order to add more edge definitions to the graph before creating
+this function can be used to add more definitions to the initial list.
+
+@EXAMPLES
+
+
+```
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> directed-relation = graph._directedRelationDefinition("lives_in", "user", "city");
+ReferenceError: Invalid left-hand side in assignment
+```
+
!SUBSUBSECTION Undirected Relation
+
+
`general-graph._undirectedRelationDefinition(relationName, vertexCollections)`
*Define an undirected relation.*
-
Defines an undirected relation with the name *relationName* using the
list of *vertexCollections*. This relation allows the user to store
edges in any direction between any pair of vertices within the
@@ -81,10 +101,10 @@ arangosh> graph._undirectedRelationDefinition("marriage", ["female", "male"]);
!SUBSUBSECTION Directed Relation
+
`general-graph._directedRelationDefinition(relationName, fromVertexCollections, toVertexCollections)`
*Define a directed relation.*
-
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.
@@ -111,6 +131,140 @@ arangosh> graph._directedRelationDefinition("has_bought", ["Customer", "Compan
```
+!SUBSECTION Orphan Collections
+
+Each graph has an orphan collection. It consists of arbitrary many vertex collection (type *document*), that are not
+used in an edge definition of the graph. If the graph is extended with an edge definition using one of the orphans,
+it will be removed from the orphan collection automatically.
+
+!SUBSUBSECTION Add
+
+
+Adds a vertex collection to the set of orphan collections of the graph. If the
+collection does not exist, it will be created.
+
+`general-graph._addOrphanCollection(orphanCollectionName, createCollection)`
+
+* *orphanCollectionName* - string : name of vertex collection.
+* *createCollection* - bool : if true the collection will be created if it does not exist. Default: true.
+
+@EXAMPLES
+
+
+```
+arangosh> var graph = require("org/arangodb/general-graph")
+arangosh> var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
+arangosh> var g = graph._create("myGraph", [ed1]);
+arangosh> g._addOrphanCollection("myVC3", true);
+undefined
+```
+
+
+
+!SUBSUBSECTION Read
+
+
+Returns all vertex collections of the graph, that are not used in an edge definition.
+
+`general-graph._getOrphanCollections()`
+
+@EXAMPLES
+
+
+```
+arangosh> var graph = require("org/arangodb/general-graph")
+arangosh> var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
+arangosh> var g = graph._create("myGraph", [ed1]);
+arangosh> g._addOrphanCollection("myVC3", true);
+undefined
+arangosh> g._getOrphanCollections();
+[
+ "myVC3"
+]
+```
+
+
+
+!SUBSUBSECTION Remove
+
+
+Removes an orphan collection from the graph and deletes the collection, if it is not
+used in any graph.
+
+`general-graph._removeOrphanCollection()`
+
+*orphanCollectionName* - string : name of vertex collection.
+*dropCollection* - bool : if true the collection will be dropped if it is not used in any graph.
+Default: true.
+
+@EXAMPLES
+
+
+```
+arangosh> var graph = require("org/arangodb/general-graph")
+arangosh> var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
+arangosh> var g = graph._create("myGraph", [ed1]);
+arangosh> g._addOrphanCollection("myVC3", true);
+undefined
+arangosh> g._addOrphanCollection("myVC4", true);
+undefined
+arangosh> g._getOrphanCollections();
+[
+ "myVC3",
+ "myVC4"
+]
+arangosh> g._removeOrphanCollection("myVC3");
+undefined
+arangosh> g._getOrphanCollections();
+[
+ "myVC4"
+]
+```
+
+
+
+!SECTION Create a graph
+
+After having introduced edge definitions and orphan collections a graph can be created.
+
+
+`general-graph._create(graph-name, edge-definitions, orphan-collections)`
+*Create a graph*
+
+
+The creation of a graph requires the name of the graph and a definition of its edges.
+
+For every type of edge definition a convenience method exists that can be used to create a graph.
+Optionaly a list of vertex collections can be added, which are not used in any edge definition.
+These collections are refered to as orphan collections within this chapter.
+All collections used within the creation process are created if they do not exist.
+
+* *graph-name*: string - unique identifier of the graph
+* *edge-definitions*: array - list of edge definition objects
+* *orphan-collections*: array - list of additonal vertex collection names
+
+@EXAMPLES
+
+Create an empty graph, edge definitions can be added at runtime:
+
+
+```
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> graph._drop("social");
+true
+```
+
+Create a graph with edge definitions and orphan collections:
+
+
+```
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> graph._drop("social");
+true
+```
+
+
+
!SUBSUBSECTION Complete Example to create a graph
@@ -141,151 +295,99 @@ alternative call:
_key: "123"
};
```
-!SUBSECTION Orphan Collections
-
-Each graph has a list of orphan collections. It consists of arbitrary many vertex collections (type *document*), that are not
-used in an edge definition of the graph. If the graph is extended with an edge definition using one of the orphans,
-it will be removed from the orphan collections automatically.
-
-!SUBSUBSECTION Add
-
-
-Adds a vertex collection to the set of orphan collections of the graph. If the
-collection does not exist, it will be created.
-
-`general-graph._addOrphanCollection(orphanCollectionName, createCollection)`
-
-*orphanCollectionName* - string : name of vertex collection.
-*createCollection* - bool : if true the collection will be created if it does not exist. Default: true.
-
-@EXAMPLES
-
-
-```
-arangosh> var graph = require("org/arangodb/general-graph")
-arangosh> var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
-arangosh> var g = graph._create("myGraph", [ed1, ed2]);
-ReferenceError: ed2 is not defined
-```
-
-
-
-!SUBSUBSECTION Read
-
-
-Returns all vertex collections of the graph, that are not used in an edge definition.
-
-`general-graph._getOrphanCollections()`
-
-@EXAMPLES
-
-
-```
-arangosh> var graph = require("org/arangodb/general-graph")
-arangosh> var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
-arangosh> var g = graph._create("myGraph", [ed1]);
-[ArangoError 1925: graph already exists]
-```
-
-
-
-!SUBSUBSECTION Remove
-
-
-Removes an orphan collection from the graph and deletes the collection, if it is not
-used in any graph.
-
-`general-graph._removeOrphanCollection()`
-
-*orphanCollectionName* - string : name of vertex collection.
-*dropCollection* - bool : if true the collection will be dropped if it is not used in any graph.
-Default: true.
-
-@EXAMPLES
-
-
-```
-arangosh> var graph = require("org/arangodb/general-graph")
-arangosh> var ed1 = graph._directedRelationDefinition("myEC1", ["myVC1"], ["myVC2"]);
-arangosh> var g = graph._create("myGraph", [ed1]);
-[ArangoError 1925: graph already exists]
-```
-
!SUBSECTION List available graphs
-
-
`general-graph._list()` *List all graphs.*
-
+Lists all graph names stored in this database.
@EXAMPLES
-
+
+
+
```
arangosh> var graph = require("org/arangodb/general-graph");
arangosh> graph._list();
-[
- "social"
+[
+ "social"
]
```
+
!SUBSECTION Load a graph
-```js
-> var graph = require("org/arangodb/graph");
-> var g = graph._graph("myStore");
+`general-graph._graph(graph-name)`
+*Load a graph*
+
+A graph can be loaded by its name.
+
+* *graph-name*: string - unique identifier of the graph
+
+@EXAMPLES
+
+Load a graph:
+
+
```
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> graph._drop("social");
+true
+```
+
-- - -
!SUBSECTION Remove a graph
-Removes a graph from the collection *\_graphs*.
+`general-graph._drop(graph-name, drop-collections)`
+*Remove a graph*
+
+A graph can be dropped by its name.
+This will automatically drop al collections contained in the graph as
+long as they are not used within other graphs.
+To prohibit the drop of collections, the optional parameter *drop-collections* can be set to *false*.
+
+* *graph-name*: string - unique identifier of the graph
+* *drop-collections*: boolean (optional) - Define if collections should be dropped (default: true)
+
+@EXAMPLES
+
+Drop a graph:
+
-```js
-> graph._drop(graphId, dropCollections);
+```
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> graph._drop("social");
true
```
-
-graphId: string - id of the graph to be removed
-dropCollections: bool - optional. *true* all collections of the graph will be deleted.
-*false* no collection of the graph will be deleted. Default: *true*
+
-
-!SECTION Vertex
+!SECTION Edge
!SUBSECTION Save
-
-`general-graph.vertexCollectionName.save(data)` *Creates a new vertex*
+Creates and saves a new vertex in collection *vertexCollectionName*
+`general-graph.vertexCollectionName.save(data)`
-Creates a new vertex in collection *vertexCollectionName*.
*data*: json - data of vertex
@EXAMPLES
```
-arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
-arangosh> var g = examples.loadGraph("social");
-arangosh> g.male.save({name: "Floyd", _key: "floyd"});
-{
- "error" : false,
- "_id" : "male/floyd",
- "_rev" : "91260521",
- "_key" : "floyd"
-}
+arangosh> var graph = require("org/arangodb/general-graph");
+arangosh> graph._drop("social");
+true
```
@@ -311,14 +413,14 @@ arangosh> g.male.save({neym: "Jon", _key: "john"});
{
"error" : false,
"_id" : "male/john",
- "_rev" : "31360617",
+ "_rev" : "31374924",
"_key" : "john"
}
arangosh> g.male.replace("male/john", {name: "John"});
{
"error" : false,
"_id" : "male/john",
- "_rev" : "31557225",
+ "_rev" : "31571532",
"_key" : "john"
}
```
@@ -346,11 +448,16 @@ arangosh> g.female.save({name: "Lynda", _key: "linda"});
{
"error" : false,
"_id" : "female/linda",
- "_rev" : "79201897",
+ "_rev" : "86027478",
+ "_key" : "linda"
+}
+arangosh> g.female.update("female/linda", {name: "Linda", _key: "linda"});
+{
+ "error" : false,
+ "_id" : "female/linda",
+ "_rev" : "86224086",
"_key" : "linda"
}
-arangosh> g.female.update({name: "Linda", _key: "linda"});
-TypeError: Object #