From a57f428277f253826cbbf02890fbf767badb695e Mon Sep 17 00:00:00 2001 From: a-brandt Date: Tue, 15 Jan 2013 14:41:20 +0100 Subject: [PATCH] added documentation --- Documentation/Examples/api-graph-change-edge | 20 +++++++ .../Examples/api-graph-change-vertex | 16 ++++++ Documentation/Examples/api-graph-create-edge | 20 +++++++ Documentation/Examples/api-graph-create-graph | 17 ++++++ .../Examples/api-graph-create-vertex | 17 ++++++ Documentation/Examples/api-graph-delete-edge | 10 ++++ Documentation/Examples/api-graph-delete-graph | 10 ++++ .../Examples/api-graph-delete-vertex | 10 ++++ Documentation/Examples/api-graph-get-edge | 19 +++++++ Documentation/Examples/api-graph-get-edges | 53 +++++++++++++++++++ Documentation/Examples/api-graph-get-graph | 16 ++++++ Documentation/Examples/api-graph-get-vertex | 16 ++++++ .../Examples/api-graph-get-vertex-edges | 33 ++++++++++++ .../Examples/api-graph-get-vertex-vertices | 48 +++++++++++++++++ Documentation/Examples/api-graph-get-vertices | 47 ++++++++++++++++ js/actions/system/api-graph.js | 6 ++- 16 files changed, 356 insertions(+), 2 deletions(-) create mode 100644 Documentation/Examples/api-graph-change-edge create mode 100644 Documentation/Examples/api-graph-change-vertex create mode 100644 Documentation/Examples/api-graph-create-edge create mode 100644 Documentation/Examples/api-graph-create-graph create mode 100644 Documentation/Examples/api-graph-create-vertex create mode 100644 Documentation/Examples/api-graph-delete-edge create mode 100644 Documentation/Examples/api-graph-delete-graph create mode 100644 Documentation/Examples/api-graph-delete-vertex create mode 100644 Documentation/Examples/api-graph-get-edge create mode 100644 Documentation/Examples/api-graph-get-edges create mode 100644 Documentation/Examples/api-graph-get-graph create mode 100644 Documentation/Examples/api-graph-get-vertex create mode 100644 Documentation/Examples/api-graph-get-vertex-edges create mode 100644 Documentation/Examples/api-graph-get-vertex-vertices create mode 100644 Documentation/Examples/api-graph-get-vertices diff --git a/Documentation/Examples/api-graph-change-edge b/Documentation/Examples/api-graph-change-edge new file mode 100644 index 0000000000..448fa48984 --- /dev/null +++ b/Documentation/Examples/api-graph-change-edge @@ -0,0 +1,20 @@ +> curl --data @- -X PUT --dump - http://localhost:8529/_api/graph/graph1/edge/edge1 +{"optional2" : "val2"} + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "edge": { + "_id": "e/edge1", + "_rev": 57595391, + "_key": "edge1", + "_bidirectional": false, + "_from": "v/vert2", + "_to": "v/vert1", + "$label": null, + "optional2": "val2" + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-change-vertex b/Documentation/Examples/api-graph-change-vertex new file mode 100644 index 0000000000..2f04a83488 --- /dev/null +++ b/Documentation/Examples/api-graph-change-vertex @@ -0,0 +1,16 @@ +> curl --data @- -X PUT --dump - http://localhost:8529/_api/graph/graph1/vertex/v1 +{"optional1" : "val2"} + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "vertex": { + "_id": "v/v1", + "_rev": 24332190, + "_key": "v1", + "optional1": "val2" + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-create-edge b/Documentation/Examples/api-graph-create-edge new file mode 100644 index 0000000000..2980f84e34 --- /dev/null +++ b/Documentation/Examples/api-graph-create-edge @@ -0,0 +1,20 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/graph/graph1/edge +{"_key" : "edge1", "_from" : "vert2", "_to" : "vert1", "optional1" : "val1"} + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "edge": { + "_id": "e/edge1", + "_rev": 57595366, + "_key": "edge1", + "_bidirectional": false, + "_from": "v/vert2", + "_to": "v/vert1", + "$label": null, + "optional1": "val1" + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-create-graph b/Documentation/Examples/api-graph-create-graph new file mode 100644 index 0000000000..72c51c4936 --- /dev/null +++ b/Documentation/Examples/api-graph-create-graph @@ -0,0 +1,17 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/graph +{"_name" : "graph1", "vertices" : "v", "edges" : "e"} + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "graph": { + "_id": "_graphs/graph1", + "_rev": 11767958, + "_key": "graph1", + "vertices": 9670806, + "edges": 10588310 + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-create-vertex b/Documentation/Examples/api-graph-create-vertex new file mode 100644 index 0000000000..e050068dfa --- /dev/null +++ b/Documentation/Examples/api-graph-create-vertex @@ -0,0 +1,17 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/graph/graph1/vertex +{"_key" : "v1", "optional1" : "val1", "optional2" : "val2"} + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "vertex": { + "_id": "v/v1", + "_rev": 24332177, + "_key": "v1", + "optional1": "val1", + "optional2": "val2" + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-delete-edge b/Documentation/Examples/api-graph-delete-edge new file mode 100644 index 0000000000..270a7f231d --- /dev/null +++ b/Documentation/Examples/api-graph-delete-edge @@ -0,0 +1,10 @@ +> curl -X DELETE --dump - http://localhost:8529/_api/graph/graph1/edge/edge1 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "deleted": true, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-delete-graph b/Documentation/Examples/api-graph-delete-graph new file mode 100644 index 0000000000..7bc8048605 --- /dev/null +++ b/Documentation/Examples/api-graph-delete-graph @@ -0,0 +1,10 @@ +> curl -X DELETE --dump - http://localhost:8529/_api/graph/graph1 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "deleted": true, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-delete-vertex b/Documentation/Examples/api-graph-delete-vertex new file mode 100644 index 0000000000..b5e77ee6e7 --- /dev/null +++ b/Documentation/Examples/api-graph-delete-vertex @@ -0,0 +1,10 @@ +> curl -X DELETE --dump - http://localhost:8529/_api/graph/graph1/vertex/v1 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "deleted": true, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-get-edge b/Documentation/Examples/api-graph-get-edge new file mode 100644 index 0000000000..4533e39a82 --- /dev/null +++ b/Documentation/Examples/api-graph-get-edge @@ -0,0 +1,19 @@ +> curl -X GET --dump - http://localhost:8529/_api/graph/graph1/edge/edge1 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "edge": { + "_id": "e/edge1", + "_rev": 57595366, + "_key": "edge1", + "_bidirectional": false, + "_from": "v/vert2", + "_to": "v/vert1", + "$label": null, + "optional1": "val1" + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-get-edges b/Documentation/Examples/api-graph-get-edges new file mode 100644 index 0000000000..63e0efce89 --- /dev/null +++ b/Documentation/Examples/api-graph-get-edges @@ -0,0 +1,53 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/graph/graph1/edges +{"batchSize" : 100} + +HTTP/1.1 201 Created +content-type: application/json; charset=utf-8 + +{ + "result": [ + { + "_id": "e/edge1", + "_rev": 125407382, + "_key": "edge1", + "_bidirectional": false, + "_from": "v/id1", + "_to": "v/id2", + "$label": null, + "optional1": "val1a" + }, + { + "_id": "e/edge2", + "_rev": 125800598, + "_key": "edge2", + "_bidirectional": false, + "_from": "v/id2", + "_to": "v/id3", + "$label": null, + "optional1": "val1b" + }, + { + "_id": "e/edge3", + "_rev": 125800602, + "_key": "edge3", + "_bidirectional": false, + "_from": "v/id3", + "_to": "v/id4", + "$label": null, + "optional1": "val1c" + }, + { + "_id": "e/edge4", + "_rev": 125808651, + "_key": "edge4", + "_bidirectional": false, + "_from": "v/id4", + "_to": "v/id5", + "$label": null, + "optional1": "val1d" + } + ], + "hasMore": false, + "error": false, + "code": 201 +} diff --git a/Documentation/Examples/api-graph-get-graph b/Documentation/Examples/api-graph-get-graph new file mode 100644 index 0000000000..82218060a9 --- /dev/null +++ b/Documentation/Examples/api-graph-get-graph @@ -0,0 +1,16 @@ +> curl -X GET --dump - http://localhost:8529/_api/graph/graph1 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "graph": { + "_id": "_graphs/graph1", + "_rev": 11767958, + "_key": "graph1", + "vertices": 9670806, + "edges": 10588310 + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-get-vertex b/Documentation/Examples/api-graph-get-vertex new file mode 100644 index 0000000000..ebb209043d --- /dev/null +++ b/Documentation/Examples/api-graph-get-vertex @@ -0,0 +1,16 @@ +> curl -X GET --dump - http://localhost:8529/_api/graph/graph1/vertex/v1 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 + +{ + "vertex": { + "_id": "v/v1", + "_rev": 24332177, + "_key": "v1", + "optional1": "val1", + "optional2": "val2" + }, + "error": false, + "code": 200 +} diff --git a/Documentation/Examples/api-graph-get-vertex-edges b/Documentation/Examples/api-graph-get-vertex-edges new file mode 100644 index 0000000000..ca6f9aa32b --- /dev/null +++ b/Documentation/Examples/api-graph-get-vertex-edges @@ -0,0 +1,33 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/graph/graph1/edges/id2 +{"batchSize" : 100} + +HTTP/1.1 201 Created +content-type: application/json; charset=utf-8 + +{ + "result": [ + { + "_id": "e/edge1", + "_rev": 125407382, + "_key": "edge1", + "_bidirectional": false, + "_from": "v/id1", + "_to": "v/id2", + "$label": null, + "optional1": "val1a" + }, + { + "_id": "e/edge2", + "_rev": 125800598, + "_key": "edge2", + "_bidirectional": false, + "_from": "v/id2", + "_to": "v/id3", + "$label": null, + "optional1": "val1b" + } + ], + "hasMore": false, + "error": false, + "code": 201 +} diff --git a/Documentation/Examples/api-graph-get-vertex-vertices b/Documentation/Examples/api-graph-get-vertex-vertices new file mode 100644 index 0000000000..0325b21aa0 --- /dev/null +++ b/Documentation/Examples/api-graph-get-vertex-vertices @@ -0,0 +1,48 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/grap/graph1/vertices/id2 +{"batchSize" : 100 } + +HTTP/1.1 201 Created +content-type: application/json; charset=utf-8 + +{ + "result": [ + { + "_id": "v/id3", + "_rev": 47810529, + "_key": "id3", + "optional2": 2, + "optional1": "val1" + }, + { + "_id": "v/id1", + "_rev": 47548385, + "_key": "id1", + "optional2": 1, + "optional1": "val1" + } + ], + "hasMore": false, + "error": false, + "code": 201 +} + +> curl --data @- -X POST --dump - http://localhost:8529/_api/grap/graph1/vertices/id2 +{"batchSize" : 100, "filter" : { "direction" : "out" } } + +HTTP/1.1 201 Created +content-type: application/json; charset=utf-8 + +{ + "result": [ + { + "_id": "v/id3", + "_rev": 47810529, + "_key": "id3", + "optional2": 2, + "optional1": "val1" + } + ], + "hasMore": false, + "error": false, + "code": 201 +} diff --git a/Documentation/Examples/api-graph-get-vertices b/Documentation/Examples/api-graph-get-vertices new file mode 100644 index 0000000000..1b9496d06e --- /dev/null +++ b/Documentation/Examples/api-graph-get-vertices @@ -0,0 +1,47 @@ +> curl --data @- -X POST --dump - http://localhost:8529/_api/grap/graph1/vertices +{"batchSize" : 100 } + +HTTP/1.1 201 Created +content-type: application/json; charset=utf-8 + +{ + "result": [ + { + "_id": "v/id2", + "_rev": 47744993, + "_key": "id2", + "optional2": 2, + "optional1": "val1" + }, + { + "_id": "v/id3", + "_rev": 47810529, + "_key": "id3", + "optional2": 2, + "optional1": "val1" + }, + { + "_id": "v/id1", + "_rev": 47548385, + "_key": "id1", + "optional2": 1, + "optional1": "val1" + }, + { + "_id": "v/id5", + "_rev": 48007137, + "_key": "id5", + "optional2": "val2" + }, + { + "_id": "v/id4", + "_rev": 47876065, + "_key": "id4", + "optional2": 3, + "optional1": "val1" + } + ], + "hasMore": false, + "error": false, + "code": 201 +} diff --git a/js/actions/system/api-graph.js b/js/actions/system/api-graph.js index b1d8e44d5d..b09d9e0b86 100644 --- a/js/actions/system/api-graph.js +++ b/js/actions/system/api-graph.js @@ -230,7 +230,7 @@ /// /// @EXAMPLES /// -/// @verbinclude api-blueprints-delete-graph +/// @verbinclude api-graph-delete-graph //////////////////////////////////////////////////////////////////////////////// function DELETE_graph_graph (req, res) { @@ -505,7 +505,7 @@ /// /// Select all vertices /// -/// +/// @verbinclude api-graph-get-vertices //////////////////////////////////////////////////////////////////////////////// function POST_graph_all_vertices (req, res, g) { @@ -832,6 +832,7 @@ /// /// Select all edges /// +/// @verbinclude api-graph-get-edges //////////////////////////////////////////////////////////////////////////////// function POST_graph_all_edges (req, res, g) { @@ -911,6 +912,7 @@ /// /// Select all edges /// +/// @verbinclude api-graph-get-vertex-edges //////////////////////////////////////////////////////////////////////////////// function POST_graph_vertex_edges (req, res, g) {