Skip to content
lvca edited this page Dec 22, 2012 · 2 revisions

SQL Create Edge

This command creates a new Edge into the database. Edges, together with Vertices, are the main components of a Graph-Database. An Edge is a document of class OGraphEdge or a sub-class. Look also how to Create Vertex.

Syntax

    CREATE EDGE [<class>] [CLUSTER <cluster>] FROM <rid>|(<query>)|[<rid>]* TO <rid>|(<query>)|[<rid>]* [SET <field> = <expression>[,]*]

Available Since

  • 1.1.0: the command
  • 1.2.0: the support for query and collection of RIDs in FROM/TO

Examples

Create a new edge between two vertices of the base class 'E', namely OGraphEdge

    > create edge from #10:3 to #11:4

Create a new edge type and a new edge of the new type

    > create class E1 extends E
    > create edge E1 from #10:3 to #11:4

Create a new edge in a particular cluster

    > create edge E1 cluster EuropeEdges from #10:3 to #11:4

Create a new edge setting properties

    > create edge from #10:3 to #11:4 set brand = 'fiat'

Create a new edge of type E1 setting properties

    > create edge E1 from #10:3 to #11:4 set brand = 'fiat', name = 'wow'

Create new edges of type Watched between all the action Movies and me using sub-queries

    > create edge Watched from (select from account where name = 'Luca') to (select from movies where type.name = 'action')

To know more about other SQL commands look at SQL commands.

Clone this wiki locally