amigo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amigo/initial_result.rb +1 -1
- data/lib/amigo/version.rb +1 -1
- data/lib/amigo/where.rb +4 -4
- data/spec/amigo/select/execute_spec.rb +50 -10
- metadata +5 -5
data/lib/amigo/initial_result.rb
CHANGED
data/lib/amigo/version.rb
CHANGED
data/lib/amigo/where.rb
CHANGED
@@ -25,17 +25,17 @@ module Amigo
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def select(statements)
|
28
|
-
statements.reduce(Hamster.
|
28
|
+
statements.reduce(Hamster.list) do |result, statement|
|
29
29
|
next result unless select?(statement)
|
30
|
-
result.
|
30
|
+
result.cons(bind(statement, Hamster.hash))
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
def join(statements, rows)
|
35
|
-
rows.reduce(Hamster.
|
35
|
+
rows.reduce(Hamster.list) do |result, row|
|
36
36
|
statements.reduce(result) do |result, statement|
|
37
37
|
next result unless join?(statement, row)
|
38
|
-
result.
|
38
|
+
result.cons(bind(statement, row))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -20,8 +20,16 @@ module Amigo
|
|
20
20
|
execute(Hamster.set(Triple.new(URI.parse(URI.parse("ex_book:book1")), URI.parse(URI.parse("dc:title")), "SPARQL Tutorial")))
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
describe "the result" do
|
24
|
+
|
25
|
+
it "is a list" do
|
26
|
+
@result.class.should include(Hamster::List)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "has a single solution" do
|
30
|
+
@result.size.should == 1
|
31
|
+
end
|
32
|
+
|
25
33
|
end
|
26
34
|
|
27
35
|
describe "the solution" do
|
@@ -46,8 +54,16 @@ module Amigo
|
|
46
54
|
execute(Hamster.set(Triple.new(URI.parse("ex_book:book1"), URI.parse("dc:title"), "SPARQL Tutorial")))
|
47
55
|
end
|
48
56
|
|
49
|
-
|
50
|
-
|
57
|
+
describe "the result" do
|
58
|
+
|
59
|
+
it "is a list" do
|
60
|
+
@result.class.should include(Hamster::List)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "returns the correct number of solutions" do
|
64
|
+
@result.size.should == 1
|
65
|
+
end
|
66
|
+
|
51
67
|
end
|
52
68
|
|
53
69
|
describe "each solution" do
|
@@ -72,8 +88,16 @@ module Amigo
|
|
72
88
|
execute(Hamster.set(Triple.new(URI.parse("ns:y"), URI.parse("ns:p"), 42)))
|
73
89
|
end
|
74
90
|
|
75
|
-
|
76
|
-
|
91
|
+
describe "the result" do
|
92
|
+
|
93
|
+
it "is a list" do
|
94
|
+
@result.class.should include(Hamster::List)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "returns the correct number of solutions" do
|
98
|
+
@result.size.should == 1
|
99
|
+
end
|
100
|
+
|
77
101
|
end
|
78
102
|
|
79
103
|
describe "each solution" do
|
@@ -98,8 +122,16 @@ module Amigo
|
|
98
122
|
execute(Hamster.set(Triple.new(URI.parse("ex_book:book1"), URI.parse("dc:title"), "SPARQL Tutorial")))
|
99
123
|
end
|
100
124
|
|
101
|
-
|
102
|
-
|
125
|
+
describe "the result" do
|
126
|
+
|
127
|
+
it "is a list" do
|
128
|
+
@result.class.should include(Hamster::List)
|
129
|
+
end
|
130
|
+
|
131
|
+
it "returns the correct number of solutions" do
|
132
|
+
@result.size.should == 1
|
133
|
+
end
|
134
|
+
|
103
135
|
end
|
104
136
|
|
105
137
|
describe "each solution" do
|
@@ -137,8 +169,16 @@ module Amigo
|
|
137
169
|
sort_by(&:name)
|
138
170
|
end
|
139
171
|
|
140
|
-
|
141
|
-
|
172
|
+
describe "the result" do
|
173
|
+
|
174
|
+
it "is a list" do
|
175
|
+
@result.class.should include(Hamster::List)
|
176
|
+
end
|
177
|
+
|
178
|
+
it "returns the correct number of solutions" do
|
179
|
+
@result.size.should == 2
|
180
|
+
end
|
181
|
+
|
142
182
|
end
|
143
183
|
|
144
184
|
describe "each solution" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Simon Harris
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-16 00:00:00 +10:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
- 3
|
30
|
-
-
|
31
|
-
version: 0.3.
|
30
|
+
- 7
|
31
|
+
version: 0.3.7
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|