- OrientDB - Console Modes
- OrientDB - Data Types
- OrientDB - Basic Concepts
- OrientDB - Installation
- OrientDB - Overview
- OrientDB - Home
OrientDB Database Commands
- OrientDB - Drop Database
- OrientDB - Optimize Database
- OrientDB - Rollback Database
- OrientDB - Commit Database
- OrientDB - Import Database
- OrientDB - Export Database
- OrientDB - Config Database
- OrientDB - Release Database
- OrientDB - Freeze Database
- OrientDB - List Database
- OrientDB - Info Database
- OrientDB - Disconnect Database
- OrientDB - Connect Database
- OrientDB - Restore Database
- OrientDB - Backup Database
- OrientDB - Alter Database
- OrientDB - Create Database
OrientDB Record Commands
- OrientDB - Delete Record
- OrientDB - Truncate Record
- OrientDB - Update Record
- OrientDB - Export Record
- OrientDB - Reload Record
- OrientDB - Load Record
- OrientDB - Display Records
- OrientDB - Insert Record
OrientDB Class Commands
OrientDB Cluster Commands
- OrientDB - Drop Cluster
- OrientDB - Truncate Cluster
- OrientDB - Alter Cluster
- OrientDB - Create Cluster
OrientDB Property Commands
OrientDB Vertex Commands
OrientDB Edge Commands
OrientDB Advanced Concepts
- OrientDB - Studio
- OrientDB - Security
- OrientDB - Upgrading
- OrientDB - Performance Tuning
- OrientDB - Logging
- OrientDB - Caching
- OrientDB - Hooks
- OrientDB - Transactions
- OrientDB - Indexes
- OrientDB - Sequences
- OrientDB - Functions
OrientDB Interfaces
OrientDB Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
OrientDB - Create Edge
In OrientDB, the concept Edge works pke a relation between vertices with the help of some properties. Edges and vertices are the main components of a graph database. It apppes polymorphism on Edges. The base class for an Edge is E. While implementing edges, if source or destination vertices are missing or don’t exist, then the transaction will be rollback.
The following statement is the basic syntax of Create Edge Command.
CREATE EDGE <class> [CLUSTER <cluster>] FROM <rid>|(<query>)|[<rid>]* TO <rid>|(<query>)|[<rid>]* [SET <field> = <expression>[,]*]|CONTENT {<JSON>} [RETRY <retry> [WAIT <pauseBetweenRetriesInMs]] [BATCH <batch-size>]
Following are the details about the options in the above syntax.
<class> − Defines the class name for the edge.
<cluster> − Defines the cluster in which you want to store the edge.
JSON − Provides JSON content to set as the record.
RETRY − Defines the number of retries to attempt in the event of confpct.
WAIT − Defines the time to delay between retries in milpseconds.
BATCH − Defines whether it breaks the command down into smaller blocks and the size of the batches.
Example
Execute the following query to create an edge E between two vertices #9:0 and #14:0.
orientdb> CREATE EDGE FROM #11:4 TO #13:2
If the above query is executed successfully, you will get the following output.
Created edge [e[#10:0][#9:0->#14:0]] in 0.012000 sec(s)
Execute the following query to create a new edge type and an edge of new type.
orientdb> CREATE CLASS E1 EXTENDS E orientdb> CREATE EDGE E1 FROM #10:3 TO #11:4
If the above query is executed successfully, you will get the following output.
Created edge [e[#10:1][#10:3->#11:4]] in 0.011000 sec(s)Advertisements