@@ -18,7 +18,7 @@ class Graph(APIWrapper):
18
18
:param connection: ArangoDB connection object
19
19
:type connection: arango.connection.Connection
20
20
:param name: the name of the graph
21
- :type name: str
21
+ :type name: str | unicode
22
22
"""
23
23
24
24
def __init__ (self , connection , name ):
@@ -41,7 +41,7 @@ def vertex_collection(self, name):
41
41
"""Return the vertex collection object.
42
42
43
43
:param name: the name of the vertex collection
44
- :type name: str
44
+ :type name: str | unicode
45
45
:returns: the vertex collection object
46
46
:rtype: arango.collections.vertex.VertexCollection
47
47
"""
@@ -51,7 +51,7 @@ def edge_collection(self, name):
51
51
"""Return the edge collection object.
52
52
53
53
:param name: the name of the edge collection
54
- :type name: str
54
+ :type name: str | unicode
55
55
:returns: the edge collection object
56
56
:rtype: arango.collections.edge.EdgeCollection
57
57
"""
@@ -74,11 +74,23 @@ def properties(self):
74
74
def handler (res ):
75
75
if res .status_code not in HTTP_OK :
76
76
raise GraphPropertiesError (res )
77
- graph = res .body ['graph' ]
77
+ record = res .body ['graph' ]
78
78
return {
79
- 'id' : graph ['_id' ],
80
- 'name' : graph ['name' ],
81
- 'revision' : graph ['_rev' ]
79
+ 'id' : record ['_id' ],
80
+ 'name' : record ['name' ],
81
+ 'revision' : record ['_rev' ],
82
+ 'orphan_collections' : record ['orphanCollections' ],
83
+ 'edge_definitions' : [
84
+ {
85
+ 'name' : edge_definition ['collection' ],
86
+ 'to_collections' : edge_definition ['to' ],
87
+ 'from_collections' : edge_definition ['from' ]
88
+ }
89
+ for edge_definition in record ['edgeDefinitions' ]
90
+ ],
91
+ 'smart' : record .get ('isSmart' ),
92
+ 'smart_field' : record .get ('smartGraphAttribute' ),
93
+ 'shard_count' : record .get ('numberOfShards' )
82
94
}
83
95
return request , handler
84
96
@@ -133,7 +145,7 @@ def create_vertex_collection(self, name):
133
145
"""Create a vertex collection for the graph.
134
146
135
147
:param name: the name of the new vertex collection to create
136
- :type name: str
148
+ :type name: str | unicode
137
149
:returns: the vertex collection object
138
150
:rtype: arango.collections.vertex.VertexCollection
139
151
:raises arango.exceptions.VertexCollectionCreateError: if the vertex
@@ -157,7 +169,7 @@ def delete_vertex_collection(self, name, purge=False):
157
169
"""Remove the vertex collection from the graph.
158
170
159
171
:param name: the name of the vertex collection to remove
160
- :type name: str
172
+ :type name: str | unicode
161
173
:param purge: delete the vertex collection completely
162
174
:type purge: bool
163
175
:returns: whether the operation was successful
@@ -219,7 +231,7 @@ def create_edge_definition(self, name, from_collections, to_collections):
219
231
vertex collections, one or more "to" vertex collections.
220
232
221
233
:param name: the name of the new edge collection
222
- :type name: str
234
+ :type name: str | unicode
223
235
:param from_collections: the name(s) of the "from" vertex collections
224
236
:type from_collections: list
225
237
:param to_collections: the names of the "to" vertex collections
@@ -251,7 +263,7 @@ def replace_edge_definition(self, name, from_collections, to_collections):
251
263
"""Replace an edge definition in the graph.
252
264
253
265
:param name: the name of the edge definition to replace
254
- :type name: str
266
+ :type name: str | unicode
255
267
:param from_collections: the names of the "from" vertex collections
256
268
:type from_collections: list
257
269
:param to_collections: the names of the "to" vertex collections
@@ -285,7 +297,7 @@ def delete_edge_definition(self, name, purge=False):
285
297
"""Remove an edge definition from the graph.
286
298
287
299
:param name: the name of the edge collection
288
- :type name: str
300
+ :type name: str | unicode
289
301
:param purge: delete the edge collection completely
290
302
:type purge: bool
291
303
:returns: whether the operation was successful
@@ -331,20 +343,20 @@ def traverse(self,
331
343
332
344
:param start_vertex: the collection and the key of the start vertex in
333
345
the format ``"collection/key"``
334
- :type start_vertex: str
346
+ :type start_vertex: str | unicode
335
347
:param direction: ``"outbound"`` (default), ``"inbound"`` or ``"any"``
336
- :type direction: str
348
+ :type direction: str | unicode
337
349
:param item_order: ``"forward"`` (default) or ``"backward"``
338
- :type item_order: str
350
+ :type item_order: str | unicode
339
351
:param strategy: ``"dfs"`` or ``"bfs"``
340
- :type strategy: str
352
+ :type strategy: str | unicode
341
353
:param order: ``"preorder"``, ``"postorder"``, ``"preorder-expander"``
342
354
or ``None`` (default)
343
- :type order: str
355
+ :type order: str | unicode
344
356
:param vertex_uniqueness: ``"global"``, ``"path"`` or ``None``
345
- :type vertex_uniqueness: str
357
+ :type vertex_uniqueness: str | unicode
346
358
:param edge_uniqueness: ``"global"``, ``"path"`` or ``None``
347
- :type edge_uniqueness: str
359
+ :type edge_uniqueness: str | unicode
348
360
:param min_depth: the minimum depth of the nodes to visit
349
361
:type min_depth: int
350
362
:param max_depth: the maximum depth of the nodes to visit
@@ -354,30 +366,30 @@ def traverse(self,
354
366
:type max_iter: int
355
367
:param init_func: init function in Javascript with signature
356
368
``(config, result) -> void``, which is used to initialize values
357
- :type init_func: str
369
+ :type init_func: str | unicode
358
370
:param sort_func: sort function in Javascript with signature
359
371
``(left, right) -> integer``, which returns ``-1`` if ``left <
360
372
right``, ``+1`` if ``left > right``, and ``0`` if ``left == right``
361
- :type sort_func: str
373
+ :type sort_func: str | unicode
362
374
:param filter_func: filter function in Javascript with signature
363
375
``(config, vertex, path) -> mixed``, where mixed can be one of four
364
376
possible values: ``"exclude"`` (do not visit the vertex),
365
377
``"prune"`` (do not follow the edges of the vertex), ``""`` or
366
378
``undefined`` (visit the vertex and its edges), or an Array
367
379
(any combinations of the ``"mixed"``, ``"prune"``, ``""`` or
368
380
``undefined``).
369
- :type filter_func: str
381
+ :type filter_func: str | unicode
370
382
:param visitor_func: visitor function in Javascript with signature
371
383
``(config, result, vertex, path, connected) -> void``, where the
372
384
return value is ignored, ``result`` is modified by reference, and
373
385
``connected`` is populated only when argument **order** is set to
374
386
``"preorder-expander"``
375
- :type visitor_func: str
387
+ :type visitor_func: str | unicode
376
388
:param expander_func: expander function in Javascript with signature
377
389
``(config, vertex, path) -> mixed``, which must return an array of
378
390
the connections for vertex where each connection is an object with
379
391
attributes edge and vertex
380
- :type expander_func: str
392
+ :type expander_func: str | unicode
381
393
:returns: the visited edges and vertices
382
394
:rtype: dict
383
395
:raises arango.exceptions.GraphTraverseError: if the graph traversal
0 commit comments