active-orient 0.6 → 0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/rails/activeorient.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
project_root = File.expand_path('../../..', __FILE__)
|
2
|
-
config_root = File.expand_path('../..', __FILE__)
|
3
|
-
begin
|
4
|
-
connect_file = File.expand_path('../../connect.yml', __FILE__)
|
5
|
-
config_file = File.expand_path('../../config.yml', __FILE__)
|
6
|
-
connectyml = YAML.load_file( connect_file )[:orientdb][:admin] if connect_file.present?
|
7
|
-
configyml = YAML.load_file( config_file )[:active_orient] if config_file.present?
|
8
|
-
databaseyml = YAML.load_file( connect_file )[:orientdb][:database] if connect_file.present?
|
9
|
-
rescue Errno::ENOENT => e
|
10
|
-
Rails.logger.error{ "config/connect.yml not present" }
|
11
|
-
puts "config/connectyml not present"
|
12
|
-
Rails.logger.error{ "Using defaults to connect database-server" }
|
13
|
-
puts "Using defaults to connect database-server"
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
ActiveOrient::Model.model_dir = "#{project_root}/#{ configyml.present? ? configyml[:model_dir] : "model" }"
|
18
|
-
ActiveOrient::Model.keep_models_without_file = true
|
19
|
-
# lib/init.rb
|
20
|
-
ActiveOrient::Init.define_namespace yml: configyml, namespace: @namespace
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Rails.logger.formatter = proc do |severity, datetime, progname, msg|
|
25
|
-
"#{datetime.strftime("%d.%m.(%X)")}#{"%5s" % severity}->#{progname}:..:#{msg}\n"
|
26
|
-
end
|
27
|
-
ActiveOrient::Base.logger = Rails.logger
|
28
|
-
ActiveOrient::OrientDB.logger = Rails.logger
|
29
|
-
|
30
|
-
if connectyml.present? and connectyml[:user].present? and connectyml[:pass].present?
|
31
|
-
ActiveOrient.default_server= { user: connectyml[:user], password: connectyml[:pass] ,
|
32
|
-
server: 'localhost', port: 2480 }
|
33
|
-
ActiveOrient.database = @configDatabase.presence || databaseyml[Rails.env.to_sym]
|
34
|
-
|
35
|
-
ORD = ActiveOrient::OrientDB.new preallocate: @do_not_preallocate.present? ? false : true
|
36
|
-
if RUBY_PLATFORM == 'java'
|
37
|
-
DB = ActiveOrient::API.new preallocate: false
|
38
|
-
else
|
39
|
-
DB = ORD
|
40
|
-
end
|
41
|
-
# ActiveOrient::Init.vertex_and_edge_class
|
42
|
-
|
43
|
-
ORD.create_classes 'E', 'V'
|
44
|
-
E.ref_name = 'E'
|
45
|
-
V.ref_name = 'V'
|
46
|
-
else
|
47
|
-
logger = Logger.new('/dev/stdout')
|
48
|
-
logger.error{ "config/connectyml is misconfigurated" }
|
49
|
-
logger.error{ "Database Server is NOT available"}
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
|
data/rails/config.yml
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:active_orient:
|
3
|
-
## Namespace: Prefix of Model-Objects. :self -> ActiveOrient::Model::{name}
|
4
|
-
## :object => No Prefix
|
5
|
-
## :active_orient => ActiveOrient::{name}
|
6
|
-
:namespace: :object
|
7
|
-
## model_dir: Path to model-files relative to the root of the application
|
8
|
-
## ie. app/model or model
|
9
|
-
:model_dir: 'lib/orient'
|
10
|
-
|
data/rails/connect.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:orientdb:
|
3
|
-
:server: localhost # 172.28.50.109 # localhost #mailout.halfgarten-capital.de
|
4
|
-
:port: 2480
|
5
|
-
:logger: stdout # 'file' or 'stdout'
|
6
|
-
:database:
|
7
|
-
:development: GratefulDeadConcerts
|
8
|
-
:production: hcn_data
|
9
|
-
:test: tempera
|
10
|
-
:admin:
|
11
|
-
:user: hctw
|
12
|
-
:pass: hc
|
13
|
-
:auth:
|
14
|
-
:user: topo
|
15
|
-
:pass: focus
|
16
|
-
|
17
|
-
# hfx: 101
|
data/usecase_oo.md
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
## Usecase
|
2
|
-
Below some typical features are summarized by example
|
3
|
-
|
4
|
-
Initialize ActiveOrient by calling »bin/active-orient-console t«.
|
5
|
-
This connects to the Test-Database.
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
topo@gamma:~/activeorient/bin$ ./active-orient-console t
|
9
|
-
Using test-environment
|
10
|
-
30.06.(21:36:09) INFO->OrientDB#Connect:..:Connected to database tempera
|
11
|
-
ORD points to the REST-Instance
|
12
|
-
Allocated Classes (Hierarchy)
|
13
|
-
-----------------------------------
|
14
|
-
---
|
15
|
-
- E
|
16
|
-
- - V
|
17
|
-
- - a
|
18
|
-
- b
|
19
|
-
- c
|
20
|
-
|
21
|
-
```
|
22
|
-
The database is almost empty. "E" and "V" are base classes for Edges and Vertices.
|
23
|
-
"a,b,c" are Vertex-Classes.
|
24
|
-
```ruby
|
25
|
-
ORD.create_classes( [ :a, :b, :c ] ){ :V }
|
26
|
-
```
|
27
|
-
creates them with a single statement. They are mapped to Ruby-classes "A","B" and "C".
|
28
|
-
|
29
|
-
#### Object Mapping
|
30
|
-
Lets create a class, put some content in it and perform basic oo-steps.
|
31
|
-
|
32
|
-
Attributes(Properties) do not have to be formaly declared. One can save any Object, which
|
33
|
-
provides a 'to_orient' method. Base-Classes are supported out of the box.
|
34
|
-
»update«
|
35
|
-
|
36
|
-
``` ruby
|
37
|
-
ORD.create_class 'my_a_class'
|
38
|
-
=> MyAClass
|
39
|
-
my_class = MyAClass.create test: 45
|
40
|
-
my_class.update set: { a_array: aa= [ 1,4,'r' ] ,
|
41
|
-
a_hash: { :a => 'b', b: 2 } }
|
42
|
-
my_class.to_human
|
43
|
-
=> "<MyAClass: a_array: [1, 4, r], a_hash: { a => b , b =>2}, test: 45>"
|
44
|
-
|
45
|
-
```
|
46
|
-
**Notice** Ruby-Symbols are converted to Strings and masked as ":{symbol}:".
|
47
|
-
There is a method: String#from_orient, which reverses the prodedure.
|
48
|
-
|
49
|
-
Attibutes/properties of the Database-Record can be handled as normal ruby objects ie.
|
50
|
-
|
51
|
-
``` ruby
|
52
|
-
my_class.a_array << "a new element"
|
53
|
-
my_class.a_hash[ :a_new_element ] = "value of the new element"
|
54
|
-
my_class.test += 3
|
55
|
-
my_class.test = 567
|
56
|
-
my_class.update
|
57
|
-
```
|
58
|
-
|
59
|
-
## Inherence
|
60
|
-
|
61
|
-
( to be continued )
|