grumlin 0.5.1 → 0.6.0
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/.tool-versions +1 -0
- data/Gemfile.lock +3 -3
- data/bin/console +1 -1
- data/lib/grumlin/anonymous_step.rb +6 -6
- data/lib/grumlin/order.rb +7 -8
- data/lib/grumlin/p.rb +1 -1
- data/lib/grumlin/pop.rb +7 -18
- data/lib/grumlin/t.rb +7 -8
- data/lib/grumlin/translator.rb +4 -0
- data/lib/grumlin/traversal.rb +4 -5
- data/lib/grumlin/typed_value.rb +19 -0
- data/lib/grumlin/u.rb +4 -1
- data/lib/grumlin/version.rb +1 -1
- data/lib/grumlin.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a847514be85565126dc453b6f088ad5c9a388464e74f6744e34427f09a07ec9c
|
4
|
+
data.tar.gz: ea6b1241c611222aa7866b8c3a7b4b798d5a68ba09f79f030196758d4f2dd7f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa5546c4b0139b1fd81cf2c2d5b32886a0c54ee958ddf3d9684ff9a38a19c8401fb2ef89a6767840f2dc0a12fbc86ea0b4821477f0721d767fc4c4f3a6cd7c1
|
7
|
+
data.tar.gz: 38da748bde5febd21a8d94a8ae00768fa8b25bb544dd9b9895a9dd544136faa489a8591d01386afcbb8ed103e5f909c7c4dfff2af9a69f2c42a77fa963be7438
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.6
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grumlin (0.
|
4
|
+
grumlin (0.6.0)
|
5
5
|
async-pool (~> 0.3)
|
6
6
|
async-websocket (~> 0.19)
|
7
7
|
|
@@ -70,7 +70,7 @@ GEM
|
|
70
70
|
ast (~> 2.4.1)
|
71
71
|
protocol-hpack (1.4.2)
|
72
72
|
protocol-http (0.22.5)
|
73
|
-
protocol-http1 (0.14.
|
73
|
+
protocol-http1 (0.14.2)
|
74
74
|
protocol-http (~> 0.22)
|
75
75
|
protocol-http2 (0.14.2)
|
76
76
|
protocol-hpack (~> 1.4)
|
@@ -166,4 +166,4 @@ DEPENDENCIES
|
|
166
166
|
solargraph
|
167
167
|
|
168
168
|
BUNDLED WITH
|
169
|
-
2.2.
|
169
|
+
2.2.26
|
data/bin/console
CHANGED
@@ -4,23 +4,23 @@ module Grumlin
|
|
4
4
|
class AnonymousStep
|
5
5
|
attr_reader :name, :args
|
6
6
|
|
7
|
+
# TODO: add other steps
|
8
|
+
SUPPORTED_STEPS = %w[E V addE addV as by coalesce count dedup drop elementMap emit fold from group groupCount has
|
9
|
+
hasLabel hasNot in inV label limit not order out outE path project property repeat select to
|
10
|
+
unfold valueMap values where].freeze
|
11
|
+
|
7
12
|
def initialize(name, *args, previous_steps: [])
|
8
13
|
@name = name
|
9
14
|
@previous_steps = previous_steps
|
10
15
|
@args = args
|
11
16
|
end
|
12
17
|
|
13
|
-
|
14
|
-
not outE groupCount label group in out fold unfold inV path dedup project coalesce repeat emit
|
15
|
-
elementMap where].each do |step|
|
18
|
+
SUPPORTED_STEPS.each do |step|
|
16
19
|
define_method step do |*args|
|
17
20
|
add_step(step, args, previous_steps: steps)
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
21
|
-
alias addVertex addV
|
22
|
-
alias addEdge addE
|
23
|
-
|
24
24
|
def inspect
|
25
25
|
@inspect ||= to_bytecode.to_s
|
26
26
|
end
|
data/lib/grumlin/order.rb
CHANGED
@@ -2,16 +2,15 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module Order
|
5
|
+
# TODO: share the code?
|
5
6
|
class << self
|
6
|
-
|
7
|
-
|
7
|
+
%i[asc desc].each do |step|
|
8
|
+
define_method step do
|
9
|
+
name = "@#{step}"
|
10
|
+
return instance_variable_get(name) if instance_variable_defined?(name)
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def desc
|
14
|
-
DESC
|
12
|
+
instance_variable_set(name, TypedValue.new("Order", step))
|
13
|
+
end
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
data/lib/grumlin/p.rb
CHANGED
data/lib/grumlin/pop.rb
CHANGED
@@ -2,26 +2,15 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module Pop
|
5
|
+
# TODO: share the code?
|
5
6
|
class << self
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
%i[first last all mixed].each do |step|
|
8
|
+
define_method step do
|
9
|
+
name = "@#{step}"
|
10
|
+
return instance_variable_get(name) if instance_variable_defined?(name)
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def last
|
16
|
-
LAST
|
17
|
-
end
|
18
|
-
|
19
|
-
def all
|
20
|
-
ALL
|
21
|
-
end
|
22
|
-
|
23
|
-
def mixed
|
24
|
-
MIXED
|
12
|
+
instance_variable_set(name, TypedValue.new("Pop", step))
|
13
|
+
end
|
25
14
|
end
|
26
15
|
end
|
27
16
|
end
|
data/lib/grumlin/t.rb
CHANGED
@@ -2,16 +2,15 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module T
|
5
|
+
# TODO: share the code?
|
5
6
|
class << self
|
6
|
-
|
7
|
-
|
7
|
+
%i[id label].each do |step|
|
8
|
+
define_method step do
|
9
|
+
name = "@#{step}"
|
10
|
+
return instance_variable_get(name) if instance_variable_defined?(name)
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def label
|
14
|
-
T_LABEL
|
12
|
+
instance_variable_set(name, TypedValue.new("T", step))
|
13
|
+
end
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
data/lib/grumlin/translator.rb
CHANGED
@@ -20,6 +20,7 @@ module Grumlin
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def arg_to_bytecode(arg)
|
23
|
+
return arg.to_bytecode if arg.is_a?(TypedValue)
|
23
24
|
return arg unless arg.is_a?(AnonymousStep)
|
24
25
|
|
25
26
|
args = arg.args.flatten.map do |a|
|
@@ -30,8 +31,11 @@ module Grumlin
|
|
30
31
|
|
31
32
|
def arg_to_query_bytecode(arg)
|
32
33
|
return ["none"] if arg.nil?
|
34
|
+
return arg.to_bytecode if arg.is_a?(TypedValue)
|
33
35
|
return arg unless arg.is_a?(AnonymousStep)
|
34
36
|
|
37
|
+
# return arg.to_bytecode if arg.is_a?(TypedValue)
|
38
|
+
|
35
39
|
args = arg.args.flatten.map do |a|
|
36
40
|
a.instance_of?(AnonymousStep) ? Typing.to_bytecode(to_bytecode(a.steps)) : arg_to_query_bytecode(a)
|
37
41
|
end
|
data/lib/grumlin/traversal.rb
CHANGED
@@ -4,18 +4,17 @@ module Grumlin
|
|
4
4
|
class Traversal
|
5
5
|
attr_reader :connection
|
6
6
|
|
7
|
+
# TODO: add other start steps
|
8
|
+
SUPPORTED_START_STEPS = %w[E V addE addV].freeze
|
9
|
+
|
7
10
|
def initialize(pool = Grumlin.config.default_pool)
|
8
11
|
@pool = pool
|
9
12
|
end
|
10
13
|
|
11
|
-
|
12
|
-
%w[addV addE V E].each do |step|
|
14
|
+
SUPPORTED_START_STEPS.each do |step|
|
13
15
|
define_method step do |*args|
|
14
16
|
Step.new(@pool, step, *args)
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
18
|
-
alias addVertex addV
|
19
|
-
alias addEdge addE
|
20
19
|
end
|
21
20
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grumlin
|
4
|
+
# TODO: find a better name
|
5
|
+
class TypedValue
|
6
|
+
def initialize(type, value)
|
7
|
+
@type = type
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def inspect(*)
|
12
|
+
"#{@type}.#{@value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_bytecode
|
16
|
+
@to_bytecode ||= { "@type": "g:#{@type}", "@value": @value }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/grumlin/u.rb
CHANGED
@@ -2,8 +2,11 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module U
|
5
|
+
# TODO: add other start steps
|
6
|
+
SUPPORTED_START_STEPS = %w[V addV count has out unfold values].freeze
|
7
|
+
|
5
8
|
class << self
|
6
|
-
|
9
|
+
SUPPORTED_START_STEPS.each do |step|
|
7
10
|
define_method step do |*args|
|
8
11
|
AnonymousStep.new(step, *args)
|
9
12
|
end
|
data/lib/grumlin/version.rb
CHANGED
data/lib/grumlin.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-pool
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- ".overcommit.yml"
|
51
51
|
- ".rspec"
|
52
52
|
- ".rubocop.yml"
|
53
|
+
- ".tool-versions"
|
53
54
|
- CHANGELOG.md
|
54
55
|
- CODE_OF_CONDUCT.md
|
55
56
|
- Gemfile
|
@@ -82,6 +83,7 @@ files:
|
|
82
83
|
- lib/grumlin/translator.rb
|
83
84
|
- lib/grumlin/transport.rb
|
84
85
|
- lib/grumlin/traversal.rb
|
86
|
+
- lib/grumlin/typed_value.rb
|
85
87
|
- lib/grumlin/typing.rb
|
86
88
|
- lib/grumlin/u.rb
|
87
89
|
- lib/grumlin/version.rb
|