wongi-engine 0.3.7 → 0.3.8
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/.github/workflows/test.yml +24 -0
- data/lib/wongi-engine/dsl/clause/aggregate.rb +1 -1
- data/lib/wongi-engine/dsl.rb +1 -1
- data/lib/wongi-engine/graph.rb +17 -21
- data/lib/wongi-engine/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d4c949466ca4e0cdc187b571ebc8d406ee36c06b135216355b791ecb20c78ab
|
4
|
+
data.tar.gz: 44b91d4d18f9fb1c7f87b8a837a67d8489e255803f68e25be87b636d620de113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a1534278af39a9a0449c812483706fe552ec72b63ef38d59eed3899e38c88c8988b5e6eed860fb43a24d0913b97819978034426fc9ac3e2f1b623fee1ae0c53
|
7
|
+
data.tar.gz: 9a7457a55a61cdd825b929d9aac2fd3a8f4b3b56609492c2dc124ea96dffd1348cdb23e957a404fec320eab12aeebbe3746c81d1f52e221cf6912761c458db8d
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ["3.1", "3.0", "2.7", "2.6", "jruby-head"]
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
23
|
+
- name: Run tests
|
24
|
+
run: bundle exec rake
|
data/lib/wongi-engine/dsl.rb
CHANGED
@@ -101,7 +101,7 @@ module Wongi::Engine::DSL
|
|
101
101
|
|
102
102
|
clause :count
|
103
103
|
body { |s, p, o, opts|
|
104
|
-
aggregate s, p, o, map: ->(_) { 1 }, function: -> {
|
104
|
+
aggregate s, p, o, map: ->(_) { 1 }, function: ->(collection) { collection.inject(&:+) }, assign: opts[:assign]
|
105
105
|
}
|
106
106
|
|
107
107
|
clause :assert, :dynamic
|
data/lib/wongi-engine/graph.rb
CHANGED
@@ -14,16 +14,12 @@ module Wongi::Engine
|
|
14
14
|
return
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
io.puts "digraph {"
|
18
18
|
|
19
|
-
|
19
|
+
dump_alphas(io) unless opts[:alpha] == false
|
20
|
+
dump_betas(io, opts)
|
20
21
|
|
21
|
-
|
22
|
-
dump_betas(opts)
|
23
|
-
|
24
|
-
@io.puts "}"
|
25
|
-
ensure
|
26
|
-
@io = nil
|
22
|
+
io.puts "}"
|
27
23
|
end
|
28
24
|
|
29
25
|
private
|
@@ -32,34 +28,34 @@ module Wongi::Engine
|
|
32
28
|
h.to_s.gsub(/-/, '_')
|
33
29
|
end
|
34
30
|
|
35
|
-
def dump_alphas(
|
36
|
-
|
31
|
+
def dump_alphas(io)
|
32
|
+
io.puts "subgraph cluster_alphas {"
|
37
33
|
@rete.alphas.reject { |alpha| alpha.betas.empty? }.each do |alpha|
|
38
|
-
|
34
|
+
io.puts "node#{print_hash alpha.object_id} [shape=box label=\"#{alpha.template.to_s.gsub(/"/, '"')}\"];"
|
39
35
|
end
|
40
|
-
|
36
|
+
io.puts "};"
|
41
37
|
end
|
42
38
|
|
43
|
-
def dump_betas(opts)
|
44
|
-
dump_beta @rete.beta_top, opts
|
39
|
+
def dump_betas(io, opts)
|
40
|
+
dump_beta(io, @rete.beta_top, opts)
|
45
41
|
end
|
46
42
|
|
47
|
-
def dump_beta(beta, opts)
|
43
|
+
def dump_beta(io, beta, opts)
|
48
44
|
return if @seen_betas.include? beta
|
49
45
|
|
50
46
|
@seen_betas << beta
|
51
|
-
|
47
|
+
io.puts "node#{print_hash beta.object_id} [label=\"#{beta.class.name.split('::').last}\"];"
|
52
48
|
if beta.is_a? NccNode
|
53
|
-
|
54
|
-
|
49
|
+
io.puts "node#{print_hash beta.partner.object_id} -> node#{print_hash beta.object_id};"
|
50
|
+
io.puts "{ rank=same; node#{print_hash beta.partner.object_id} node#{print_hash beta.object_id} }"
|
55
51
|
end
|
56
52
|
if beta.respond_to?(:alpha) && opts[:alpha] != false
|
57
53
|
alpha = beta.alpha
|
58
|
-
|
54
|
+
io.puts "node#{print_hash alpha.object_id} -> node#{print_hash beta.object_id};" if alpha
|
59
55
|
end
|
60
56
|
beta.children.each do |child|
|
61
|
-
|
62
|
-
dump_beta child, opts
|
57
|
+
io.puts "node#{print_hash beta.object_id} -> node#{print_hash child.object_id};"
|
58
|
+
dump_beta(io, child, opts)
|
63
59
|
end
|
64
60
|
end
|
65
61
|
end
|
data/lib/wongi-engine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wongi-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valeri Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -73,6 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/test.yml"
|
76
77
|
- ".gitignore"
|
77
78
|
- ".hgtags"
|
78
79
|
- ".rubocop.yml"
|