SQL - CREATE PROPERTY
The Create Property command creates a new property in the schema. You need to create the class before.
Syntax
CREATE PROPERTY <class>.<property> <type> [<linked-type>|<linked-class>]
Where:
- class is the class of the schema
- property, is the property created into the class
- type, the type of the property. See Types. It can be:
- boolean
- integer
- short
- long
- float
- double
- date
- string
- binary
- embedded
- embeddedlist, this is an ordered collection of items that supports duplicates. Optionally accepts the parameter linked-type or linked-class to specify the collection's content
- embeddedset, this is an unordered collection of items that doesn't support duplicates. Optionally accepts the parameter linked-type or linked-class to specify the collection's content
- embeddedmap, this is a map of key/value entries. Optionally accepts the parameter linked-type or linked-class to specify the map's value content
- link
- linklist, this is an ordered collection of items that supports duplicates. Optionally accepts the parameter linked-class to specify the linked record's class
- linkset, this is an unordered collection of items that doesn't support duplicates. Optionally accepts the parameter linked-class to specify the linked record's class
- linkmap, this is a map of key/ entries. Optionally accepts the parameter linked-class to specify the map's value record class
- byte
- linked-type, the contained type in EMBEDDEDSET, EMBEDDEDLIST and EMBEDDEDMAP types (see above). See also Types. It can be:
- boolean
- integer
- short
- long
- float
- double
- date
- string
- binary
- embedded
- link
- byte
- linked-class, the contained class in containers (see above).
Examples
Create the property 'name' of type 'STRING' in class 'User':
CREATE PROPERTY user.name STRING
Create a list of Strings as property 'tags' of type 'EMBEDDEDLIST' in class 'Profile'. The linked type is 'STRING':
CREATE PROPERTY profile.tags EMBEDDEDLIST STRING
Create the property 'friends' of type 'EMBEDDEDMAP' in class 'Profile'. The linked class is profile itself (circular references):
CREATE PROPERTY profile.friends EMBEDDEDMAP Profile
To remove a property use the SQL Drop Property command.
To know more about other SQL commands look at SQL commands.
This is a command of the Orient console. To know all the commands go to Console-Commands.