-
Notifications
You must be signed in to change notification settings - Fork 5
Properties
topofocus edited this page Mar 29, 2019
·
14 revisions
Although OrientDB has a schema-less-mode, where any properties are dynamically assigned, indexes and relations are as important as in conventional RDBMS.
ActiveOrient offers a Ruby way to define most common Properties and Indexes
ORD.create_class :M
--> INFO->CREATE CLASS M
=> M
M.properties
=> {:properties=>nil, :indexes=>nil}
M.create_property :symbol # the default-case: type: :string, no index
M.create_property :con_id, type: :integer
M.create_property :details, type: :link, other_class: 'Contracts'
M.create_property :items, type: :linklist, :linklist: Item
M.create_property :symbol
M.create_property :con_id, type: :integer
M.create_property :name, index: :unique # # or M.create_property( 'name' ){ :unique }
--> INFO->CREATE INDEX M.name UNIQUE
--> INFO->Index on M based on name created.
M.create_property :details, type: :link, other_class: 'Contracts'
--> WARN->Classname "Contracts" ://: not present in temp
-->ERROR->Properties in M were NOT created
-->ERROR->The Error was: property named details is declared as LINK but linked Class is not declared
ORD.create_vertex_class :Contracts
--> INFO->CREATE CLASS Contracts EXTENDS V
=> Contracts
M.create_property :details, type: :link, other_class: 'Contracts'
pp M.properties
{:properties=>
[{"name"=>"symbol", "type"=>"STRING", ... }
{"name"=>"con_id", "type"=>"INTEGER", ... },
{"name"=>"name", "type"=>"STRING", ... },
{"name"=>"details", "linkedClass"=>"Contracts", "type"=>"LINK", ...},
],
:indexes=>[{"name"=>"M.name", "type"=>"UNIQUE", "fields"=>["name"]}]
}(to be continued)
Overview
Data Management
- Joining Tables, embedded Lists
- Links and Link Lists
- Relations
- Bidirectional Connections
- Working with Hashes
Public API
- Database
- Model CRUD
Misc