Documentation/Graph Query Language
CREATE TYPE
This statement creates a single user-defined type. If you want to add multiple types at once please use the CREATE TYPES query. ‘CREATE TYPES’ is mandatory if you have circular dependencies within your type definitions.
CREATE TYPE identifier
[ EXTENDS identifier ]
[ ATTRIBUTES ( attr_definition ) ]
[ BACKWARDEDGES ( backwardedges_list ) ]
[ UNIQUE ( identifier_list ) ]
[ INDICES ( IndexOptOnCreateType ) ]
- The keyword ‘EXTENDS’ followed by any identifier can be used to inherit the base type definition from another type (called supertype).
- Additional attributes can be added using the ‘ATTRIBUTES’ keyword followed by a bracketed list of attribute definitions.
- Backwardegeds can be added using the ‘BACKWARDEDGES’ keyword followed by a bracketed list of backwardedges.
- The keyword ‘UNIQUE’ followed by a bracketed list of attributes will define a uniqueness constraint. Having a ‘UNIQUE ( Name, Age )’ constraint will deny an ‘INSERT’ query if the combination of the attributes ‘Name’ and ‘Age’ is already present within the database.
IndexOptOnCreateType
( ( identifier [ UNIQUE ] [ EDITION identifier ] [ INDEXTYPE identifier]
ON index_attribute_list ) [, (...) ] )
- CREATE TYPE User
ATTRIBUTES (String Name, Integer Age)
INDICES ((Idx_Name ON Name), (Idx_Age INDEXTYPE HashTable ON Age))” - CREATE TYPE User
ATTRIBUTES (String Name, Integer Age)
INDICES ((Idx_Name UNIQUE EDITION myEdition INDEXTYPE HashTable ON Name))” - CREATE TYPE User
ATTRIBUTES (String Name, Integer Age)
INDICES ((Name, Age))”
