- 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 - Alter Class
Class and Property in OrientDB are used to build a schema with the respective attributes such as class name, super-class, cluster, number of clusters, Abstract, etc. If you want to modify or update any attribute of existing classes in the schema then you have to use Alter Class command.
The following statement is the basic syntax of the Alter Class Command.
ALTER CLASS <class> <attribute-name> <attribute-value>
Following are the details about the options in the above syntax.
<class> − Defines the class name.
<attribute-name> − Defines the attribute you want to change.
<attribute-value> − Defines the value you want to set for the attribute.
The following table defines the pst of attributes that support Alter Class command.
Attribute | Type | Description |
---|---|---|
NAME | String | Changes the class name. |
SHORTNAME | String | Defines a short name, (that is, an apas), for the class. Use NULL to remove a short name assignment. |
SUPERCLASS | String | Defines a super-class for the class. To add a new class, you can use the syntax +<class>, to remove it use -<class>. |
OVERSIZE | Decimal number | Defines the oversize factor. |
ADDCLUSTER | String | Adds a cluster to the class. If the cluster doesn t exist, it creates a physical cluster. Adding clusters to a class is also useful in storing records in distributed servers. |
REMOVECLUSTER | String | Removes a cluster from a class. It does not delete the cluster, only removes it from the class. |
STRICTMODE | - | Enables or disables strict mode. When in strict mode, you work in schema-full mode and cannot add new properties to a record if they are part of the class schema definition. |
CLUSTERSELECTION | - | Defines the selection strategy in choosing which cluster it uses for new records. |
CUSTOM | - | Defines custom properties. Property names and values must follow the syntax <propertyname>=<value> without spaces between the name and value. |
ABSTRACT | Boolean | Converts class to an abstract class or the opposite. |
Example
Let us try few examples that will update or modify the attributes of the existing class.
The following query is used to define a super-class ‘Person’ for an existing class ‘Employee’.
orientdb> ALTER CLASS Employee SUPERCLASS Person
If the above query is executed successfully, you will get the following output.
Class altered successfully
The following query is used to add a super-class ‘Person’ for an existing class ‘Employee’.
orientdb> ALTER CLASS Employee SUPERCLASS +Person
If the above query is executed successfully, you will get the following output.
Class altered successfullyAdvertisements