agraph 0.1.5 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,43 +1,18 @@
1
- require 'rubygems'
2
-
3
- gem 'rspec'
4
- require 'rspec'
1
+ require 'bundler/gem_tasks'
5
2
  require 'rspec/core/rake_task'
6
-
7
- gem 'reek'
8
3
  require 'reek/rake/task'
4
+ require 'rdoc/task'
9
5
 
10
- require 'rake/rdoctask'
11
-
12
- task :default => :spec
13
-
14
- namespace :gem do
15
-
16
- desc "Builds the gem"
17
- task :build do
18
- system "gem build *.gemspec && mkdir -p pkg/ && mv *.gem pkg/"
19
- end
20
-
21
- desc "Builds and installs the gem"
22
- task :install => :build do
23
- system "gem install pkg/"
24
- end
25
-
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
+ t.pattern = "spec/lib/**/*_spec.rb"
26
8
  end
27
9
 
28
- Reek::Rake::Task.new do |task|
29
- task.fail_on_error = true
30
- end
10
+ Rake::RDocTask.new(:spec)
31
11
 
32
- desc "Generate the rdoc"
33
- Rake::RDocTask.new do |rdoc|
34
- rdoc.rdoc_files.add [ "README.rdoc", "lib/**/*.rb" ]
35
- rdoc.main = "README.rdoc"
36
- end
12
+ task :default => :spec
37
13
 
38
- desc "Run all specs in spec directory"
39
- RSpec::Core::RakeTask.new do |task|
40
- task.pattern = "spec/lib/**/*_spec.rb"
14
+ Reek::Rake::Task.new do |t|
15
+ t.fail_on_error = false
41
16
  end
42
17
 
43
18
  namespace :spec do
@@ -47,4 +22,4 @@ namespace :spec do
47
22
  task.pattern = "spec/integration/**/*_spec.rb"
48
23
  end
49
24
 
50
- end
25
+ end
@@ -65,7 +65,28 @@ module AllegroGraph
65
65
  response.to_i
66
66
  end
67
67
 
68
- def transaction(options = { }, &block)
68
+ def remove_duplicates(mode=:spog)
69
+ response = @server.request_http :delete, self.path + "/statements/duplicates", :parameters => {:mode => mode.to_s}, :expected_status_code => 200
70
+ response.to_i
71
+ end
72
+
73
+ def suppress_duplicates=(type=:spog)
74
+ response = @server.request_http :put, self.path + "/suppressDuplicates", :parameters => {:type => type.to_s}, :expected_status_code => 204
75
+ true
76
+ end
77
+
78
+ def suppress_duplicates
79
+ strategy = @server.request_http :get, self.path + "/suppressDuplicates", :expected_status_code => 200
80
+ strategy == 'false' ? false : strategy.to_sym
81
+ end
82
+
83
+ def optimize(parameters={})
84
+ parameters = { :wait => 'false', :level => '1' }.merge(parameters)
85
+ response = @server.request_http :post, self.path + "/indices/optimize", :parameters => parameters, :expected_status_code => 204
86
+ response == 'nil'
87
+ end
88
+
89
+ def transaction(options={}, &block)
69
90
  self.class.transaction self, options, &block
70
91
  end
71
92
 
@@ -112,6 +112,37 @@
112
112
  :response:
113
113
  :code: "200"
114
114
  :body: "3"
115
+ -
116
+ :http_method: "post"
117
+ :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/indices/optimize"
118
+ :parameters:
119
+ :wait: "false"
120
+ :level: "1"
121
+ :response:
122
+ :code: "204"
123
+ :body: "nil"
124
+ -
125
+ :http_method: "get"
126
+ :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/suppressDuplicates"
127
+ :response:
128
+ :code: "200"
129
+ :body: "spog"
130
+ -
131
+ :http_method: "put"
132
+ :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/suppressDuplicates"
133
+ :parameters:
134
+ :type: "spog"
135
+ :response:
136
+ :code: "204"
137
+ :body: "nil"
138
+ -
139
+ :http_method: "delete"
140
+ :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/statements/duplicates"
141
+ :parameters:
142
+ :mode: "spog"
143
+ :response:
144
+ :code: "200"
145
+ :body: "27"
115
146
  -
116
147
  :http_method: "post"
117
148
  :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/statements"
@@ -6,7 +6,7 @@ describe "geo-spatial data" do
6
6
  use_real_transport!
7
7
 
8
8
  before :each do
9
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
9
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
10
10
  @repository = AllegroGraph::Repository.new @server, "test_repository"
11
11
  @repository.create_if_missing!
12
12
  @geometric = @repository.geometric
@@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib", "a
4
4
  describe "mapping" do
5
5
 
6
6
  before :each do
7
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
7
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
8
8
  @repository = AllegroGraph::Repository.new @server, "test_repository"
9
9
  @repository.create_if_missing!
10
10
  @statements = @repository.statements
@@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib", "a
4
4
  describe "query" do
5
5
 
6
6
  before :each do
7
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
7
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
8
8
  @repository = AllegroGraph::Repository.new @server, "test_repository"
9
9
 
10
10
  @repository.create_if_missing!
@@ -6,7 +6,7 @@ describe "repository" do
6
6
  use_real_transport!
7
7
 
8
8
  before :each do
9
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
9
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
10
10
  @repository = AllegroGraph::Repository.new @server, "test_repository"
11
11
  end
12
12
 
@@ -17,7 +17,7 @@ describe "repository" do
17
17
  end
18
18
 
19
19
  it "should provide a list of repositories" do
20
- @server.root_catalog.repositories.should == [ @repository ]
20
+ @server.root_catalog.repositories.should include(@repository)
21
21
  end
22
22
 
23
23
  end
@@ -6,15 +6,11 @@ describe "server" do
6
6
  use_real_transport!
7
7
 
8
8
  before :each do
9
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
9
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
10
10
  end
11
11
 
12
12
  it "should return the server's version" do
13
- @server.version.should == {
14
- :version => "4.3.3",
15
- :date => "September 30, 2011 11:55:21 GMT-0700",
16
- :revision => "internal reversion unknown"
17
- }
13
+ @server.version.should have_key(:version)
18
14
  end
19
15
 
20
16
  end
@@ -6,7 +6,7 @@ describe "statements" do
6
6
  use_real_transport!
7
7
 
8
8
  before :each do
9
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
9
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
10
10
  @repository = AllegroGraph::Repository.new @server, "test_repository"
11
11
  @repository.create_if_missing!
12
12
 
@@ -6,7 +6,7 @@ describe "transactions" do
6
6
  use_real_transport!
7
7
 
8
8
  before :each do
9
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
9
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
10
10
  @repository = AllegroGraph::Repository.new @server, "test_repository"
11
11
  @repository.create_if_missing!
12
12
 
@@ -5,7 +5,7 @@ describe AllegroGraph::Catalog do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  @catalog = AllegroGraph::Catalog.new @server, "test_catalog"
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ describe AllegroGraph::Proxy::Geometric do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  @catalog = AllegroGraph::Catalog.new @server, "test_catalog"
10
10
  @repository = AllegroGraph::Repository.new @catalog, "test_repository"
11
11
  @geometric = AllegroGraph::Proxy::Geometric.new @repository
@@ -5,7 +5,7 @@ describe AllegroGraph::Proxy::Geometric do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  @catalog = AllegroGraph::Catalog.new @server, "test_catalog"
10
10
  @repository = AllegroGraph::Repository.new @catalog, "test_repository"
11
11
  @mapping = AllegroGraph::Proxy::Mapping.new @repository
@@ -5,7 +5,7 @@ describe AllegroGraph::Proxy::Query do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  @catalog = AllegroGraph::Catalog.new @server, "test_catalog"
10
10
  @repository = AllegroGraph::Repository.new @catalog, "test_repository"
11
11
  @query = AllegroGraph::Proxy::Query.new @repository
@@ -5,7 +5,7 @@ describe AllegroGraph::Proxy::Statements do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  @catalog = AllegroGraph::Catalog.new @server, "test_catalog"
10
10
  @repository = AllegroGraph::Repository.new @catalog, "test_repository"
11
11
  @statements = AllegroGraph::Proxy::Statements.new @repository
@@ -5,7 +5,7 @@ describe AllegroGraph::Repository do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  @catalog = AllegroGraph::Catalog.new @server, "test_catalog"
10
10
  @repository = AllegroGraph::Repository.new @catalog, "test_repository"
11
11
  end
@@ -203,6 +203,38 @@ describe AllegroGraph::Repository do
203
203
 
204
204
  end
205
205
 
206
+ describe "remove_duplicates" do
207
+
208
+ it "should remove the duplicates" do
209
+ @repository.remove_duplicates.should == 27
210
+ end
211
+
212
+ end
213
+
214
+ describe "suppress_duplicates=" do
215
+
216
+ it "should set the suppress duplicates" do
217
+ (@repository.suppress_duplicates=:spog).should == :spog
218
+ end
219
+
220
+ end
221
+
222
+ describe "suppress_duplicates" do
223
+
224
+ it "should set the suppress duplicates" do
225
+ @repository.suppress_duplicates.should == :spog
226
+ end
227
+
228
+ end
229
+
230
+ describe "optimize" do
231
+
232
+ it "should optimize the indices" do
233
+ @repository.optimize.should be_true
234
+ end
235
+
236
+ end
237
+
206
238
  describe "transaction" do
207
239
 
208
240
  before :each do
@@ -5,7 +5,7 @@ describe AllegroGraph::Server do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
+ @server = AllegroGraph::Server.new :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  end
10
10
 
11
11
  describe "==" do
@@ -21,13 +21,13 @@ describe AllegroGraph::Server do
21
21
  end
22
22
 
23
23
  end
24
-
24
+
25
25
  describe "server" do
26
-
26
+
27
27
  it "should return the server itself" do
28
28
  @server.server.should == @server
29
29
  end
30
-
30
+
31
31
  end
32
32
 
33
33
  describe "request_http" do
@@ -5,7 +5,7 @@ describe AllegroGraph::Session do
5
5
 
6
6
  before :each do
7
7
  fake_transport!
8
- @session = AllegroGraph::Session.new :url => "http://session:5555", :username => "test", :password => "test"
8
+ @session = AllegroGraph::Session.new :url => "http://session:5555", :username => ENV['AG_USER'], :password => ENV['AG_PASS']
9
9
  end
10
10
 
11
11
  describe "request_http" do
@@ -1,7 +1,8 @@
1
1
  require 'rubygems'
2
- gem 'rspec', '>= 2'
3
2
  require 'rspec'
4
3
  require 'transport/spec'
4
+ require 'dotenv'
5
+ Dotenv.load
5
6
 
6
7
  require File.join(File.dirname(__FILE__), "..", "lib", "allegro_graph")
7
8
  require File.join(File.dirname(__FILE__), "fake_transport_helper")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,41 +10,104 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-10 00:00:00.000000000Z
13
+ date: 2013-03-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: transport
17
- requirement: &22664080 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>='
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.0
22
+ version: 1.0.5
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *22664080
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 1.0.5
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: rspec
28
- requirement: &22662900 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
- - - ! '>='
36
+ - - ~>
32
37
  - !ruby/object:Gem::Version
33
- version: '2'
38
+ version: '2.12'
34
39
  type: :development
35
40
  prerelease: false
36
- version_requirements: *22662900
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '2.12'
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: reek
39
- requirement: &22661640 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '1.3'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rake
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '10.0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: '10.0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: rdoc
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: '3.0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
40
90
  none: false
41
91
  requirements:
42
- - - ! '>='
92
+ - - ~>
43
93
  - !ruby/object:Gem::Version
44
- version: '1.2'
94
+ version: '3.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: dotenv
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '0.5'
45
103
  type: :development
46
104
  prerelease: false
47
- version_requirements: *22661640
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.5'
48
111
  description: The gem provides a client for the AllegroGraph 4.x RDF graph database.
49
112
  Features like searching geo-spatial data, type mapping and transactions are supported.
50
113
  email: b.phifty@gmail.com
@@ -55,42 +118,42 @@ extra_rdoc_files:
55
118
  files:
56
119
  - README.rdoc
57
120
  - Rakefile
121
+ - lib/agraph.rb
122
+ - lib/allegro_graph.rb
123
+ - lib/allegro_graph/resource.rb
58
124
  - lib/allegro_graph/utility.rb
59
- - lib/allegro_graph/proxy/mapping.rb
60
- - lib/allegro_graph/proxy/statements.rb
125
+ - lib/allegro_graph/server.rb
61
126
  - lib/allegro_graph/proxy/geometric.rb
127
+ - lib/allegro_graph/proxy/statements.rb
62
128
  - lib/allegro_graph/proxy/query.rb
63
- - lib/allegro_graph/catalog.rb
64
- - lib/allegro_graph/proxy.rb
129
+ - lib/allegro_graph/proxy/mapping.rb
65
130
  - lib/allegro_graph/utility/parameter_mapper.rb
66
- - lib/allegro_graph/resource.rb
67
- - lib/allegro_graph/session.rb
131
+ - lib/allegro_graph/catalog.rb
68
132
  - lib/allegro_graph/repository.rb
69
- - lib/allegro_graph/server.rb
70
- - lib/agraph.rb
71
- - lib/allegro_graph.rb
133
+ - lib/allegro_graph/session.rb
134
+ - lib/allegro_graph/proxy.rb
72
135
  - lib/code_smells.reek
73
- - spec/lib/allegro_graph/proxy/query_spec.rb
74
- - spec/lib/allegro_graph/proxy/statements_spec.rb
136
+ - spec/fake_transport_helper.rb
137
+ - spec/lib/allegro_graph/session_spec.rb
138
+ - spec/lib/allegro_graph/repository_spec.rb
75
139
  - spec/lib/allegro_graph/proxy/geometric_spec.rb
140
+ - spec/lib/allegro_graph/proxy/query_spec.rb
76
141
  - spec/lib/allegro_graph/proxy/mapping_spec.rb
77
- - spec/lib/allegro_graph/session_spec.rb
142
+ - spec/lib/allegro_graph/proxy/statements_spec.rb
78
143
  - spec/lib/allegro_graph/resource_spec.rb
79
144
  - spec/lib/allegro_graph/utility/parameter_mapper_spec.rb
80
145
  - spec/lib/allegro_graph/catalog_spec.rb
81
146
  - spec/lib/allegro_graph/server_spec.rb
82
- - spec/lib/allegro_graph/repository_spec.rb
83
147
  - spec/spec_helper.rb
84
- - spec/fake_transport_helper.rb
85
148
  - spec/fake_transport.yml
86
- - spec/integration/query_spec.rb
87
- - spec/integration/server_spec.rb
88
149
  - spec/integration/repository_spec.rb
89
- - spec/integration/statements_spec.rb
150
+ - spec/integration/query_spec.rb
90
151
  - spec/integration/transactions_spec.rb
91
- - spec/integration/geo_spatial_spec.rb
92
152
  - spec/integration/mapping_spec.rb
93
- homepage: http://github.com/abrisse/agraph
153
+ - spec/integration/server_spec.rb
154
+ - spec/integration/geo_spatial_spec.rb
155
+ - spec/integration/statements_spec.rb
156
+ homepage: http://github.com/phifty/agraph
94
157
  licenses: []
95
158
  post_install_message:
96
159
  rdoc_options: []
@@ -108,9 +171,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
171
  - - ! '>='
109
172
  - !ruby/object:Gem::Version
110
173
  version: '0'
174
+ segments:
175
+ - 0
176
+ hash: -1894223272513830765
111
177
  requirements: []
112
178
  rubyforge_project: agraph
113
- rubygems_version: 1.8.10
179
+ rubygems_version: 1.8.24
114
180
  signing_key:
115
181
  specification_version: 3
116
182
  summary: Client for the AllegroGraph 4.x graph database.