pacer 2.0.20-java → 2.0.22-java
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/README.md +1 -0
- data/lib/pacer/loader.rb +1 -0
- data/lib/pacer/transform/gather_section.rb +100 -0
- data/lib/pacer/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 795f8abed85009564fee9dab5d216b8da0e4b376
|
4
|
+
data.tar.gz: 3c11929329d4a038d3866ec02969955f2f5f9570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40b05f5d1665ed2dd697f8b3c99bfb099c40d5412a8966c38b4d79f13488c60d67a636d73aed70dc60d3bbbb49365c5beb5e4736b81391c70fdfc47743386f44
|
7
|
+
data.tar.gz: 59ed57f1501dda498244bb17ae62d903cd8026f53ebb9cb1ce2a7d1e4d1460b66e244c9ba1afd8bd8f3f8bebc01cad3f4de9294f34f3973e970d64632733b160
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Pacer
|
2
2
|
[](https://coveralls.io/r/pangloss/pacer) [](https://travis-ci.org/pangloss/pacer) [](https://codeclimate.com/github/pangloss/pacer)
|
3
3
|
|
4
|
+
|
4
5
|
Pacer is a JRuby library that enables very expressive graph traversals.
|
5
6
|
|
6
7
|
It currently supports all of the major graph databases including [OrientDB](http://orientdb.com), [Neo4j](http://neo4j.org)
|
data/lib/pacer/loader.rb
CHANGED
@@ -103,6 +103,7 @@ require 'pacer/transform/intersect_sections'
|
|
103
103
|
require 'pacer/transform/payload'
|
104
104
|
require 'pacer/transform/lookup_ids'
|
105
105
|
require 'pacer/transform/count_section'
|
106
|
+
require 'pacer/transform/gather_section'
|
106
107
|
|
107
108
|
require 'pacer/side_effect/aggregate'
|
108
109
|
require 'pacer/side_effect/as_var'
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Routes
|
3
|
+
module RouteOperations
|
4
|
+
def gather_section(section = nil, opts = {})
|
5
|
+
wrapper = Pacer::Wrappers::WrapperSelector.build graph, element_type, extensions
|
6
|
+
chain_route opts.merge(element_type: :array, transform: :gather_section,
|
7
|
+
section: section, build_wrapper: wrapper)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module Transform
|
13
|
+
module GatherSection
|
14
|
+
# VisitsSection module provides:
|
15
|
+
# section=
|
16
|
+
# section_visitor
|
17
|
+
include Pacer::Visitors::VisitsSection
|
18
|
+
|
19
|
+
attr_accessor :build_wrapper
|
20
|
+
|
21
|
+
def to_id_hash
|
22
|
+
id_pairs = paths.pairs(-2, -1).map(element_type: :array) do |(k, v)|
|
23
|
+
[k.element_id, v.map { |e| e.element_id }]
|
24
|
+
end
|
25
|
+
Hash[*id_pairs.flatten]
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_hash
|
29
|
+
Hash[*paths.pairs(-2, -1).flatten]
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
def attach_pipe(end_pipe)
|
35
|
+
# TODO: wrap gathered vertices
|
36
|
+
pipe = GatherSectionPipe.new(section_visitor, graph, build_wrapper)
|
37
|
+
pipe.setStarts end_pipe if end_pipe
|
38
|
+
pipe
|
39
|
+
end
|
40
|
+
|
41
|
+
class GatherSectionPipe < Pacer::Pipes::RubyPipe
|
42
|
+
attr_reader :to_emit, :collecting, :collecting_path, :section, :graph, :wrapper
|
43
|
+
attr_reader :getPathToHere
|
44
|
+
|
45
|
+
def initialize(visitor_pipe, graph, wrapper)
|
46
|
+
super()
|
47
|
+
@collecting = []
|
48
|
+
@graph = graph
|
49
|
+
@wrapper = wrapper
|
50
|
+
@visitor_pipe = visitor_pipe
|
51
|
+
if visitor_pipe
|
52
|
+
visitor_pipe.visitor = self
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def processNextStart
|
57
|
+
if pathEnabled
|
58
|
+
while !to_emit
|
59
|
+
e = wrapper.new(graph, starts.next)
|
60
|
+
collecting << e
|
61
|
+
@collecting_path = @visitor_pipe.getCurrentPath
|
62
|
+
end
|
63
|
+
else
|
64
|
+
while !to_emit
|
65
|
+
e = wrapper.new(graph, starts.next)
|
66
|
+
collecting << e
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if !to_emit
|
70
|
+
raise EmptyPipe.instance
|
71
|
+
else
|
72
|
+
emit
|
73
|
+
end
|
74
|
+
rescue EmptyPipe, java.util.NoSuchElementException
|
75
|
+
if collecting
|
76
|
+
@collecting = nil
|
77
|
+
emit
|
78
|
+
else
|
79
|
+
raise EmptyPipe.instance
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def emit
|
84
|
+
e = to_emit
|
85
|
+
@to_emit = nil
|
86
|
+
e
|
87
|
+
end
|
88
|
+
|
89
|
+
def after_element
|
90
|
+
unless collecting.empty?
|
91
|
+
@to_emit = collecting
|
92
|
+
@getPathToHere = collecting_path
|
93
|
+
@collecting = []
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
data/lib/pacer/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pacer
|
2
|
-
VERSION = "2.0.
|
2
|
+
VERSION = "2.0.22"
|
3
3
|
# Clients may optionally define the following constants in the Pacer namespace:
|
4
4
|
# - LOAD_JARS : set to false to manage jar loading in the client. Be sure to load the jars defined in JARFILES.
|
5
5
|
# - LOCKJAR_LOCK_OPTS : set some options to be passed to LockJar.lock (ie. :lockfile, :download_artifacts, :local_repo)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.22
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Darrick Wiebe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lock_jar
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- lib/pacer/transform/count_section.rb
|
195
195
|
- lib/pacer/transform/flat_map.rb
|
196
196
|
- lib/pacer/transform/gather.rb
|
197
|
+
- lib/pacer/transform/gather_section.rb
|
197
198
|
- lib/pacer/transform/has_count_cap.rb
|
198
199
|
- lib/pacer/transform/identity.rb
|
199
200
|
- lib/pacer/transform/intersect_sections.rb
|