SQL - CREATE VERTEX
Creates a new vertex in the database.
The Vertex and Edge are the main components of a Graph database. OrientDB supports polymorphism on vertices. The base class for a vertex is V.
Syntax
CREATE VERTEX [<class>] [CLUSTER <cluster>] [SET <field> = <expression>[,]*]
<class>Defines the class to which the vertex belongs.<cluster>Defines the cluster in which it stores the vertex.<field>Defines the field you want to set.<expression>Defines the express to set for the field.
|----|----|
|
| NOTE: When using a distributed database, you can create vertexes through two steps (creation and update). Doing so can break constraints defined at the class-level for vertices. To avoid these issues, disable constraints in the vertex class.|
Examples
Create a new vertex on the base class
V:orientdb>CREATE VERTEXCreate a new vertex class, then create a vertex in that class:
orientdb>CREATE CLASS V1 EXTENDS Vorientdb>CREATE VERTEX V1Create a new vertex within a particular cluster:
orientdb>CREATE VERTEX V1 CLUSTER recentCreate a new vertex, defining its properties:
orientdb>CREATE VERTEX SET brand = 'fiat'Create a new vertex of the class
V1, defining its properties:orientdb>CREATE VERTEX V1 SET brand = 'fiat', name = 'wow'Create a vertex using JSON content:
orientdb>CREATE VERTEX Employee CONTENT { "name" : "Jay", "surname" : "Miner" }
For more information, see
History
1.4
Command begins using the Blueprints API. When using Java with the OGraphDatabase API, you may experience unexpected results in how it manages edges.
To force the command to work with the older API, update the GraphDB settings, use the
ALTER DATABASEcommand.
1.1
- Initial implementation of feature.