1
0
Fork 0

changed the graph document

This commit is contained in:
a-brandt 2013-01-15 17:28:22 +01:00
parent b19d2ec0ee
commit f1f6eca036
4 changed files with 13 additions and 12 deletions

View File

@ -1,5 +1,5 @@
> curl --data @- -X POST --dump - http://localhost:8529/_api/graph
{"_name" : "graph1", "vertices" : "v", "edges" : "e"}
{"_key" : "graph1", "vertices" : "v", "edges" : "e"}
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
@ -9,8 +9,8 @@ content-type: application/json; charset=utf-8
"_id": "_graphs/graph1",
"_rev": 11767958,
"_key": "graph1",
"vertices": 9670806,
"edges": 10588310
"vertices": "v",
"edges": "e"
},
"error": false,
"code": 200

View File

@ -8,8 +8,8 @@ content-type: application/json; charset=utf-8
"_id": "_graphs/graph1",
"_rev": 11767958,
"_key": "graph1",
"vertices": 9670806,
"edges": 10588310
"vertices": "v",
"edges": "e"
},
"error": false,
"code": 200

View File

@ -65,6 +65,7 @@ WIKI = \
HttpBlueprints \
HttpCollection \
HttpCursor \
HttpGraph \
HttpImport \
HttpIndex \
HttpInterface \

View File

@ -1175,19 +1175,19 @@ function Graph(name, vertices, edges) {
// check if know that graph
graphProperties = gdb.firstExample('vertices',
vertices._id,
vertices.name(),
'edges',
edges._id
edges.name()
);
if (graphProperties === null) {
// check if edge is used in a graph
graphProperties = gdb.firstExample('edges', edges._id);
graphProperties = gdb.firstExample('edges', edges.name());
if (graphProperties === null) {
graphPropertiesId = gdb.save({ 'vertices' : vertices._id,
'edges' : edges._id,
graphPropertiesId = gdb.save({ 'vertices' : vertices.name(),
'edges' : edges.name(),
'_key' : name });
graphProperties = gdb.document(graphPropertiesId);
@ -1198,11 +1198,11 @@ function Graph(name, vertices, edges) {
throw "found graph but has different <name>";
}
} else {
if (graphProperties.vertices !== vertices._id) {
if (graphProperties.vertices !== vertices.name()) {
throw "found graph but has different <vertices>";
}
if (graphProperties.edges !== edges._id) {
if (graphProperties.edges !== edges.name()) {
throw "found graph but has different <edges>";
}
}