grumlin 0.14.5 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/grumlin/anonymous_step.rb +2 -2
- data/lib/grumlin/property.rb +24 -0
- data/lib/grumlin/traverser.rb +12 -0
- data/lib/grumlin/typing.rb +13 -3
- data/lib/grumlin/version.rb +1 -1
- 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: e6bc5993ec07bf70b93c7f7b73e2e3716c14b3457ddedbbda0e6f38d5f2c19ff
|
4
|
+
data.tar.gz: b23c85808cacf2585fbc7c47f60d093049c1976ca13acd0317d0c71bf9871a5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b752f3c20878758524da9d31de2114bca8d6585c9a9038989acef2ec21a888bbd667fe9ece033f257c67751eb87c33025c2876f80f80e3a983f25fb09c1e4b37
|
7
|
+
data.tar.gz: 9ac44ccf984d626cbb8254185534c75061d139934a613fae13c45cfd0cdbdf1d4d35ca088e0ff2a1073196294d8b38a5c4eff8a5b2a8a3258327537ad66daab6
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grumlin (0.
|
4
|
+
grumlin (0.15.0)
|
5
5
|
async-pool (~> 0.3)
|
6
6
|
async-websocket (~> 0.19)
|
7
7
|
oj (~> 3.12)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
racc (~> 1.4)
|
69
69
|
nokogiri (1.11.7-x86_64-linux)
|
70
70
|
racc (~> 1.4)
|
71
|
-
oj (3.13.
|
71
|
+
oj (3.13.11)
|
72
72
|
overcommit (0.57.0)
|
73
73
|
childprocess (>= 0.6.3, < 5)
|
74
74
|
iniparse (~> 1.4)
|
data/README.md
CHANGED
@@ -7,8 +7,8 @@ module Grumlin
|
|
7
7
|
# TODO: add other steps
|
8
8
|
SUPPORTED_STEPS = %i[E V addE addV aggregate and as both bothE by choose coalesce count dedup drop elementMap emit
|
9
9
|
fold from group groupCount has hasId hasLabel hasNot id in inE inV is label limit not or order
|
10
|
-
out outE path project property range repeat sack select sideEffect skip sum tail to
|
11
|
-
union until valueMap values where with].freeze
|
10
|
+
out outE path project properties property range repeat sack select sideEffect skip sum tail to
|
11
|
+
unfold union until valueMap values where with].freeze
|
12
12
|
|
13
13
|
def initialize(name, *args, configuration_steps: [], previous_step: nil, **params)
|
14
14
|
@name = name
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grumlin
|
4
|
+
class Property
|
5
|
+
attr_reader :key, :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@key = value[:key]
|
9
|
+
@value = Typing.cast(value[:value])
|
10
|
+
end
|
11
|
+
|
12
|
+
def inspect
|
13
|
+
"p[#{key}->#{value}]"
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
inspect
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(other)
|
21
|
+
self.class == other.class && @key == other.key && @value == other.value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/grumlin/typing.rb
CHANGED
@@ -3,16 +3,17 @@
|
|
3
3
|
module Grumlin
|
4
4
|
module Typing
|
5
5
|
TYPES = {
|
6
|
-
"g:List" => ->(value) { value
|
7
|
-
"g:Set" => ->(value) {
|
6
|
+
"g:List" => ->(value) { cast_list(value) },
|
7
|
+
"g:Set" => ->(value) { cast_list(value).to_set },
|
8
8
|
"g:Map" => ->(value) { cast_map(value) },
|
9
9
|
"g:Vertex" => ->(value) { cast_entity(Grumlin::Vertex, value) },
|
10
10
|
"g:Edge" => ->(value) { cast_entity(Grumlin::Edge, value) },
|
11
11
|
"g:Path" => ->(value) { cast_entity(Grumlin::Path, value) },
|
12
|
+
"g:Traverser" => ->(value) { cast_entity(Traverser, value) },
|
13
|
+
"g:Property" => ->(value) { cast_entity(Property, value) },
|
12
14
|
"g:Int64" => ->(value) { cast_int(value) },
|
13
15
|
"g:Int32" => ->(value) { cast_int(value) },
|
14
16
|
"g:Double" => ->(value) { cast_double(value) },
|
15
|
-
"g:Traverser" => ->(value) { cast(value[:value]) }, # TODO: wtf is bulk?
|
16
17
|
"g:Direction" => ->(value) { value },
|
17
18
|
# "g:VertexProperty"=> ->(value) { value }, # TODO: implement me
|
18
19
|
"g:T" => ->(value) { value.to_sym }
|
@@ -73,6 +74,15 @@ module Grumlin
|
|
73
74
|
rescue ArgumentError
|
74
75
|
raise TypeError, "#{value} cannot be casted to Hash"
|
75
76
|
end
|
77
|
+
|
78
|
+
def cast_list(value)
|
79
|
+
value.each_with_object([]) do |item, result|
|
80
|
+
casted_value = cast(item)
|
81
|
+
next (result << casted_value) unless casted_value.instance_of?(Traverser)
|
82
|
+
|
83
|
+
casted_value.bulk.times { result << casted_value.value }
|
84
|
+
end
|
85
|
+
end
|
76
86
|
end
|
77
87
|
end
|
78
88
|
end
|
data/lib/grumlin/version.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.15.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:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-pool
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/grumlin/expressions/u.rb
|
112
112
|
- lib/grumlin/expressions/with_options.rb
|
113
113
|
- lib/grumlin/path.rb
|
114
|
+
- lib/grumlin/property.rb
|
114
115
|
- lib/grumlin/repository.rb
|
115
116
|
- lib/grumlin/request_dispatcher.rb
|
116
117
|
- lib/grumlin/shortcut_proxy.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- lib/grumlin/test/rspec/gremlin_context.rb
|
124
125
|
- lib/grumlin/transport.rb
|
125
126
|
- lib/grumlin/traversal.rb
|
127
|
+
- lib/grumlin/traverser.rb
|
126
128
|
- lib/grumlin/typed_value.rb
|
127
129
|
- lib/grumlin/typing.rb
|
128
130
|
- lib/grumlin/version.rb
|