active-orient 0.6 → 0.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile +4 -10
- data/Guardfile +4 -12
- data/README.md +198 -261
- data/VERSION +1 -1
- data/active-orient-0.4.gem +0 -0
- data/active-orient-0.41.gem +0 -0
- data/active-orient.gemspec +5 -6
- data/config/boot.rb +0 -84
- data/config/connect.yml +4 -8
- data/examples/books.rb +39 -86
- data/examples/streets.rb +84 -85
- data/lib/active-orient.rb +9 -57
- data/lib/base.rb +145 -172
- data/lib/base_properties.rb +44 -40
- data/lib/model.rb +468 -0
- data/lib/orient.rb +60 -114
- data/lib/query.rb +73 -71
- data/lib/rest.rb +1059 -0
- data/lib/support.rb +319 -386
- data/test.rb +4 -0
- data/usecase.md +91 -0
- metadata +20 -65
- data/bin/active-orient-console +0 -38
- data/config/config.yml +0 -10
- data/create_project +0 -19
- data/examples/test_commands.rb +0 -92
- data/examples/test_commands_2.rb +0 -54
- data/examples/test_commands_3.rb +0 -48
- data/examples/test_commands_4.rb +0 -28
- data/examples/time_graph.md +0 -162
- data/gratefuldeadconcerts.md +0 -94
- data/lib/class_utils.rb +0 -300
- data/lib/database_utils.rb +0 -106
- data/lib/init.rb +0 -45
- data/lib/java-api.rb +0 -437
- data/lib/jdbc.rb +0 -211
- data/lib/model/edge.rb +0 -55
- data/lib/model/model.rb +0 -91
- data/lib/model/the_class.rb +0 -500
- data/lib/model/the_record.rb +0 -322
- data/lib/model/vertex.rb +0 -136
- data/lib/orientdb_private.rb +0 -48
- data/lib/other.rb +0 -330
- data/lib/rest/change.rb +0 -137
- data/lib/rest/create.rb +0 -488
- data/lib/rest/delete.rb +0 -134
- data/lib/rest/operations.rb +0 -160
- data/lib/rest/read.rb +0 -150
- data/lib/rest/rest.rb +0 -112
- data/lib/rest_disabled.rb +0 -24
- data/linkmap.md +0 -75
- data/namespace.md +0 -111
- data/old_lib_functions/two_general_class.rb +0 -139
- data/rails.md +0 -125
- data/rails/activeorient.rb +0 -53
- data/rails/config.yml +0 -10
- data/rails/connect.yml +0 -17
- data/usecase_oo.md +0 -61
data/lib/rest_disabled.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
=begin #nodoc#
|
2
|
-
If properties are allocated on class-level, they can be preinitialized using
|
3
|
-
this method.
|
4
|
-
This is disabled for now, because it does not seem nessesary
|
5
|
-
=end
|
6
|
-
|
7
|
-
def preallocate_class_properties o_class
|
8
|
-
p= get_class_properties( o_class )['properties']
|
9
|
-
unless p.nil? || p.blank?
|
10
|
-
predefined_attributes = p.map do | property |
|
11
|
-
[ property['name'] ,
|
12
|
-
case property['type']
|
13
|
-
when 'LINKMAP'
|
14
|
-
Array.new
|
15
|
-
when 'STRING'
|
16
|
-
''
|
17
|
-
else
|
18
|
-
nil
|
19
|
-
end ]
|
20
|
-
end.to_h
|
21
|
-
else
|
22
|
-
{}
|
23
|
-
end
|
24
|
-
end
|
data/linkmap.md
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# Joining Tables
|
2
|
-
|
3
|
-
The most important difference between OrientDB and a Relational Database is that relationships are represented by LINKS instead of JOINs.
|
4
|
-
|
5
|
-
For this reason, the classic JOIN syntax is not supported. OrientDB uses the "dot (.) notation" to navigate LINKS
|
6
|
-
(OrientDB-documation)
|
7
|
-
|
8
|
-
This is supported by ActiveOrient in a very convient way.
|
9
|
-
|
10
|
-
## Playing with Arrays and Linkmaps
|
11
|
-
|
12
|
-
Linkmaps are the OrientDB equivalent to joined tables
|
13
|
-
Formally, they are ordinary arrays.
|
14
|
-
|
15
|
-
They can be created schemaless
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
DB.create_class :industry
|
19
|
-
DB.create_class :property
|
20
|
-
property_record= Property.create con_id: 12346, property: []
|
21
|
-
industries = ['Construction','HealthCare','Bevarage']
|
22
|
-
industries.each{| industry | property_record.property << Industry.create( label: industry ) }
|
23
|
-
|
24
|
-
Property.last
|
25
|
-
=> #<Property:0x00000001d1a938 @metadata={"type"=>"d", (...)},
|
26
|
-
@attributes={"con_id"=>12346, "property"=>["#34:0", "#35:0", "#36:0"],
|
27
|
-
"created_at"=>"2017-02-01T06:28:17.332 01:00", "updated_at"=>"2017-02-01T06:28:17.344 01:00"}>
|
28
|
-
```
|
29
|
-
|
30
|
-
Stored data in this array is accessible via
|
31
|
-
|
32
|
-
```ruby
|
33
|
-
p = Property.last
|
34
|
-
p.property.label
|
35
|
-
=> ["Construction", "HealthCare", "Bevarage"]
|
36
|
-
p.property[2].label
|
37
|
-
=> "Bevarage"
|
38
|
-
p.property.label[2]
|
39
|
-
=> "Bevarage"
|
40
|
-
p.property[2].label[2]
|
41
|
-
=> "v"
|
42
|
-
|
43
|
-
p.property.remove_at 2
|
44
|
-
p.property.label
|
45
|
-
=> ["Construction", "HealthCare"]
|
46
|
-
|
47
|
-
p.property[2] = Industry.where(label:'Bevarage').first
|
48
|
-
p.property.label
|
49
|
-
=> ["Construction", "HealthCare", "Bevarage"]
|
50
|
-
```
|
51
|
-
|
52
|
-
The Elements of the Array can be treated like common ruby Arrays. Manipulations are
|
53
|
-
performed in ruby-spac. Simply call
|
54
|
-
```ruby
|
55
|
-
p.update
|
56
|
-
```
|
57
|
-
to transfer the changes into the database. This approach can be extended to linked records as well
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
p.property[2].label = 'zu'
|
61
|
-
p.property[2].update
|
62
|
-
p.property.label
|
63
|
-
=> ["Construction", "HealthCare", "zu"]
|
64
|
-
Industry.last.label
|
65
|
-
=> "zu"
|
66
|
-
|
67
|
-
|
68
|
-
```
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
(to be continued)
|
74
|
-
|
75
|
-
|
data/namespace.md
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
## Namespace Support
|
2
|
-
|
3
|
-
Consider a project, where different tasks are clearly separated.
|
4
|
-
|
5
|
-
A common case is, to concentrate any gathering of raw data in a separate module, maybe even in a gem.
|
6
|
-
|
7
|
-
ActiveOrient enables this by switching the "ActiveOrient::Model.namespace" directive.
|
8
|
-
|
9
|
-
In out case, the "ib-ruby" gem gets data through an api
|
10
|
-
The gem provides the logic to convert the raw-data from the server to ActiveOrient::Model-Objects.
|
11
|
-
Its located in the model-directory of the gem.
|
12
|
-
|
13
|
-
Just by including the gem in the Gemfile and requiring the gem, anything is available in our project.
|
14
|
-
|
15
|
-
The gem defines the ActiveOrient-Environment as follows:
|
16
|
-
```ruby
|
17
|
-
module IB
|
18
|
-
module ORD
|
19
|
-
include ActiveOrient::Init # namespace support
|
20
|
-
mattr_accessor :login
|
21
|
-
|
22
|
-
# establishes a connection to the Database and returns the Connection-Object (an ActiveOrient::OrientDB. …instance)
|
23
|
-
def self.connect
|
24
|
-
|
25
|
-
c = { :server => 'localhost', :port => 2480, :protocol => 'http',
|
26
|
-
:user => 'root', :password => 'root', :database => 'temp' }.merge login.presence || {}
|
27
|
-
ActiveOrient.default_server= { user: c[:user], password: c[:password] , server: c[:server], port: c[:port] }
|
28
|
-
ActiveOrient.database = c[:database]
|
29
|
-
logger = Logger.new '/dev/stdout'
|
30
|
-
ActiveOrient::Init.define_namespace { IB }
|
31
|
-
project_root = File.expand_path('../..', __FILE__)
|
32
|
-
|
33
|
-
ActiveOrient::Model.model_dir = "#{project_root}/models"
|
34
|
-
ActiveOrient::OrientDB.new preallocate: true # connect via http-rest
|
35
|
-
|
36
|
-
(...)
|
37
|
-
```
|
38
|
-
The gem scans through all database classes present, and allocates only those, where a model-file
|
39
|
-
is found in the model-directory.
|
40
|
-
|
41
|
-
This takes place by requiring 'ib-ruby' in 'config/boot.rb'
|
42
|
-
|
43
|
-
```ruby
|
44
|
-
76 #read the configuration and model-files from the ib-ruby gem directotry
|
45
|
-
77 require 'ib/ord'
|
46
|
-
78 IB::ORD.login= ActiveOrient.default_server.merge database: ActiveOrient.database
|
47
|
-
79 require 'ib-ruby' # automatically connects to the database
|
48
|
-
80
|
49
|
-
81 # set the model-file for the time-graph
|
50
|
-
82 module TG
|
51
|
-
83 end
|
52
|
-
84 ActiveOrient::Model.model_dir = "#{project_root}/model"
|
53
|
-
85 ActiveOrient::Init.define_namespace { TG }
|
54
|
-
86 puts "Namespace changed: #{ActiveOrient::Model.namespace}"
|
55
|
-
87 ActiveOrient::OrientDB.new preallocate: true
|
56
|
-
|
57
|
-
```
|
58
|
-
|
59
|
-
After row 80, the namspace is changed to "TG" (TimeGraph). The example provides a gem as well. Just
|
60
|
-
»require 'orientdb_time_graph'« and call »TG.connect« to include it properly.
|
61
|
-
|
62
|
-
The code above shows how to integrate the classes within the structure of the project. The difference is the placement
|
63
|
-
of the model-files. With the gem, they are located in the root-directory of the gem. The other approach looks in the model-directory of the project (model/tg).
|
64
|
-
|
65
|
-
Before we start, we switch to the object-layer, where we want to define the working-classes. Their
|
66
|
-
logic is defined in model-files in 'model'. And we want to make shure, that all database-classes are allocated
|
67
|
-
to ruby classes.
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
97 ActiveOrient::Init.define_namespace :object
|
71
|
-
98 ActiveOrient::Model.keep_models_without_file = true
|
72
|
-
99 ORD = ActiveOrient::OrientDB.new preallocate: true
|
73
|
-
```
|
74
|
-
|
75
|
-
**note** The preallocation-algorithm trys to load any class. If »ActiveOrient::Model.keep_models_without_file«
|
76
|
-
is set to false, classes are allocated only, if a model-file is present. As a consequence, any appropopiate
|
77
|
-
model-file is loaded.
|
78
|
-
|
79
|
-
Any previously allocated class can thus be extended, providing a proper model-file. For example: If we
|
80
|
-
allocated a class «Contract« in the namspace »IB«, methods for this class are included from the model-dir specified in the gem *and* in the actual-model-directory ( in this case: model/ib/contract.rb ).
|
81
|
-
|
82
|
-
|
83
|
-
As a result something like this appears:
|
84
|
-
|
85
|
-
```
|
86
|
-
DB-Class -> Ruby-Object
|
87
|
-
V -> V
|
88
|
-
E -> E
|
89
|
-
contract -> IB::Contract
|
90
|
-
bag -> IB::Bag
|
91
|
-
forex -> IB::Forex
|
92
|
-
future -> IB::Future
|
93
|
-
option -> IB::Option
|
94
|
-
stock -> IB::Stock
|
95
|
-
account -> IB::Account
|
96
|
-
bar -> IB::Bar
|
97
|
-
contract_detail -> IB::ContractDetail
|
98
|
-
day_of -> TG::DAY_OF
|
99
|
-
time_of -> TG::TIME_OF
|
100
|
-
time_base -> TG::TimeBase
|
101
|
-
monat -> TG::Monat
|
102
|
-
stunde -> TG::Stunde
|
103
|
-
tag -> TG::Tag
|
104
|
-
|
105
|
-
new_test -> NewTest
|
106
|
-
|
107
|
-
```
|
108
|
-
|
109
|
-
By changing the namespace-scope with 'ActiveOrient::Init.define_namespace' its always possible to
|
110
|
-
change properties, include links and edges or to add and remove classes in the Sub-Modules.
|
111
|
-
|
@@ -1,139 +0,0 @@
|
|
1
|
-
# NEW
|
2
|
-
|
3
|
-
def create_general_class classes, behaviour = "NORMALCLASS", extend_class, properties: nil
|
4
|
-
if @classes_available.nil?
|
5
|
-
@classes_available = get_database_classes requery: true
|
6
|
-
@classes_available = @classes_available.map!{|x| x.downcase}
|
7
|
-
end
|
8
|
-
|
9
|
-
begin
|
10
|
-
consts = Array.new
|
11
|
-
|
12
|
-
if classes.is_a? Array
|
13
|
-
if behaviour == "NORMALCLASS"
|
14
|
-
classes.each do |singleclass|
|
15
|
-
consts |= create_general_class singleclass, properties: properties
|
16
|
-
end
|
17
|
-
else
|
18
|
-
classes.each do |singleclass|
|
19
|
-
consts |= create_general_class singleclass, "EXTENDEDCLASS", extend_class, properties: properties
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
elsif classes.is_a? Hash
|
24
|
-
classes.keys.each do |superclass|
|
25
|
-
consts |= create_general_class superclass, "SUPERCLASS"
|
26
|
-
consts |= create_general_class classes[superclass], "EXTENDEDCLASS", superclass, properties: properties
|
27
|
-
end
|
28
|
-
|
29
|
-
else
|
30
|
-
name_class = classes.to_s.camelize
|
31
|
-
unless @classes_available.include?(name_class.downcase)
|
32
|
-
|
33
|
-
if behaviour == "NORMALCLASS"
|
34
|
-
command = "CREATE CLASS #{name_class}"
|
35
|
-
elsif behaviour = "SUPERCLASS"
|
36
|
-
command = "CREATE CLASS #{name_class} ABSTRACT"
|
37
|
-
elsif behaviour = "EXTENDEDCLASS"
|
38
|
-
name_superclass = extend_class.to_s.camelize
|
39
|
-
command = "CREATE CLASS #{name_class} EXTENDS #{name_superclass}"
|
40
|
-
end
|
41
|
-
|
42
|
-
execute transaction: false do
|
43
|
-
{ type: "cmd",
|
44
|
-
language: "sql",
|
45
|
-
command: command}
|
46
|
-
end
|
47
|
-
|
48
|
-
@classes_available << name_class.downcase
|
49
|
-
|
50
|
-
# Add properties
|
51
|
-
unless properties.nil?
|
52
|
-
create_properties temp_class, properties
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
temp_class = ActiveOrient::Model.orientdb_class(name: name_class)
|
57
|
-
consts << temp_class
|
58
|
-
return consts
|
59
|
-
end
|
60
|
-
rescue RestClient::InternalServerError => e
|
61
|
-
logger.progname = 'RestCreate#CreateGeneralClass'
|
62
|
-
response = JSON.parse(e.response)['errors'].pop
|
63
|
-
logger.error{"#{response['content'].split(':').last }"}
|
64
|
-
nil
|
65
|
-
end
|
66
|
-
end
|
67
|
-
alias create_classes create_general_class
|
68
|
-
|
69
|
-
# OLD
|
70
|
-
|
71
|
-
def create_general_class classes, properties: nil
|
72
|
-
begin
|
73
|
-
get_database_classes requery: true
|
74
|
-
consts = Array.new
|
75
|
-
execute transaction: false do
|
76
|
-
class_cmd = -> (s,n) do
|
77
|
-
n = n.to_s.camelize
|
78
|
-
consts << ActiveOrient::Model.orientdb_class(name: n)
|
79
|
-
classes_available = get_database_classes.map{|x| x.downcase}
|
80
|
-
unless classes_available.include?(n.downcase)
|
81
|
-
{type: "cmd", language: 'sql', command: "CREATE CLASS #{n} EXTENDS #{s}"}
|
82
|
-
end
|
83
|
-
end ## class_cmd
|
84
|
-
|
85
|
-
if classes.is_a?(Array)
|
86
|
-
classes.map do |n|
|
87
|
-
n = n.to_s.camelize
|
88
|
-
consts << ActiveOrient::Model.orientdb_class(name: n)
|
89
|
-
classes_available = get_database_classes.map{|x| x.downcase}
|
90
|
-
unless classes_available.include?(n.downcase)
|
91
|
-
{type: "cmd", language: 'sql', command: "CREATE CLASS #{n}"}
|
92
|
-
end
|
93
|
-
end
|
94
|
-
elsif classes.is_a?(Hash)
|
95
|
-
classes.keys.map do |superclass|
|
96
|
-
items = Array.new
|
97
|
-
superClass = superclass.to_s.camelize
|
98
|
-
unless get_database_classes.flatten.include?(superClass)
|
99
|
-
items << {type: "cmd", language: 'sql', command: "CREATE CLASS #{superClass} ABSTRACT"}
|
100
|
-
end
|
101
|
-
items << if classes[superclass].is_a?(String) || classes[superclass].is_a?(Symbol)
|
102
|
-
class_cmd[superClass, classes[superclass]]
|
103
|
-
elsif classes[superclass].is_a?(Array)
|
104
|
-
classes[superclass].map{|n| class_cmd[superClass, n]}
|
105
|
-
end
|
106
|
-
items # returnvalue
|
107
|
-
end.flatten
|
108
|
-
end.compact # erase nil-entries, in case the class is already allocated
|
109
|
-
end
|
110
|
-
# refresh cached class-informations
|
111
|
-
classes_available = get_database_classes requery: true
|
112
|
-
|
113
|
-
# Add properties
|
114
|
-
unless properties.nil?
|
115
|
-
classes_available.map!{|x| x.downcase}
|
116
|
-
consts = Array.new
|
117
|
-
if classes.is_a?(Hash)
|
118
|
-
superclass = classes.keys[0]
|
119
|
-
classes = [classes[superclass]]
|
120
|
-
end
|
121
|
-
classes.each do |n|
|
122
|
-
if classes_available.include?(n.downcase)
|
123
|
-
temp_class = ActiveOrient::Model.orientdb_class(name: n)
|
124
|
-
create_properties temp_class, properties
|
125
|
-
consts << temp_class
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# returns an array of allocated Constants/Classes
|
131
|
-
consts
|
132
|
-
rescue RestClient::InternalServerError => e
|
133
|
-
logger.progname = 'RestCreate#CreateGeneralClass'
|
134
|
-
response = JSON.parse(e.response)['errors'].pop
|
135
|
-
logger.error{"#{response['content'].split(':').last }"}
|
136
|
-
nil
|
137
|
-
end
|
138
|
-
end
|
139
|
-
alias create_classes create_general_class
|
data/rails.md
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
# Active Orient and Rails
|
2
|
-
|
3
|
-
The usage of Orientdb via ActiveOrient in Rails requires just a few steps.
|
4
|
-
Based on a Rails 5 installation
|
5
|
-
|
6
|
-
```ruby
|
7
|
-
rvm install 2.4
|
8
|
-
rvm use 2.4
|
9
|
-
gem install bundler
|
10
|
-
gem install nokogiri
|
11
|
-
gem install rails
|
12
|
-
rails -v # Rails 5.0.1
|
13
|
-
|
14
|
-
```
|
15
|
-
|
16
|
-
create your working directory and initialize the system
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
mkdir rails_project; cd rails_project
|
20
|
-
rails -OCT .
|
21
|
-
```
|
22
|
-
This initializes a Rails-Stack, without active-record, action-cable and the test-suite.
|
23
|
-
(We will use rspec later)
|
24
|
-
|
25
|
-
This can be checked by inspecting «/config/application.rb «
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
rails s puma
|
29
|
-
```
|
30
|
-
should work at this stage.
|
31
|
-
|
32
|
-
## Modify the Gemfile
|
33
|
-
Inform rails to use orientdb and active-orient
|
34
|
-
|
35
|
-
```
|
36
|
-
echo " gem 'active-orient' , :path => '/home/your_cloned_active_orient_path/activeorient' " >> Gemfile
|
37
|
-
# or
|
38
|
-
|
39
|
-
echo " gem 'active-orient' , :git => 'https://github.com/topofocus/active-orient.git' " >> Gemfile
|
40
|
-
```
|
41
|
-
|
42
|
-
After that, copy
|
43
|
-
|
44
|
-
* __active_orient/rails/activeorient.rb__ to /config/initializers in the rails-project dir
|
45
|
-
* __active_orient/rails/connect.yml__ to /config
|
46
|
-
* __active_orient/rails/config.yml__ to /config
|
47
|
-
|
48
|
-
and modify the yml-files accordingly.
|
49
|
-
|
50
|
-
Run the bundler
|
51
|
-
|
52
|
-
```
|
53
|
-
bundle install & bundle update
|
54
|
-
```
|
55
|
-
|
56
|
-
The database should be present in the rails console, and
|
57
|
-
```ruby
|
58
|
-
rails c
|
59
|
-
|
60
|
-
V.count
|
61
|
-
V.first
|
62
|
-
E.count
|
63
|
-
puts ActiveOrient::Model.allocated_classes.map{|x,y| "#{"%15s"% x} -> #{y.to_s}" }.join("\n")
|
64
|
-
|
65
|
-
```
|
66
|
-
should work.
|
67
|
-
|
68
|
-
**Notice** The spring-facility is running in the background. Stop the server prior reloading
|
69
|
-
the console ( ./bin/spring stop ).
|
70
|
-
|
71
|
-
The final step is to generate Model-Files. In «/config/config.yml» the «:model_dir»-var points to
|
72
|
-
the location of the model-files. The default is 'lib/orient'.
|
73
|
-
|
74
|
-
Upon startup this directory is scanned for autoloading database-files.
|
75
|
-
|
76
|
-
After envoking the rails console, the logfile displays sucessfully loaded and missing files, ie.
|
77
|
-
|
78
|
-
```
|
79
|
-
14.01.(08:28:45) INFO->ModelClass#RequireModelFile:..:model-file not present: /home/topo/workspace/orient-rails/lib/orient/followed_by.rb
|
80
|
-
14.01.(08:28:45) INFO->ModelClass#RequireModelFile:..:/home/topo/workspace/orient-rails/lib/orient/v.rb sucessfully loaded
|
81
|
-
```
|
82
|
-
|
83
|
-
## Model-file Example
|
84
|
-
|
85
|
-
To query the GratefulDeadConcerts Database, «v.rb» hosts the essential model methods.
|
86
|
-
As always, use «def self.{method}« for class methods and simply «def {method}» for methods working on the record level.
|
87
|
-
|
88
|
-
```
|
89
|
-
1 class V
|
90
|
-
2 def self.artists **attributes
|
91
|
-
3 names 'artist', **attributes
|
92
|
-
4 end
|
93
|
-
5
|
94
|
-
6 def self.songs **attributes
|
95
|
-
7 names 'song', **attributes
|
96
|
-
8 end
|
97
|
-
9
|
98
|
-
10 def self.types
|
99
|
-
11 oo = OrientSupport::OrientQuery
|
100
|
-
12 this_query = oo.new distinct: [:type, :a ]
|
101
|
-
13 query_database( this_query ).a
|
102
|
-
14 end
|
103
|
-
15 private
|
104
|
-
16 def self.names type, sort: :asc, limit: 20, skip: 0
|
105
|
-
17 puts "in names"
|
106
|
-
18 oo = OrientSupport::OrientQuery
|
107
|
-
19 query_database oo.new( where: {type: type },
|
108
|
-
20 order: { name: sort } ,
|
109
|
-
21 limit: limit ,
|
110
|
-
22 skip: skip )
|
111
|
-
23 end
|
112
|
-
24 end
|
113
|
-
|
114
|
-
```
|
115
|
-
|
116
|
-
Now
|
117
|
-
|
118
|
-
```ruby
|
119
|
-
V.types
|
120
|
-
V.artists limit: 15, skip: 34, sort: :desc
|
121
|
-
```
|
122
|
-
queries the database, fetches 15 artists and can be used everywhere.
|
123
|
-
|
124
|
-
|
125
|
-
|