mirror of https://gitee.com/bigwinds/arangodb
1428 lines
38 KiB
Plaintext
1428 lines
38 KiB
Plaintext
!CHAPTER Fluent AQL Interface
|
|
|
|
This chapter describes a fluent interface to query your graph.
|
|
The philosophy of this interface is to select a group of starting elements (vertices or edges) at first and from there on explore the graph with your query by selecting connected elements.
|
|
|
|
As an example you can start with a set of vertices, select their direct neighbors and finally their outgoing edges.
|
|
|
|
The result of this query will be the set of outgoing edges.
|
|
For each part of the query it is possible to further refine the resulting set of elements by giving examples for them.
|
|
|
|
!SECTION Starting Points
|
|
|
|
This section describes the entry points for the fluent interface.
|
|
The philosophy of this module is to start with a specific subset of vertices or edges and from there on iterate over the graph.
|
|
|
|
Therefore you get exactly this two entry points:
|
|
|
|
* Select a set of edges
|
|
* Select a set of vertices
|
|
|
|
!SUBSECTION Edges
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_edges -->
|
|
|
|
`graph.edges(examples)` *Select some edges from the graph.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select a subset of the edges stored in the graph.
|
|
This is one of the entry points for the fluent AQL interface.
|
|
It will return a mutable AQL statement which can be further refined, using the
|
|
functions described below.
|
|
The resulting set of edges can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all edges are valid.
|
|
* A string, only the edge having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only edges having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All edges matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
In the examples the *toArray* function is used to print the result.
|
|
The description of this module can be found below.
|
|
<br />
|
|
To request unfiltered edges:
|
|
<br />
|
|
|
|
```js
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> g._edges().toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "111029750",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "111291894",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "relation/bobAndDiana",
|
|
"_rev" : "111685110",
|
|
"_key" : "bobAndDiana",
|
|
"_from" : "male/bob",
|
|
"_to" : "female/diana",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "relation/charlyAndDiana",
|
|
"_rev" : "111488502",
|
|
"_key" : "charlyAndDiana",
|
|
"_from" : "male/charly",
|
|
"_to" : "female/diana",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered edges:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> g._edges({type: "married"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "197406198",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/charlyAndDiana",
|
|
"_rev" : "197864950",
|
|
"_key" : "charlyAndDiana",
|
|
"_from" : "male/charly",
|
|
"_to" : "female/diana",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION Vertices
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_vertices -->
|
|
|
|
`graph.vertices(examples)` *Select some vertices from the graph.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select a subset of the vertices stored in the graph.
|
|
This is one of the entry points for the fluent AQL interface.
|
|
It will return a mutable AQL statement which can be further refined, using the
|
|
functions described below.
|
|
The resulting set of edges can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all vertices are valid.
|
|
* A string, only the vertex having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only vertices having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All vertices matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
In the examples the *toArray* function is used to print the result.
|
|
The description of this module can be found below.
|
|
<br />
|
|
To request unfiltered vertices:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> g._vertices().toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "116796918",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "female/diana",
|
|
"_rev" : "117583350",
|
|
"_key" : "diana",
|
|
"name" : "Diana"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "117190134",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "117386742",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered vertices:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> g._vertices([{name: "Alice"}, {name: "Bob"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "105983478",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "106376694",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
}
|
|
]
|
|
```
|
|
|
|
|
|
!SECTION Working with the query cursor
|
|
|
|
The fluent query object handles cursor creation and maintenance for you.
|
|
A cursor will be created as soon as you request the first result.
|
|
If you are unhappy with the current result and want to refine it further you can execute a further step in the query which cleans up the cursor for you.
|
|
In this interface you get the complete functionality available for general AQL cursors directly on your query.
|
|
The cursor functionality is described in this section.
|
|
|
|
!SUBSECTION ToArray
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_toArray -->
|
|
|
|
`graph-query.toArray()` *Returns an array containing the complete result.*
|
|
<br />
|
|
<br />
|
|
This function executes the generated query and returns the
|
|
entire result as one array.
|
|
ToArray does not return the generated query anymore and
|
|
hence can only be the endpoint of a query.
|
|
However keeping a reference to the query before
|
|
executing allows to chain further statements to it.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To collect the entire result of a query toArray can be used:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices();
|
|
arangosh> query.toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "151924214",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "female/diana",
|
|
"_rev" : "152710646",
|
|
"_key" : "diana",
|
|
"name" : "Diana"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "152317430",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "152514038",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION HasNext
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_hasNext -->
|
|
|
|
`graph-query.neighbors(examples)` *Checks if the query has further results.*
|
|
<br />
|
|
<br />
|
|
The generated statement maintains a cursor for you.
|
|
If this cursor is already present *hasNext()* will
|
|
use this cursors position to determine if there are
|
|
further results available.
|
|
If the query has not yet been executed *hasNext()*
|
|
will execute it and create the cursor for you.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
Start query execution with hasNext:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices();
|
|
arangosh> query.hasNext();
|
|
true
|
|
```
|
|
<br />
|
|
Iterate over the result as long as it has more elements:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices();
|
|
```
|
|
|
|
!SUBSECTION Next
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_next -->
|
|
|
|
`graph-query.next()` *Request the next element in the result.*
|
|
<br />
|
|
<br />
|
|
The generated statement maintains a cursor for you.
|
|
If this cursor is already present *next()* will
|
|
use this cursors position to deliver the next result.
|
|
Also the cursor position will be moved by one.
|
|
If the query has not yet been executed *next()*
|
|
will execute it and create the cursor for you.
|
|
It will throw an error of your query has no further results.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
Request some elements with next:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices();
|
|
arangosh> query.next();
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "172305910",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
}
|
|
arangosh> query.next();
|
|
{
|
|
"_id" : "female/diana",
|
|
"_rev" : "173092342",
|
|
"_key" : "diana",
|
|
"name" : "Diana"
|
|
}
|
|
arangosh> query.next();
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "172699126",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
}
|
|
arangosh> query.next();
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "172895734",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
```
|
|
<br />
|
|
The cursor is recreated if the query is changed:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices();
|
|
arangosh> query.next();
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "70725110",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
}
|
|
arangosh> query.edges();
|
|
[ GraphAQL social
|
|
.vertices()
|
|
.edges() ]
|
|
arangosh> query.next();
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "71904758",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
```
|
|
|
|
!SUBSECTION Count
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_count -->
|
|
|
|
`graph-query.count()` *Returns the number of returned elements if the query is executed.*
|
|
<br />
|
|
<br />
|
|
This function determines the amount of elements to be expected within the result of the query.
|
|
It can be used at the beginning of execution of the query
|
|
before using *next()* or in between *next()* calls.
|
|
The query object maintains a cursor of the query for you.
|
|
*count()* does not change the cursor position.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To count the number of matched elements:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices();
|
|
arangosh> query.count();
|
|
4
|
|
```
|
|
|
|
!SECTION Fluent queries
|
|
|
|
After the selection of the entry point you can now query your graph in
|
|
a fluent way, meaning each of the functions on your query returns the query again.
|
|
Hence it is possible to chain arbitrary many executions one after the other.
|
|
In this section all available query statements are described.
|
|
|
|
!SUBSECTION Edges
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_edges -->
|
|
|
|
`graph-query.edges(examples)` *Select all edges for the vertices selected before.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select all edges for each of the vertices selected
|
|
in the step before.
|
|
This will include *inbound* as well as *outbound* edges.
|
|
The resulting set of edges can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all edges are valid.
|
|
* A string, only the edge having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only edges having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All edges matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered edges:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.edges().toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "61550070",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "61812214",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "61550070",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/bobAndDiana",
|
|
"_rev" : "62205430",
|
|
"_key" : "bobAndDiana",
|
|
"_from" : "male/bob",
|
|
"_to" : "female/diana",
|
|
"type" : "friend"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered edges by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.edges({type: "married"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "135278070",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "135278070",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered edges by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.edges([{type: "married"}, {type: "friend"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "149695990",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "149958134",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "149695990",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/bobAndDiana",
|
|
"_rev" : "150351350",
|
|
"_key" : "bobAndDiana",
|
|
"_from" : "male/bob",
|
|
"_to" : "female/diana",
|
|
"type" : "friend"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION OutEdges
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_outEdges -->
|
|
|
|
`graph-query.outEdges(examples)` *Select all outbound edges for the vertices selected before.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select all *outbound* edges for each of the vertices selected
|
|
in the step before.
|
|
The resulting set of edges can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all edges are valid.
|
|
* A string, only the edge having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only edges having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All edges matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered outbound edges:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.outEdges().toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "47721974",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "47984118",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "relation/bobAndDiana",
|
|
"_rev" : "48377334",
|
|
"_key" : "bobAndDiana",
|
|
"_from" : "male/bob",
|
|
"_to" : "female/diana",
|
|
"type" : "friend"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered outbound edges by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.outEdges({type: "married"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "211037686",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered outbound edges by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.outEdges([{type: "married"}, {type: "friend"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "82193910",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "82456054",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "relation/bobAndDiana",
|
|
"_rev" : "82849270",
|
|
"_key" : "bobAndDiana",
|
|
"_from" : "male/bob",
|
|
"_to" : "female/diana",
|
|
"type" : "friend"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION InEdges
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_inEdges -->
|
|
|
|
`graph-query.inEdges(examples)` *Select all inbound edges for the vertices selected before.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select all *inbound* edges for each of the vertices selected
|
|
in the step before.
|
|
The resulting set of edges can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all edges are valid.
|
|
* A string, only the edge having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only edges having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All edges matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered inbound edges:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.inEdges().toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "207629814",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered inbound edges by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.inEdges({type: "married"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "78786038",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered inbound edges by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices([{name: "Alice"}, {name: "Bob"}]);
|
|
arangosh> query.inEdges([{type: "married"}, {type: "friend"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "183774710",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION Vertices
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_vertices -->
|
|
|
|
`graph-query.vertices(examples)` *Select all vertices connected to the edges selected before.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select all vertices for each of the edges selected
|
|
in the step before.
|
|
This includes all vertices contained in *_from* as well as *_to* attribute of the edges.
|
|
The resulting set of vertices can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all vertices are valid.
|
|
* A string, only the vertex having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only vertices having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All vertices matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered vertices:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.vertices().toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "95759862",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "96153078",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "female/diana",
|
|
"_rev" : "96546294",
|
|
"_key" : "diana",
|
|
"name" : "Diana"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "96349686",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered vertices by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.vertices({name: "Alice"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "203042294",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered vertices by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.vertices([{name: "Alice"}, {name: "Charly"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "56962550",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "57552374",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION FromVertices
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_fromVertices -->
|
|
|
|
`graph-query.vertices(examples)` *Select all vertices where the edges selected before start.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select the set of vertices where the edges selected
|
|
in the step before start at.
|
|
This includes all vertices contained in *_from* attribute of the edges.
|
|
The resulting set of vertices can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all vertices are valid.
|
|
* A string, only the vertex having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only vertices having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All vertices matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered starting vertices:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.fromVertices().toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "175713782",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "176303606",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered starting vertices by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.fromVertices({name: "Alice"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "99167734",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered starting vertices by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.fromVertices([{name: "Alice"}, {name: "Charly"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "158739958",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "159329782",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION ToVertices
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_toVertices -->
|
|
|
|
`graph-query.vertices(examples)` *Select all vertices targeted by the edges selected before.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select the set of vertices where the edges selected
|
|
in the step before end in.
|
|
This includes all vertices contained in *_to* attribute of the edges.
|
|
The resulting set of vertices can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all vertices are valid.
|
|
* A string, only the vertex having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only vertices having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All vertices matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered starting vertices:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices().toArray();
|
|
[
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "102968822",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "female/diana",
|
|
"_rev" : "103362038",
|
|
"_key" : "diana",
|
|
"name" : "Diana"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered starting vertices by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices({name: "Alice"}).toArray();
|
|
[ ]
|
|
```
|
|
<br />
|
|
To request filtered starting vertices by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices([{name: "Alice"}, {name: "Charly"}]).toArray();
|
|
[ ]
|
|
```
|
|
|
|
!SUBSECTION Neighbors
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_neighbors -->
|
|
|
|
`graph-query.neighbors(examples)` *Select all neighbors of the vertices selected in the step before.*
|
|
<br />
|
|
<br />
|
|
Creates an AQL statement to select all neighbors for each of the vertices selected
|
|
in the step before.
|
|
The resulting set of vertices can be filtered by defining one or more *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* Empty, there is no matching executed all vertices are valid.
|
|
* A string, only the vertex having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only vertices having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All vertices matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
To request unfiltered neighbors:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.neighbors().toArray();
|
|
[
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "186396150",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "186592758",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered neighbors by a single example:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.neighbors({name: "Bob"}).toArray();
|
|
[
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "137899510",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
To request filtered neighbors by multiple examples:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.vertices([{name: "Bob"}, {name: "Charly"}]).toArray();
|
|
[
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "67710454",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "67907062",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
|
|
!SUBSECTION Restrict
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_restrict -->
|
|
|
|
`graph-query.restrict(restrictions)` *Restricts the last statement in the chain to return only elements of a specified set of collections*
|
|
<br />
|
|
<br />
|
|
By default all collections in the graph are searched for matching elements
|
|
whenever vertices and edges are requested.
|
|
Using *restrict* after such a statement allows to restrict the search
|
|
to a specific set of collections within the graph.
|
|
Restriction is only applied to this one part of the query.
|
|
It does not effect earlier or later statements.
|
|
<br />
|
|
*restrictions* can have the following values:
|
|
<br />
|
|
* A string defining the name of one specific collection in the graph.
|
|
Only elements from this collection are used for matching
|
|
* A list of strings defining a set of collection names.
|
|
Elements from all collections in this set are used for matching
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
Request all directly connected vertices unrestricted:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.edges().vertices().toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "199634422",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "200027638",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "199634422",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "200224246",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
Apply a restriction to the directly connected vertices:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.edges().vertices().restrict("female").toArray();
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "155332086",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "155332086",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
Restriction of a query is only valid for collections known to the graph:
|
|
//
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.edges().vertices().restrict(["female", "male", "products"]).toArray();
|
|
[ArangoError 10: vertex collections: products are not known to the graph]
|
|
```
|
|
|
|
!SUBSECTION Filter
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_filter -->
|
|
|
|
`graph-query.filter(examples)` *Filter the result of the query*
|
|
<br />
|
|
<br />
|
|
This can be used to further specfiy the expected result of the query.
|
|
The result set is reduced to the set of elements that matches the given *examples*.
|
|
<br />
|
|
*examples* can have the following values:
|
|
<br />
|
|
* A string, only the elements having this value as it's id is returned.
|
|
* An example object, defining a set of attributes.
|
|
Only elements having these attributes are matched.
|
|
* A list containing example objects and/or strings.
|
|
All elements matching at least one of the elements in the list are returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
Request vertices unfiltered:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices().toArray();
|
|
[
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "141307382",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
},
|
|
{
|
|
"_id" : "female/diana",
|
|
"_rev" : "141700598",
|
|
"_key" : "diana",
|
|
"name" : "Diana"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
Request vertices filtered:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices().filter({name: "Alice"}).toArray();
|
|
[ ]
|
|
```
|
|
<br />
|
|
Request edges unfiltered:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices().outEdges().toArray();
|
|
[
|
|
{
|
|
"_id" : "relation/bobAndDiana",
|
|
"_rev" : "163982838",
|
|
"_key" : "bobAndDiana",
|
|
"_from" : "male/bob",
|
|
"_to" : "female/diana",
|
|
"type" : "friend"
|
|
}
|
|
]
|
|
```
|
|
<br />
|
|
Request edges filtered:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._edges({type: "married"});
|
|
arangosh> query.toVertices().outEdges().filter({type: "married"}).toArray();
|
|
[ ]
|
|
```
|
|
|
|
!SUBSECTION Path
|
|
|
|
<!-- @startDocuBlock JSF_general_graph_fluent_aql_path -->
|
|
|
|
`graph-query.path()` *The result of the query is the path to all elements.*
|
|
<br />
|
|
<br />
|
|
By defaut the result of the generated AQL query is the set of elements passing the last matches.
|
|
So having a *vertices()* query as the last step the result will be set of vertices.
|
|
Using *path()* as the last action before requesting the result
|
|
will modify the result such that the path required to find the set vertices is returned.
|
|
<br />
|
|
@EXAMPLES
|
|
<br />
|
|
Request the iteratively explored path using vertices and edges:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.outEdges().toVertices().path().toArray();
|
|
[
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "63909366",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "65089014",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "64302582",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "63909366",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "65351158",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "64499190",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
]
|
|
```
|
|
<br />
|
|
When requesting neighbors the path to these neighbors is expanded:
|
|
<br />
|
|
|
|
```
|
|
arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
|
|
arangosh> var g = examples.loadGraph("social");
|
|
arangosh> var query = g._vertices({name: "Alice"});
|
|
arangosh> query.neighbors().path().toArray();
|
|
[
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "74198518",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"edges" : [
|
|
{
|
|
"_id" : "relation/aliceAndBob",
|
|
"_rev" : "75378166",
|
|
"_key" : "aliceAndBob",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/bob",
|
|
"type" : "married"
|
|
}
|
|
],
|
|
"vertices" : [
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "74198518",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/bob",
|
|
"_rev" : "74591734",
|
|
"_key" : "bob",
|
|
"name" : "Bob"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "74198518",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"edges" : [
|
|
{
|
|
"_id" : "relation/aliceAndCharly",
|
|
"_rev" : "75640310",
|
|
"_key" : "aliceAndCharly",
|
|
"_from" : "female/alice",
|
|
"_to" : "male/charly",
|
|
"type" : "friend"
|
|
}
|
|
],
|
|
"vertices" : [
|
|
{
|
|
"_id" : "female/alice",
|
|
"_rev" : "74198518",
|
|
"_key" : "alice",
|
|
"name" : "Alice"
|
|
},
|
|
{
|
|
"_id" : "male/charly",
|
|
"_rev" : "74788342",
|
|
"_key" : "charly",
|
|
"name" : "Charly"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
]
|
|
```
|
|
|