OrientDB upholds multi-model element and gives various courses in drawing nearer and understanding the essential ideas of an information base. In any case, we can without much of a stretch access these models from the point of view of Document data set API. Like RDBMS, OrientDB likewise utilizes the Record as a component of capacity yet it utilizes the Document type. Reports are put away as Key/Value sets. We are putting away fields and properties as key/esteem sets which have a place with an ideas class.
Class is a kind of information model and the idea is drawn from the Object-arranged programming worldview. In light of the conventional archive information base model, information is put away as assortment, while in the social data set model information it is put away in tables. OrientDB follows the Document API alongside OPPS worldview. As an idea, class in OrientDB has the nearest relationship with the table in social information bases, however (in contrast to tables) classes can be outline less, mapping full or blended. Classes can acquire from different classes, making trees of classes. Each class has its own group or bunches, (made of course, if none are characterized).
The accompanying assertion is the fundamental language structure of the Create Class Command.
CREATE CLASS <class>
[EXTENDS <super-class>]
[CLUSTER <cluster-id>*]
[CLUSTERS <total-cluster-number>]
[ABSTRACT]
Following are the insights concerning the choices in the above punctuation.
- <class> − Defines the name of the class you need to make.
- <super-class> − Defines the super-class you need to stretch out with this class.
- <total-group number> − Defines the absolute number of bunches utilized in this class. Default is 1.
- ABSTARCT − Defines the class is conceptual. This is discretionary.
Example
As talked about, class is an idea identified with table. Subsequently here we will make a table Account. In any case, while making class we can't characterize fields i.e., properties dependent on OOPS worldview.
The accompanying order is to make a class named Account.
orientdb> CREATE CLASS Account
In the event that the above order is executed effectively, you will get the accompanying yield.
Class created successfully
You can utilize the accompanying order to make a class Car which reaches out to class Vehicle.
orientdb> CREATE CLASS Car EXTENDS Vehicle
In the event that the above order is executed effectively, you will get the accompanying yield.
Class created successfully
You can utilize the accompanying order to make a class Person as conceptual.
orientdb> CREATE CLASS Person ABSTRACT
In the event that the above order is executed effectively, you will get the accompanying yield.
Class created successfully
Note − Without having properties, the class is pointless and unfit to assemble genuine article. In the further sections, you can figure out how to make properties for a specific class.