amigo 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/triple'
4
+
5
+ module Amigo
6
+
7
+ describe Triple do
8
+
9
+ it "is immutable" do
10
+ Triple.should include(Hamster::Immutable)
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/triple'
4
+
5
+ module Amigo
6
+
7
+ describe Triple do
8
+
9
+ describe "#inspect" do
10
+
11
+ before do
12
+ @triple = Triple.new("borrower", "holds", "library card")
13
+ end
14
+
15
+ it "returns a programmer friendly representation" do
16
+ @triple.inspect.should == %q{"borrower" "holds" "library card" .}
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/uri'
4
+ require 'amigo/triple'
5
+
6
+ module Amigo
7
+
8
+ describe Triple do
9
+
10
+ describe "#to_ntriple" do
11
+
12
+ [
13
+ [["a", "b", "c"], %q{"a" "b" "c" .}],
14
+ [[URI.parse("http://www.example.com/x"), "b", URI.parse("http://www.example.com/z")], %q{<http://www.example.com/x> "b" <http://www.example.com/z> .}],
15
+ ].each do |triple, ntriple|
16
+
17
+ describe "given #{triple.inspect}" do
18
+
19
+ before do
20
+ @triple = Triple.new(*triple)
21
+ end
22
+
23
+ it "returns #{ntriple.inspect}" do
24
+ @triple.to_ntriple.should == ntriple
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/uri'
4
+
5
+ module Amigo
6
+
7
+ describe URI do
8
+
9
+ describe "#to_ntriple" do
10
+
11
+ [
12
+ ["http://www.example.com/", "<http://www.example.com/>"],
13
+ ["foaf:name", "<foaf:name>"],
14
+ ].each do |uri, sparql|
15
+
16
+ describe "given #{uri.inspect}" do
17
+
18
+ before do
19
+ @uri = URI.new(uri)
20
+ end
21
+
22
+ it "returns #{sparql.inspect}" do
23
+ @uri.to_ntriple.should == sparql
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/uri'
4
+
5
+ module Amigo
6
+
7
+ describe URI do
8
+
9
+ describe "#to_sparql" do
10
+
11
+ [
12
+ ["http://www.example.com/", "<http://www.example.com/>"],
13
+ ["foaf:name", "<foaf:name>"],
14
+ ].each do |uri, sparql|
15
+
16
+ describe "given #{uri.inspect}" do
17
+
18
+ before do
19
+ @uri = URI.new(uri)
20
+ end
21
+
22
+ it "returns #{sparql.inspect}" do
23
+ @uri.to_sparql.should == sparql
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/variable'
4
+
5
+ module Amigo
6
+
7
+ describe Variable do
8
+
9
+ describe "#to_sparql" do
10
+
11
+ [
12
+ [:subject, :a, "?a"],
13
+ [:predicate, :x, "?x"],
14
+ [:object, :flibble, "?flibble"]
15
+ ].each do |component, name, sparql|
16
+
17
+ describe "given #{name.inspect}" do
18
+
19
+ before do
20
+ @variable = Variable.new(component, name)
21
+ end
22
+
23
+ it "returns #{sparql.inspect}" do
24
+ @variable.to_sparql.should == sparql
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/variables'
4
+
5
+ module Amigo
6
+
7
+ describe Variables do
8
+
9
+ it "is immutable" do
10
+ Variables.should include(Hamster::Immutable)
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/variables'
4
+
5
+ module Amigo
6
+
7
+ describe Variables do
8
+
9
+ describe "#include?" do
10
+
11
+ [
12
+ [Variables.new(:*), :a, true],
13
+ [Variables.new(:*), :b, true],
14
+ [Variables.new(:*), :c, true],
15
+ [Variables.new(:a, :b, :c), :a, true],
16
+ [Variables.new(:a, :b, :c), :b, true],
17
+ [Variables.new(:a, :b, :c), :c, true],
18
+ [Variables.new(:a, :b, :c), :z, false],
19
+ [Variables.new(:a, :c), :a, true],
20
+ [Variables.new(:a, :c), :c, true],
21
+ [Variables.new(:a, :c), :b, false],
22
+ ].each do |variables, variable, expected|
23
+
24
+ describe "given #{variables.inspect}" do
25
+
26
+ it "returns #{expected}" do
27
+ variables.include?(variable).should == expected
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/variables'
4
+
5
+ module Amigo
6
+
7
+ describe Variables do
8
+
9
+ describe "#to_sparql" do
10
+
11
+ [
12
+ [[:*], "*"],
13
+ [[:a, :b, :c], "?a ?b ?c"],
14
+ [[:a, :c], "?a ?c"],
15
+ [[:z, :y, :x], "?z ?y ?x"],
16
+ ].each do |names, sparql|
17
+
18
+ describe "given #{names.inspect}" do
19
+
20
+ before do
21
+ @variables = Variables.new(*names)
22
+ end
23
+
24
+ it "returns #{sparql.inspect}" do
25
+ @variables.to_sparql.should == sparql
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ require 'amigo/where'
4
+
5
+ module Amigo
6
+
7
+ describe Where do
8
+
9
+ describe "#to_sparql" do
10
+
11
+ [
12
+ [[:a, :b, :c], "?a ?b ?c ."],
13
+ [[:aye, :bee, :see], "?aye ?bee ?see ."],
14
+ [[:a, "bee", :c], "?a \"bee\" ?c ."],
15
+ [["aye", :b, "c"], "\"aye\" ?b \"c\" ."],
16
+ ].each do |components, sparql|
17
+
18
+ describe "given #{components.inspect}" do
19
+
20
+ before do
21
+ @where = Where.new(*components)
22
+ end
23
+
24
+ it "returns #{sparql.inspect}" do
25
+ @where.to_sparql.should == sparql
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --loadby random
@@ -0,0 +1,2 @@
1
+ # Common spec-related code goes here
2
+ require 'rubygems' unless defined?(Gem)
@@ -0,0 +1,6 @@
1
+ require 'spec/rake/spectask'
2
+
3
+ desc "Run specifications"
4
+ Spec::Rake::SpecTask.new(:spec) do |t|
5
+ t.spec_opts << "--options" << "spec/spec.opts" if File.exists?("spec/spec.opts")
6
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: amigo
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Simon Harris
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-14 00:00:00 +10:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: hamster
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 3
30
+ - 6
31
+ version: 0.3.6
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 3
44
+ - 0
45
+ version: 1.3.0
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: diff-lcs
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 1
58
+ - 2
59
+ version: 1.1.2
60
+ type: :development
61
+ version_requirements: *id003
62
+ description: In-memory triple store
63
+ email: haruki.zaemon@gmail.com
64
+ executables: []
65
+
66
+ extensions: []
67
+
68
+ extra_rdoc_files:
69
+ - README.rdoc
70
+ - History.rdoc
71
+ - LICENSE
72
+ files:
73
+ - lib/amigo/core_ext/object.rb
74
+ - lib/amigo/core_ext.rb
75
+ - lib/amigo/initial_result.rb
76
+ - lib/amigo/join_result.rb
77
+ - lib/amigo/select.rb
78
+ - lib/amigo/solution.rb
79
+ - lib/amigo/store.rb
80
+ - lib/amigo/term.rb
81
+ - lib/amigo/triple.rb
82
+ - lib/amigo/uri.rb
83
+ - lib/amigo/variable.rb
84
+ - lib/amigo/variables.rb
85
+ - lib/amigo/version.rb
86
+ - lib/amigo/where.rb
87
+ - lib/amigo.rb
88
+ - spec/amigo/select/execute_spec.rb
89
+ - spec/amigo/select/immutable_spec.rb
90
+ - spec/amigo/select/to_sparql_spec.rb
91
+ - spec/amigo/select/to_sql_spec.rb
92
+ - spec/amigo/store/to_ntriples_spec.rb
93
+ - spec/amigo/term/to_sparql_spec.rb
94
+ - spec/amigo/triple/immutable_spec.rb
95
+ - spec/amigo/triple/inspect_spec.rb
96
+ - spec/amigo/triple/to_ntriple_spec.rb
97
+ - spec/amigo/uri/to_ntriple_spec.rb
98
+ - spec/amigo/uri/to_sparql_spec.rb
99
+ - spec/amigo/variable/to_sparql_spec.rb
100
+ - spec/amigo/variables/immutable_spec.rb
101
+ - spec/amigo/variables/include_spec.rb
102
+ - spec/amigo/variables/to_sparql_spec.rb
103
+ - spec/amigo/where/to_sparql_spec.rb
104
+ - spec/spec.opts
105
+ - spec/spec_helper.rb
106
+ - tasks/spec.rb
107
+ - Rakefile
108
+ - README.rdoc
109
+ - History.rdoc
110
+ - LICENSE
111
+ has_rdoc: true
112
+ homepage: http://github.com/harukizaemon/amigo
113
+ licenses: []
114
+
115
+ post_install_message:
116
+ rdoc_options: []
117
+
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 1
126
+ - 8
127
+ - 7
128
+ version: 1.8.7
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ requirements: []
137
+
138
+ rubyforge_project:
139
+ rubygems_version: 1.3.6
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: In-memory triple store
143
+ test_files: []
144
+