arcadedb 0.3.1 → 0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e27426d3b9d5f96ad8d59d2031bd8a7c6f123bf4cb507bf1eac3879b718ef2c
4
- data.tar.gz: e425b82ff044b94a19ff72108517ddfbfb9942c501aa75806a6240c993d1397c
3
+ metadata.gz: 1855060886e9837ef486e44f07155ae99cd242f76aceccb8a7bf4c2ab515eca0
4
+ data.tar.gz: d99f2a402eba561fcf851a3838b3bec7eee58f1a788ab9fc7e2ce1208c33611a
5
5
  SHA512:
6
- metadata.gz: 423fa99b2e382ffd11ff56f76dfbed418853621c471836311782ac799766991758f05eb3f5ba474206e05a496c71cdac235d9bfeaea56d6b86f4f5782b255d60
7
- data.tar.gz: 9d0b05add357c934574b5de2272b6490c432cc526cb650eef49cb327269222d8f4fe5e78e4fe071acf839768e64f25b7a3e477cd6db27509c9321edb5b669c4c
6
+ metadata.gz: 78936dfe0069d531c1bcfd6191f0269ed84a44cd8e0321a37ef9d569048ff8a20d38d0a221d0b0b93f3e64f39d61a758d2978545beec86d27baf5836c3cdbf4a
7
+ data.tar.gz: 6ff4e9242c74887935074ed60810b144a08ad2dad7a6d3374bc0216f74873abb6a1b6f66428a2ed6e7fa9f49dec3ee07ebbe5cc64488744829f76eb037db286c
data/.gitignore ADDED
@@ -0,0 +1,57 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+ # vim specific
13
+ *swp
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ # Ignore Byebug command history file.
18
+ .byebug_history
19
+
20
+ ## Specific to RubyMotion:
21
+ .dat*
22
+ .repl_history
23
+ build/
24
+ *.bridgesupport
25
+ build-iPhoneOS/
26
+ build-iPhoneSimulator/
27
+
28
+ ## Specific to RubyMotion (use of CocoaPods):
29
+ #
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33
+ #
34
+ # vendor/Pods/
35
+
36
+ ## Documentation cache and generated files:
37
+ /.yardoc/
38
+ /_yardoc/
39
+ /doc/
40
+ /rdoc/
41
+
42
+ ## Environment normalization:
43
+ /.bundle/
44
+ /vendor/bundle
45
+ /lib/bundler/man/
46
+
47
+ # for a library or gem, you might want to ignore these files since the code is
48
+ # intended to run in multiple environments; otherwise, check them in:
49
+ # Gemfile.lock
50
+ # .ruby-version
51
+ # .ruby-gemset
52
+
53
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
54
+ .rvmrc
55
+
56
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
57
+ # .rubocop-https?--*
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+
6
+
7
+ ## 0.3.1 - 2023-01-16
8
+
9
+ - Integration into the Bridgetown Environment
10
+
11
+ ## 0.3.3 - 2023.04.23
12
+ - Support for embedded Dokuments and Maps
13
+ - iruby support
14
+
15
+ ## 0.4.0 - 2023.10.28
16
+ - completely remove pg-stuff
17
+ - substitute typhoreous with HTTPX
18
+ - include dry::monards to process raw-data
19
+
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ #git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+ gemspec
7
+ gem 'sdoc'
8
+ group :development, :test do
9
+ gem "awesome_print"
10
+ gem 'pastel'
11
+ gem 'zeitwerk'
12
+ gem 'terminal-table'
13
+ # gem 'rubocop'
14
+ gem "rspec"
15
+ gem 'rspec-legacy_formatters'
16
+ gem 'rspec-its'
17
+ gem 'rspec-given'
18
+ gem 'rspec-collection_matchers'
19
+ gem 'rspec-context-private'
20
+ # gem 'guard-jruby-rspec', :platforms => :jruby, :git => 'git://github.com/jkutner/guard-jruby-rspec.git'
21
+ gem 'guard'#, :platforms => :ruby
22
+ gem 'guard-rspec'
23
+ gem 'rb-inotify'
24
+ # gem 'pry'
25
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,186 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ arcadedb (0.4)
5
+ dry-configurable
6
+ dry-core
7
+ dry-monads
8
+ dry-schema
9
+ dry-struct
10
+ httpx
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ ast (2.4.2)
16
+ awesome_print (1.9.2)
17
+ base64 (0.1.1)
18
+ coderay (1.1.3)
19
+ concurrent-ruby (1.2.2)
20
+ diff-lcs (1.5.0)
21
+ dry-configurable (1.1.0)
22
+ dry-core (~> 1.0, < 2)
23
+ zeitwerk (~> 2.6)
24
+ dry-core (1.0.1)
25
+ concurrent-ruby (~> 1.0)
26
+ zeitwerk (~> 2.6)
27
+ dry-inflector (1.0.0)
28
+ dry-initializer (3.1.1)
29
+ dry-logic (1.5.0)
30
+ concurrent-ruby (~> 1.0)
31
+ dry-core (~> 1.0, < 2)
32
+ zeitwerk (~> 2.6)
33
+ dry-monads (1.6.0)
34
+ concurrent-ruby (~> 1.0)
35
+ dry-core (~> 1.0, < 2)
36
+ zeitwerk (~> 2.6)
37
+ dry-schema (1.13.3)
38
+ concurrent-ruby (~> 1.0)
39
+ dry-configurable (~> 1.0, >= 1.0.1)
40
+ dry-core (~> 1.0, < 2)
41
+ dry-initializer (~> 3.0)
42
+ dry-logic (>= 1.4, < 2)
43
+ dry-types (>= 1.7, < 2)
44
+ zeitwerk (~> 2.6)
45
+ dry-struct (1.6.0)
46
+ dry-core (~> 1.0, < 2)
47
+ dry-types (>= 1.7, < 2)
48
+ ice_nine (~> 0.11)
49
+ zeitwerk (~> 2.6)
50
+ dry-types (1.7.1)
51
+ concurrent-ruby (~> 1.0)
52
+ dry-core (~> 1.0)
53
+ dry-inflector (~> 1.0)
54
+ dry-logic (~> 1.4)
55
+ zeitwerk (~> 2.6)
56
+ ffi (1.16.3)
57
+ formatador (1.1.0)
58
+ given_core (3.8.2)
59
+ sorcerer (>= 0.3.7)
60
+ guard (2.18.1)
61
+ formatador (>= 0.2.4)
62
+ listen (>= 2.7, < 4.0)
63
+ lumberjack (>= 1.0.12, < 2.0)
64
+ nenv (~> 0.1)
65
+ notiffany (~> 0.0)
66
+ pry (>= 0.13.0)
67
+ shellany (~> 0.0)
68
+ thor (>= 0.18.1)
69
+ guard-compat (1.2.1)
70
+ guard-rspec (4.7.3)
71
+ guard (~> 2.1)
72
+ guard-compat (~> 1.1)
73
+ rspec (>= 2.99.0, < 4.0)
74
+ http-2-next (1.0.1)
75
+ httpx (1.0.2)
76
+ http-2-next (>= 1.0.1)
77
+ ice_nine (0.11.2)
78
+ json (2.6.3)
79
+ language_server-protocol (3.17.0.3)
80
+ listen (3.8.0)
81
+ rb-fsevent (~> 0.10, >= 0.10.3)
82
+ rb-inotify (~> 0.9, >= 0.9.10)
83
+ lumberjack (1.2.9)
84
+ method_source (1.0.0)
85
+ nenv (0.3.0)
86
+ notiffany (0.1.3)
87
+ nenv (~> 0.1)
88
+ shellany (~> 0.0)
89
+ parallel (1.23.0)
90
+ parser (3.2.2.4)
91
+ ast (~> 2.4.1)
92
+ racc
93
+ pastel (0.8.0)
94
+ tty-color (~> 0.5)
95
+ pry (0.14.2)
96
+ coderay (~> 1.1)
97
+ method_source (~> 1.0)
98
+ psych (5.1.1.1)
99
+ stringio
100
+ racc (1.7.1)
101
+ rainbow (3.1.1)
102
+ rake (13.0.6)
103
+ rb-fsevent (0.11.2)
104
+ rb-inotify (0.10.1)
105
+ ffi (~> 1.0)
106
+ rdoc (6.5.0)
107
+ psych (>= 4.0.0)
108
+ regexp_parser (2.8.2)
109
+ rexml (3.2.6)
110
+ rspec (3.12.0)
111
+ rspec-core (~> 3.12.0)
112
+ rspec-expectations (~> 3.12.0)
113
+ rspec-mocks (~> 3.12.0)
114
+ rspec-collection_matchers (1.2.1)
115
+ rspec-expectations (>= 2.99.0.beta1)
116
+ rspec-context-private (0.0.1)
117
+ rspec-core (3.12.2)
118
+ rspec-support (~> 3.12.0)
119
+ rspec-expectations (3.12.3)
120
+ diff-lcs (>= 1.2.0, < 2.0)
121
+ rspec-support (~> 3.12.0)
122
+ rspec-given (3.8.2)
123
+ given_core (= 3.8.2)
124
+ rspec (>= 2.14.0)
125
+ rspec-its (1.3.0)
126
+ rspec-core (>= 3.0.0)
127
+ rspec-expectations (>= 3.0.0)
128
+ rspec-legacy_formatters (1.0.2)
129
+ rspec (~> 3.0)
130
+ rspec-mocks (3.12.6)
131
+ diff-lcs (>= 1.2.0, < 2.0)
132
+ rspec-support (~> 3.12.0)
133
+ rspec-support (3.12.1)
134
+ rubocop (1.57.1)
135
+ base64 (~> 0.1.1)
136
+ json (~> 2.3)
137
+ language_server-protocol (>= 3.17.0)
138
+ parallel (~> 1.10)
139
+ parser (>= 3.2.2.4)
140
+ rainbow (>= 2.2.2, < 4.0)
141
+ regexp_parser (>= 1.8, < 3.0)
142
+ rexml (>= 3.2.5, < 4.0)
143
+ rubocop-ast (>= 1.28.1, < 2.0)
144
+ ruby-progressbar (~> 1.7)
145
+ unicode-display_width (>= 2.4.0, < 3.0)
146
+ rubocop-ast (1.29.0)
147
+ parser (>= 3.2.1.0)
148
+ ruby-progressbar (1.13.0)
149
+ sdoc (2.6.1)
150
+ rdoc (>= 5.0)
151
+ shellany (0.0.1)
152
+ sorcerer (2.0.1)
153
+ stringio (3.0.8)
154
+ terminal-table (3.0.2)
155
+ unicode-display_width (>= 1.1.1, < 3)
156
+ thor (1.3.0)
157
+ tty-color (0.6.0)
158
+ unicode-display_width (2.5.0)
159
+ zeitwerk (2.6.12)
160
+
161
+ PLATFORMS
162
+ x86_64-linux
163
+
164
+ DEPENDENCIES
165
+ arcadedb!
166
+ awesome_print
167
+ bundler (~> 2)
168
+ guard
169
+ guard-rspec
170
+ pastel
171
+ pry
172
+ rake (~> 13.0)
173
+ rb-inotify
174
+ rspec
175
+ rspec-collection_matchers
176
+ rspec-context-private
177
+ rspec-given
178
+ rspec-its
179
+ rspec-legacy_formatters
180
+ rubocop
181
+ sdoc
182
+ terminal-table
183
+ zeitwerk
184
+
185
+ BUNDLED WITH
186
+ 2.3.6
data/Guardfile ADDED
@@ -0,0 +1,30 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+ def fire
4
+ require "ostruct"
5
+
6
+ # Generic Ruby apps
7
+ rspec = OpenStruct.new
8
+ rspec.spec = ->(m) { "spec/#{m}_spec.rb" }
9
+ rspec.spec_dir = "spec"
10
+ rspec.spec_helper = "spec/spec_helper.rb"
11
+
12
+
13
+ watch(%r{^spec/.+_spec\.rb$})
14
+ # watch(%r{^spec/usecase/(.+)\.rb$})
15
+ watch(%r{^arcade/(.+)\.rb$}) { |m| "spec/arcade/#{m[1]}_spec.rb" }
16
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
17
+ # watch(%r{^examples/time_graph/spec/(.+)_spec\.rb$})
18
+ # watch('examples/time_graph/spec/create_time_spec.rb')
19
+ watch('spec/spec_helper.rb') { "spec" }
20
+
21
+ watch(%r{^spec/arcade/(.+)_spec\.rb$})
22
+ end
23
+
24
+
25
+ #interactor :simple
26
+ #if RUBY_PLATFORM == 'java'
27
+ #guard( 'jruby-rspec') {fire} #', :spec_paths => ["spec"]
28
+ #else
29
+ guard( :rspec, cmd: "bundle exec rspec --format documentation ") { fire }
30
+ #end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Hartmut Bischoff
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # ArcadeDB
2
+
3
+ Ruby Interface to a [Arcade Database](https://arcadedb.com/).
4
+
5
+ The program utilizes the HTTP-JSON API to direct database queries to an ArcadeDB server.
6
+ The server's response is then mapped to an ORM (Object-Relational Mapping) based on DRY::Struct.
7
+ Each database type is represented by a dedicated Model Class, where complex queries are encapsulated.
8
+ The program also includes a Query-Preprocessor for constructing custom queries in ruby fashion.
9
+
10
+ ***ArcadeDB internally uses `Arcade` as primary namespace****
11
+
12
+ ## Prerequisites
13
+
14
+ A running AracdeDB-Instance. [Quick-Start-Guide](https://docs.arcadedb.com/#Quick-Start-Docker).
15
+
16
+ [ArcadeDB V 22.10.1](https://github.com/ArcadeData/arcadedb/releases/tag/22.10.1)ff is supported
17
+
18
+ ## Config
19
+
20
+ Edit the file `arcade.yml` and provide suitable databases for test, development and production environment.
21
+
22
+ ## Console
23
+
24
+ To start an interactive console, a script is provided in the bin-directory.
25
+ ```
26
+ $ cd bin && ./console.rb t ( or "d" or "p" for Test, Development and Production environment)
27
+
28
+ **Database definitions (model-files) of the test-suite are included!**
29
+ ```
30
+
31
+ ## Examples & Specs
32
+
33
+ The `example` directory contains documented sample files for typical usecases
34
+
35
+ The `spec`-files in the rspec-test-suite-section are worth reading, too.
36
+
37
+ ## Implementation
38
+
39
+ The adapter uses a 3 layer concept.
40
+
41
+ Top-Layer : `Arcade::Base`-Model-Objects.
42
+ They operate similar to ActiveRecord Model Objects but are based on [Dry-Struct](https://dry-rb.org/gems/dry-struct/1.0/).
43
+
44
+ ```ruby
45
+ # Example model file /model/demo/user.rb
46
+ module Demo
47
+ class Person < Arcade::Vertex
48
+ attribute :name, Types::Nominal::String
49
+ timestamps true
50
+
51
+ def grandparents
52
+ db.query( "select in('is_family') from #{rid} ") &.allocate_model
53
+ end
54
+ end
55
+ end
56
+ __END__
57
+ CREATE PROPERTY demo_user.name STRING
58
+ CREATE INDEX on demo_user( name ) UNIQUE
59
+ ```
60
+
61
+ Only the `name` attribute is declared. Timestamps (created & updated attributes) are included, too
62
+
63
+ `Demo::User.create_type` creates the type and executes the database-commands after __END__.
64
+
65
+ Other properties are schemaless.
66
+
67
+ ```ruby
68
+ Person.create name: "Hubert", age: 35
69
+ Person.update set: { age: 36 }, where: { name: 'Hubert' }
70
+ persons = Person.where "age > 40"
71
+ persons.first.update age: 37
72
+ persons.first.update father: Person.create( name: 'Mike', age: 94 )
73
+
74
+ Person.all
75
+ Person.delete all: true || where: age: 56 , ...
76
+ ```
77
+
78
+ A **Query Preprocessor** is implemented. Its adapted from ActiveOrient. The [documentation](https://github.com/topofocus/active-orient/wiki/OrientQuery)
79
+ is still valid, however the class has changed to `Arcade::Query`.
80
+
81
+ The **second Layer** handles Database-Requests.
82
+ In its actual implementation, these requests are delegated to the HTTP/JSON-API.
83
+
84
+ `Arcade::Init` uses the database specification of the `arcade.yml` file.
85
+ The database-handle is always present through `Arcade::Init.db`
86
+
87
+ ```ruby
88
+ DB = Arcade::Init.db
89
+
90
+ $ DB.get nn, mm # returns a Aracde:Base object
91
+ # rid is either "#11:10:" or two numbers
92
+ $ DB.query querystring # returns either an Array of results (as Hash)
93
+ $ DB.execute { querystring } #
94
+ $ DB.create <name>, attribute: value .... # Creates a new <Document | Vertex> and returns the rid
95
+ # Operation is performed as Database-Transaction and is rolled back on error
96
+ $ DB.insert <name>, attribute: value .... # Inserts a new <Document | Vertex> and returns the rid
97
+ $ DB.create_edge <name>, from: <rid> or [rid, rid, ..] , to: <rid> or [rid, rid, ..]
98
+
99
+ DB.query " Select from person where age > 40 "
100
+ DB.execute { " Update person set name='Hubert' return after $current where age = 36 " }
101
+ ```
102
+
103
+ **Convert database input to Arcade::Base Models**
104
+
105
+ Either `DB.query` or `DB.execute` return the raw JSON-input from the database. It can always converted to model-objects by chaining
106
+ `allocatet_model`.
107
+
108
+ ```ruby
109
+ $ DB.query "select from my_names limit 1"
110
+ # which is identical to
111
+ $ My::Names.query( limit: 1).query
112
+ => [{:@out=>0, :@rid=>"#225:6", :@in=>0, :@type=>"my_names", :@cat=>"v", :name=>"Zaber"}]
113
+ # then
114
+ $ My::Names.query( limit: 1).query.allocate_model.to_human
115
+ => ["<my_names[#225:6]: name: Zaber>" ]
116
+ # replaces the hash with a My::Names Object
117
+ ```
118
+
119
+ The **Base Layer** implements a low level access to the database API.
120
+
121
+ ```ruby
122
+
123
+ $ Arcade::Api.databases # returns an array of known databases
124
+ $ Arcade::Api.create_database <a string> # returns true if successfull
125
+ $ Arcade::Api.drop_database <a string> # returns true if successfull
126
+
127
+ $ Arcade::Api.begin_transaction <database>
128
+ $ Arcade::Api.create_document <database>, <type>, attribute: value , ...
129
+ $ Arcade::Api.execute( <database> ) { <query> }
130
+ $ Arcade::Api.commit <database> # or Arcade::Api.rollback
131
+
132
+
133
+ $ Arcade::Api.query( <database> ) { <query> }
134
+ $ Arcade::Api.get_record <database>, rid # returns a hash
135
+ ```
136
+
137
+
138
+ `<query>` is either a string or a hash:
139
+ ```ruby
140
+ { :query => "<the query string> ",
141
+ :language => one of :sql, :cypher, :gmelin: :neo4 ,
142
+ :params => a hash of parameters,
143
+ :limit => a number ,
144
+ :serializer => one of :graph, :record }
145
+ ```
146
+
147
+ ## ORM Behavior
148
+
149
+ Simple tasks are implemented on the model layer.
150
+
151
+ ### Ensure that a Record exists
152
+
153
+ The `upsert` command either updates or creates a database record.
154
+
155
+ ```ruby
156
+ User.upsert name: 'Hugo'
157
+ # or
158
+ User.upsert set: { age: 46 }, where: { name: 'Hugo' }
159
+ ```
160
+ either creates the record (and returns it) or returns the existing database entry. Obviously, the addressed attribute (where condition)
161
+ must have a proper index.
162
+
163
+ The `upsert` statement provides a smart method to ensure the presence of a defined starting point.
164
+
165
+ ### Assign Nodes to a Vertex
166
+
167
+ Apart from accessing attributes by their method-name, adjacent edges and notes are fetched through
168
+
169
+ ```ruby
170
+ new_vertex = ->(n) { Node.create( note_count: n ) } ## lambda to create a Node type record
171
+ nucleus = BaseNode.create item: 'b' ## create a start node
172
+ (1..10).each{ |n| nucleus.assign( via: Connects, vertex: new_vertex[n]) } ## connect nodes via Connects-Edges
173
+ ```
174
+ After creating a star-like structure, the environment can be explored
175
+ ```ruby
176
+ nucleus.edges.to_human
177
+ =>["<connects[#80:14] :.: #4:0->{}->#34:2>",
178
+ "<connects[#79:13] :.: #4:0->{}->#31:1>",
179
+ ( ... )
180
+ "<connects[#79:14] :.: #4:0->{}->#31:2>"]
181
+
182
+ nucleus.nodes.to_human
183
+ => ["<node[#34:2]: item: 10>",
184
+ "<node[#31:1]: item: 1>",
185
+ ( ... )
186
+ "<node[#31:2]: item: 9>"]
187
+ ```
188
+
189
+ Edges provide a `vertices`-method to load connected ones. Both vertices and edges expose `in`, `out`, `both`-methods to select connections further.
190
+ Specific edge-classes (types) are provided with the `via:` parameter, as shown in `assign` above.
191
+
192
+
193
+ ### Traverse Facility
194
+
195
+ To ease queries to the graph database, `Arcade::Query` supports traversal of nodes
196
+
197
+ Create a Chain of Nodes:
198
+ ```ruby
199
+
200
+ def linear_elements start, count #returns the edge created
201
+ new_vertex = ->(n) { Arcade::ExtraNode.create( note_count: n ) }
202
+ (2..count).each{ |n| start = start.assign vertex: new_vertex[n], via: Arcade::Connects }
203
+ end
204
+
205
+ start_node = Arcade::ExtraNode.create( item: 'linear' )
206
+ linear_elements start_node , 200
207
+ ```
208
+
209
+ Select a range of nodes and perform a mathematical operation
210
+
211
+ ```ruby
212
+ hundred_elements = start_node.traverse :out, via: Arcade::Connects, depth: 100
213
+ median = Query.new from: hundred_elements,
214
+ projection: 'median(note_count)',
215
+ where: '$depth>=50'
216
+ median.to_s
217
+ -=> select median(note_count) from ( traverse out(connects) from #52:0 while $depth < 100 ) where $depth>=50
218
+ => {:"median(note_count)"=>75.5 }
219
+ ```
220
+ ## Include in your own project
221
+
222
+ Until a gem is released, first clone the project and set up your project environment
223
+ ```
224
+ mkdir workspace && cd workspace
225
+ git clone https://github.com/topofocus/arcadedb
226
+ mkdir my-project && cd my-project
227
+ bundle init
228
+ cat "gem arcadedb, path='../arcadedb' " >> Gemfile
229
+ bundle install && bundle upate
230
+ cp ../arcadedb/config.yml .
231
+ mkdir bin
232
+ cp ../arcadedb/bin/console bin/
233
+ ````
234
+
235
+
236
+ ## Contributing
237
+
238
+ Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
239
+
240
+ ## Code of Conduct
241
+
242
+ Everyone interacting in the Core project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/topofocus/arcadedb/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require "rake"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
+ t.pattern = Dir.glob("spec/**/*_spec.rb")
8
+ t.rspec_opts = "--format documentation"
9
+ end
10
+
11
+ task default: :spec
data/arcade.yml ADDED
@@ -0,0 +1,23 @@
1
+ ---
2
+ :environment:
3
+ :test:
4
+ dbname: playground
5
+ user: root
6
+ pass: topo1focus
7
+ :development:
8
+ dbname: devel
9
+ user: root
10
+ pass: topo1focus
11
+ :production:
12
+ dbname: production
13
+ user: root
14
+ pass: topo1focus
15
+ :admin:
16
+ :host: 10.247.8.109
17
+ :port: 2480
18
+ :user: root
19
+ :pass: topo1focus
20
+ :logger: stdout # 'file' or 'stdout'
21
+ :namespace: Arcade # Default Namespace
22
+ :autoload: true # load model if a link is detected in a record
23
+
data/arcadedb.gemspec ADDED
@@ -0,0 +1,32 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'arcade/version'
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "arcadedb"
7
+ spec.version = Arcade::VERSION
8
+ spec.author = "Hartmut Bischoff"
9
+ spec.email = "topofocus@gmail.com"
10
+ spec.license = 'MIT'
11
+ spec.summary = %q{Ruby Interface to ArcadeDB}
12
+ spec.description = %q{Provides access to ArcadeDB from ruby}
13
+ spec.homepage = "https://github.com/topofocus/arcadedb"
14
+
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 2"
24
+ spec.add_development_dependency "rake", "~> 13.0"
25
+ spec.add_development_dependency "rspec", "~> 4.0"
26
+ spec.add_dependency "httpx"
27
+ spec.add_dependency 'dry-schema'
28
+ spec.add_dependency 'dry-struct'
29
+ spec.add_dependency 'dry-core'
30
+ spec.add_dependency 'dry-configurable'
31
+ # spec.add_dependency 'dry-monads' # future use
32
+ end