From 1338fb0dce0e70e61faa5b925ada510ccb073793 Mon Sep 17 00:00:00 2001 From: gschwab Date: Wed, 18 Jun 2014 15:53:28 +0200 Subject: [PATCH] docu resetted to automatation --- .../Users/General-Graphs/Management.mdpp | 541 +----------------- 1 file changed, 21 insertions(+), 520 deletions(-) diff --git a/Documentation/Books/Users/General-Graphs/Management.mdpp b/Documentation/Books/Users/General-Graphs/Management.mdpp index a588aecaa1..10bbbec594 100644 --- a/Documentation/Books/Users/General-Graphs/Management.mdpp +++ b/Documentation/Books/Users/General-Graphs/Management.mdpp @@ -12,124 +12,19 @@ The edge definitions for a graph is an Array containing arbitrary many directed !SUBSECTION Initialize the list -
-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 -
-
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> directed-relation = graph._directedRelationDefinition("lives_in", "user", "city"); -ReferenceError: Invalid left-hand side in assignment -``` -
+@startDocuBlock JSF_general_graph_edge_definitions !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 -``` -
- +@startDocuBlock JSF_general_graph_extend_edge_definitions !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 -*vertexCollections*. -
-@EXAMPLES -
-To define simple relation with only one vertex collection: -
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> graph._undirectedRelationDefinition("friend", "user"); -{ - "collection" : "friend", - "from" : [ - "user" - ], - "to" : [ - "user" - ] -} -``` -
-To define a relation between several vertex collections: -
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> graph._undirectedRelationDefinition("marriage", ["female", "male"]); -{ - "collection" : "marriage", - "from" : [ - "female", - "male" - ], - "to" : [ - "female", - "male" - ] -} -``` - +@startDocuBlock JSF_general_graph_undirectedRelationDefinition@startDocuBlock !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. -Relations are only allowed in the direction from any collection in *fromVertexCollections* -to any collection in *toVertexCollections*. -
-@EXAMPLES -
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> graph._directedRelationDefinition("has_bought", ["Customer", "Company"], ["Groceries", "Electronics"]); -{ - "collection" : "has_bought", - "from" : [ - "Customer", - "Company" - ], - "to" : [ - "Groceries", - "Electronics" - ] -} -``` - +@startDocuBlock JSF_general_graph_directedRelationDefinition !SUBSECTION Orphan Collections @@ -139,131 +34,21 @@ 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 -``` -
- +@startDocuBlock JSF_general_graph__addVertexCollection !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" -] -``` -
- +@startDocuBlock JSF_general_graph__orphanCollections !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" -] -``` -
- +@startDocuBlock JSF_general_graph__removeVertexCollection !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 -``` -
- +@startDocuBlock JSF_general_graph_create !SUBSUBSECTION Complete Example to create a graph @@ -298,343 +83,59 @@ alternative call: !SUBSECTION List available graphs +@startDocuBlock JSF_general_graph_list_call `general-graph._list()` *List all graphs.*

+@startDocuBlock JSF_general_graph_list_info -Lists all graph names stored in this database.
@EXAMPLES
- -
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> graph._list(); -[ - "social" -] -``` - +@startDocuBlock JSF_general_graph_list_examples !SUBSECTION Load a graph - -`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 -``` -
- +@startDocuBlock JSF_general_graph_graph !SUBSECTION Remove a graph - -`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: -
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> graph._drop("social"); -true -``` -
- +@startDocuBlock JSF_general_graph_drop !SECTION Edge !SUBSECTION Save - -Creates and saves a new vertex in collection *vertexCollectionName* -
-`general-graph.vertexCollectionName.save(data)` -
-*data*: json - data of vertex -
-@EXAMPLES -
- -``` -arangosh> var graph = require("org/arangodb/general-graph"); -arangosh> graph._drop("social"); -true -``` -
- +@startDocuBlock JSF_general_graph_vertex_collection_save !SUBSECTION Replace - -Replaces the data of a vertex in collection *vertexCollectionName* -
-`general-graph.vertexCollectionName.replace(vertexId, data, options)` -
-*vertexId*: string - id of the vertex -*data*: json - data of vertex -*options*: json - (optional) - see collection documentation -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.male.save({neym: "Jon", _key: "john"}); -{ - "error" : false, - "_id" : "male/john", - "_rev" : "31374924", - "_key" : "john" -} -arangosh> g.male.replace("male/john", {name: "John"}); -{ - "error" : false, - "_id" : "male/john", - "_rev" : "31571532", - "_key" : "john" -} -``` -
- +@startDocuBlock JSF_general_graph_vertex_collection_replace !SUBSECTION Update - -Updates the data of a vertex in collection *vertexCollectionName* -
-`general-graph.vertexCollectionName.update(vertexId, data, options)` -
-*vertexId*: string - id of the vertex -*data*: json - data of vertex -*options*: json - (optional) - see collection documentation -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.female.save({name: "Lynda", _key: "linda"}); -{ - "error" : false, - "_id" : "female/linda", - "_rev" : "86027478", - "_key" : "linda" -} -arangosh> g.female.update("female/linda", {name: "Linda", _key: "linda"}); -{ - "error" : false, - "_id" : "female/linda", - "_rev" : "86224086", - "_key" : "linda" -} -``` -
- +@startDocuBlock JSF_general_graph_vertex_collection_update !SUBSECTION Remove - -Removes a vertex in collection *vertexCollectionName* -
-`general-graph.vertexCollectionName.remove(vertexId, options)` -
-Additionally removes all ingoing and outgoing edges of the vertex recursively -(see [edge remove](#edge.remove)). -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.male.save({name: "Kermit", _key: "kermit"}); -{ - "error" : false, - "_id" : "male/kermit", - "_rev" : "89701964", - "_key" : "kermit" -} -arangosh> db._exists("male/kermit") -true -arangosh> g.male.remove("male/kermit") -true -arangosh> db._exists("male/kermit") -false -``` -
- +@startDocuBlock JSF_general_graph_vertex_collection_remove !SECTION Edge !SUBSECTION Save - -Creates and saves a new edge from vertex *from* to vertex *to* in -collection *edgeCollectionName* -
-`general-graph.edgeCollectionName.save(from, to, data)` -
-*from*: string - id of outgoing vertex -*to*: string - of ingoing vertex -*data*: json - data of edge -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.relation.save("male/bob", "female/alice", {type: "married", _key: "bobAndAlice"}); -{ - "error" : false, - "_id" : "relation/bobAndAlice", - "_rev" : "45923916", - "_key" : "bobAndAlice" -} -``` -
-If the collections of *from* and *to* are not defined in an edgeDefinition of the graph, -the edge will not be stored. -
-
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.relation.save("relation/aliceAndBob", "female/alice", {type: "married", _key: "bobAndAlice"}); -Edge is not allowed between relation/aliceAndBob and female/alice. -``` - +@startDocuBlock JSF_general_graph_edge_collection_save !SUBSECTION Replace - -Replaces the data of an edge in collection *edgeCollectionName* -
-`general-graph.edgeCollectionName.replace(edgeId, data, options)` -
-*edgeId*: string - id of the edge -*data*: json - data of edge -*options*: json - (optional) - see collection documentation -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.relation.save("female/alice", "female/diana", {typo: "nose", _key: "aliceAndDiana"}); -{ - "error" : false, - "_id" : "relation/aliceAndDiana", - "_rev" : "27377228", - "_key" : "aliceAndDiana" -} -arangosh> g.relation.replace("relation/aliceAndDiana", {type: "knows"}); -{ - "error" : false, - "_id" : "relation/aliceAndDiana", - "_rev" : "27573836", - "_key" : "aliceAndDiana" -} -``` -
- +@startDocuBlock JSF_general_graph_edge_collection_replace !SUBSECTION Update - -Updates the data of an edge in collection *edgeCollectionName* -
-`general-graph.edgeCollectionName.update(edgeId, data, options)` -
-*edgeId*: string - id of the edge -*data*: json - data of edge -*options*: json - (optional) - see collection documentation -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.relation.save("female/alice", "female/diana", {type: "knows", _key: "aliceAndDiana"}); -{ - "error" : false, - "_id" : "relation/aliceAndDiana", - "_rev" : "132365900", - "_key" : "aliceAndDiana" -} -arangosh> g.relation.update("relation/aliceAndDiana", {type: "quarrelled", _key: "aliceAndDiana"}); -{ - "error" : false, - "_id" : "relation/aliceAndDiana", - "_rev" : "132562508", - "_key" : "aliceAndDiana" -} -``` -
- +@startDocuBlock JSF_general_graph_edge_collection_update !SUBSECTION Remove - -Removes an edge in collection *edgeCollectionName* -
-`general-graph.edgeCollectionName.remove(edgeId, options)` -
-If this edge is used as a vertex by another edge, the other edge will be removed (recursively). -
-@EXAMPLES -
- -``` -arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js"); -arangosh> var g = examples.loadGraph("social"); -arangosh> g.relation.save("female/alice", "female/diana", {_key: "aliceAndDiana"}); -{ - "error" : false, - "_id" : "relation/aliceAndDiana", - "_rev" : "146914892", - "_key" : "aliceAndDiana" -} -arangosh> db._exists("relation/aliceAndDiana") -true -arangosh> g.relation.remove("relation/aliceAndDiana") -true -arangosh> db._exists("relation/aliceAndDiana") -false -``` -
- +@startDocuBlock JSF_general_graph_edge_collection_remove