1
0
Fork 0
arangodb/Documentation/Books/Users/Blueprint-Graphs/EdgeMethods.md

3.0 KiB

Edge Methods

edge.getId()

Returns the identifier of the edge.

Examples

arango> v = g.addVertex("v");
Vertex("v")

arango> e = g.addEdge(v, v, 1, "self");
Edge(1)

arango> e.getId();
1

edge.getInVertex()

Returns the vertex at the head of the edge.

Examples

arango> v1 = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "self");
Edge(2)

arango> e.getInVertex();
Vertex(1)

edge.getLabel()

Returns the label of the edge.

Examples

arango> v = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "knows");
Edge(2)

arango> e.getLabel();
knows

edge.getOutVertex()

Returns the vertex at the tail of the edge.

Examples

arango> v = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "self");
Edge(2)

arango> e.getOutVertex();
Vertex(1)

edge.getPeerVertex( vertex)

Returns the peer vertex of the edge and the vertex.

Examples

arango> v1 = g.addVertex("1");
Vertex("1")
arango> v2 = g.addVertex("2");
Vertex("2")
arango> e = g.addEdge(v1, v2, "1->2", "knows");
Edge("1->2")
arango> e.getPeerVertex(v1);
Vertex(2)

edge.getProperty( name)

Returns the property name an edge.

Examples

arango> v = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "self", { "weight" : 10 });
Edge(2)

arango> e.getProperty("weight");
10

edge.getPropertyKeys()

Returns all propety names an edge.

Examples

arango> v = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "self", { weight: 10 })
Edge(2)

arango> e.getPropertyKeys()
[ "weight" ]

arango> e.setProperty("name", "Hugo");
Hugo

arango> e.getPropertyKeys()
[ "weight", "name" ]

edge.properties()

Returns all properties and their values of an edge

Examples

arango> v = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "knows");
Edge(2)

arango> e.properties();
{ "weight" : 10 }

edge.setProperty( name, value)

Changes or sets the property name an edges to value.

Examples

arango> v = g.addVertex(1);
Vertex(1)

arango> e = g.addEdge(v, v, 2, "self", { weight: 10 })
Edge(2)

arango> e.getPropert("weight")
10

arango> e.setProperty("weight", 20);
20

arango> e.getPropert("weight")
20