semantic-crawler 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe SemanticCrawler::GeoNames do
4
+
5
+ before(:all) do
6
+ # Congress und Messe Innsbruck
7
+ @innsbruck = SemanticCrawler::GeoNames::Country.new(47.271338, 11.395333)
8
+ end
9
+
10
+ it "get country code" do
11
+ @innsbruck.get_country_code.should eq("AT")
12
+ end
13
+
14
+ it "get wikipedia articles" do
15
+ articles = @innsbruck.get_wikipedia_articles
16
+ articles.each do |article|
17
+ article.wikipedia_url.to_s.start_with?("http").should be_true
18
+ end
19
+ end
20
+
21
+ it "get country name" do
22
+ @innsbruck.get_country_name.should eq("Austria")
23
+ end
24
+
25
+ it "get factbook country" do
26
+ factbook = @innsbruck.get_factbook_country
27
+ factbook.background.to_s.size.should > 0
28
+ factbook.country_name.to_s.should eq("Austria")
29
+ end
30
+
31
+ it "get fao country" do
32
+ fao = @innsbruck.get_fao_country
33
+ fao.country_name.to_s.should eq("Austria")
34
+ fao.population_notes.to_s.should eq("2010 Revision from the UN Population Division")
35
+ end
36
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe SemanticCrawler::LinkedGeoData do
4
+
5
+ before(:all) do
6
+ @dresden = SemanticCrawler::LinkedGeoData::RelevantNodes.new(51.033333, 13.733333, 1000)
7
+ #@dresden = SemanticCrawler::LinkedGeoData::RelevantNodes.new(51.033333, 13.733333, 1000, "TrafficSignals")
8
+ end
9
+
10
+ it "check lat/long/radius of dresden" do
11
+ @dresden.latitude.to_s.should eq("51.033333")
12
+ @dresden.longitude.to_s.should eq("13.733333")
13
+ @dresden.radius.to_s.should eq("1000")
14
+ end
15
+
16
+ it "output xml dump " do
17
+ @dresden.xml_document.size.should > 0
18
+ end
19
+
20
+ it "check single relevant node entries" do
21
+ nodes = @dresden.relevant_nodes
22
+ nodes.each do |item|
23
+ item.xml_document.size.should > 0
24
+ item.latitude.should be
25
+ item.longitude.should be
26
+ item.type.should be
27
+ item.note.should be
28
+ item.created_by.should be
29
+ item.contributor.should be
30
+
31
+ way = item.member_of_way
32
+ way.each do |way_part|
33
+ way_part.should be
34
+ end
35
+
36
+ item.wheelchair.should be
37
+ item.has_street.should be
38
+ item.has_postal_code.should be
39
+ item.has_house_number.should be
40
+ item.has_country.should be
41
+ item.has_city.should be
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,13 @@
1
+ require 'simplecov'
2
+ require 'simplecov-rcov'
3
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
4
+ SimpleCov.start 'rails'
5
+
6
+ require 'rubygems'
7
+ require 'bundler/setup'
8
+
9
+ require 'semantic_crawler'
10
+
11
+ RSpec.configure do |config|
12
+ end
13
+
File without changes
File without changes
File without changes
File without changes
@@ -8453,3 +8453,33 @@ Interrupt: : rollback transaction
8453
8453
   (0.0ms) rollback transaction
8454
8454
   (0.3ms) begin transaction
8455
8455
   (0.0ms) rollback transaction
8456
+  (0.3ms) begin transaction
8457
+  (0.0ms) rollback transaction
8458
+  (0.1ms) begin transaction
8459
+  (0.0ms) rollback transaction
8460
+  (0.3ms) begin transaction
8461
+  (0.0ms) rollback transaction
8462
+  (0.3ms) begin transaction
8463
+  (0.0ms) rollback transaction
8464
+  (0.3ms) begin transaction
8465
+  (0.1ms) rollback transaction
8466
+  (0.3ms) begin transaction
8467
+  (0.0ms) rollback transaction
8468
+  (0.3ms) begin transaction
8469
+  (0.0ms) rollback transaction
8470
+  (0.3ms) begin transaction
8471
+  (0.0ms) rollback transaction
8472
+  (0.3ms) begin transaction
8473
+  (0.0ms) rollback transaction
8474
+  (0.1ms) begin transaction
8475
+  (0.0ms) rollback transaction
8476
+  (0.3ms) begin transaction
8477
+  (0.0ms) rollback transaction
8478
+  (0.3ms) begin transaction
8479
+  (0.0ms) rollback transaction
8480
+  (0.3ms) begin transaction
8481
+  (0.0ms) rollback transaction
8482
+  (0.3ms) begin transaction
8483
+  (0.0ms) rollback transaction
8484
+  (0.3ms) begin transaction
8485
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic-crawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-14 00:00:00.000000000 Z
12
+ date: 2012-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: geonames
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: yard
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -158,72 +174,94 @@ dependencies:
158
174
  description: SemanticCrawler is a ruby library that encapsulates data gathering from
159
175
  different sources. Currently country information from Factbook and FAO (Food and
160
176
  Agriculture Organization of the United Nations), crisis information from GDACS.org
161
- and geo data from LinkedGeoData are supported.
177
+ and geo data from LinkedGeoData are supported. Additional the GeoNames module allows
178
+ to get Factbook and FAO country information from GPS coordinates.
162
179
  email:
163
180
  - alex.oberhauser@sigimera.org
164
181
  executables: []
165
182
  extensions: []
166
183
  extra_rdoc_files: []
167
184
  files:
185
+ - .gitignore
186
+ - .rspec
187
+ - .travis.yml
188
+ - .yardopts
189
+ - Gemfile
190
+ - MIT-LICENSE
191
+ - README.rdoc
192
+ - Rakefile
193
+ - changelog.sh
194
+ - exploitation/freebase.rb
168
195
  - lib/semantic_crawler.rb
169
- - lib/tasks/semantic_crawler_tasks.rake
170
- - lib/semantic_crawler/freebase/country.rb
196
+ - lib/semantic_crawler/dbpedia.rb
197
+ - lib/semantic_crawler/factbook.rb
171
198
  - lib/semantic_crawler/factbook/country.rb
172
199
  - lib/semantic_crawler/fao.rb
173
- - lib/semantic_crawler/dbpedia.rb
174
200
  - lib/semantic_crawler/fao/country.rb
175
201
  - lib/semantic_crawler/freebase.rb
176
- - lib/semantic_crawler/factbook.rb
202
+ - lib/semantic_crawler/freebase/country.rb
177
203
  - lib/semantic_crawler/gdacs.rb
178
- - lib/semantic_crawler/version.rb
179
- - lib/semantic_crawler/gdacs/resource.rb
180
204
  - lib/semantic_crawler/gdacs/emergency_feed.rb
181
- - lib/semantic_crawler/gdacs/feed.rb
182
205
  - lib/semantic_crawler/gdacs/emergency_feed_item.rb
206
+ - lib/semantic_crawler/gdacs/feed.rb
183
207
  - lib/semantic_crawler/gdacs/feed_item.rb
208
+ - lib/semantic_crawler/gdacs/resource.rb
184
209
  - lib/semantic_crawler/geo_names.rb
210
+ - lib/semantic_crawler/geo_names/country.rb
211
+ - lib/semantic_crawler/linked_geo_data.rb
185
212
  - lib/semantic_crawler/linked_geo_data/relevant_node.rb
186
213
  - lib/semantic_crawler/linked_geo_data/relevant_nodes.rb
187
- - lib/semantic_crawler/linked_geo_data.rb
188
- - log/semantic-crawler.log.20120413
189
- - log/semantic-crawler.log
190
- - MIT-LICENSE
191
- - Rakefile
192
- - README.rdoc
193
- - test/test_helper.rb
194
- - test/semantic_crawler_test.rb
195
- - test/dummy/log/test.log
196
- - test/dummy/log/development.log
197
- - test/dummy/public/422.html
198
- - test/dummy/public/favicon.ico
199
- - test/dummy/public/500.html
200
- - test/dummy/public/404.html
214
+ - lib/semantic_crawler/version.rb
215
+ - lib/tasks/semantic_crawler_tasks.rake
216
+ - log/.gitkeep
217
+ - semantic_crawler.gemspec
218
+ - spec/dbpedia_spec.rb
219
+ - spec/factbook_spec.rb
220
+ - spec/fao_austria_spec.rb
221
+ - spec/fao_papua_new_guinea_spec.rb
222
+ - spec/freebase_spec.rb
223
+ - spec/gdacs_spec.rb
224
+ - spec/geo_names_spec.rb
225
+ - spec/linked_geo_data_spec.rb
226
+ - spec/spec_helper.rb
227
+ - test/dummy/README.rdoc
228
+ - test/dummy/Rakefile
229
+ - test/dummy/app/assets/javascripts/application.js
230
+ - test/dummy/app/assets/stylesheets/application.css
231
+ - test/dummy/app/controllers/application_controller.rb
232
+ - test/dummy/app/helpers/application_helper.rb
233
+ - test/dummy/app/mailers/.gitkeep
234
+ - test/dummy/app/models/.gitkeep
235
+ - test/dummy/app/views/layouts/application.html.erb
201
236
  - test/dummy/config.ru
202
- - test/dummy/config/locales/en.yml
203
- - test/dummy/config/environments/production.rb
204
- - test/dummy/config/environments/test.rb
205
- - test/dummy/config/environments/development.rb
206
- - test/dummy/config/boot.rb
207
237
  - test/dummy/config/application.rb
238
+ - test/dummy/config/boot.rb
208
239
  - test/dummy/config/database.yml
209
240
  - test/dummy/config/environment.rb
210
- - test/dummy/config/routes.rb
211
- - test/dummy/config/initializers/secret_token.rb
212
- - test/dummy/config/initializers/inflections.rb
241
+ - test/dummy/config/environments/development.rb
242
+ - test/dummy/config/environments/production.rb
243
+ - test/dummy/config/environments/test.rb
213
244
  - test/dummy/config/initializers/backtrace_silencers.rb
214
- - test/dummy/config/initializers/wrap_parameters.rb
245
+ - test/dummy/config/initializers/inflections.rb
215
246
  - test/dummy/config/initializers/mime_types.rb
247
+ - test/dummy/config/initializers/secret_token.rb
216
248
  - test/dummy/config/initializers/session_store.rb
217
- - test/dummy/script/rails
218
- - test/dummy/README.rdoc
249
+ - test/dummy/config/initializers/wrap_parameters.rb
250
+ - test/dummy/config/locales/en.yml
251
+ - test/dummy/config/routes.rb
219
252
  - test/dummy/db/development.sqlite3
220
253
  - test/dummy/db/test.sqlite3
221
- - test/dummy/Rakefile
222
- - test/dummy/app/helpers/application_helper.rb
223
- - test/dummy/app/assets/stylesheets/application.css
224
- - test/dummy/app/assets/javascripts/application.js
225
- - test/dummy/app/controllers/application_controller.rb
226
- - test/dummy/app/views/layouts/application.html.erb
254
+ - test/dummy/lib/assets/.gitkeep
255
+ - test/dummy/log/.gitkeep
256
+ - test/dummy/public/404.html
257
+ - test/dummy/public/422.html
258
+ - test/dummy/public/500.html
259
+ - test/dummy/public/favicon.ico
260
+ - test/dummy/script/rails
261
+ - test/semantic_crawler_test.rb
262
+ - test/test_helper.rb
263
+ - test/dummy/log/test.log
264
+ - test/dummy/log/development.log
227
265
  homepage: https://github.com/obale/semantic_crawler
228
266
  licenses: []
229
267
  post_install_message:
@@ -238,7 +276,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
276
  version: '0'
239
277
  segments:
240
278
  - 0
241
- hash: 1302469808278935
279
+ hash: 4442978705485601093
242
280
  required_rubygems_version: !ruby/object:Gem::Requirement
243
281
  none: false
244
282
  requirements:
@@ -247,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
285
  version: '0'
248
286
  segments:
249
287
  - 0
250
- hash: 1302469808278935
288
+ hash: 4442978705485601093
251
289
  requirements: []
252
290
  rubyforge_project:
253
291
  rubygems_version: 1.8.21
@@ -290,4 +328,13 @@ test_files:
290
328
  - test/dummy/app/assets/javascripts/application.js
291
329
  - test/dummy/app/controllers/application_controller.rb
292
330
  - test/dummy/app/views/layouts/application.html.erb
331
+ - spec/linked_geo_data_spec.rb
332
+ - spec/factbook_spec.rb
333
+ - spec/fao_papua_new_guinea_spec.rb
334
+ - spec/dbpedia_spec.rb
335
+ - spec/geo_names_spec.rb
336
+ - spec/spec_helper.rb
337
+ - spec/freebase_spec.rb
338
+ - spec/gdacs_spec.rb
339
+ - spec/fao_austria_spec.rb
293
340
  has_rdoc:
@@ -1,33 +0,0 @@
1
- # Logfile created on 2012-04-14 09:58:44 +0200 by logger.rb/31641
2
- E, [2012-04-14T09:58:44.024968 #7225] ERROR -- : Not able to get linked geo data information, through exception: Timeout::Error
3
- E, [2012-04-14T09:59:33.706056 #7267] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNode
4
- E, [2012-04-14T10:03:58.635627 #7461] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
5
- E, [2012-04-14T10:04:33.360131 #7494] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
6
- E, [2012-04-14T10:07:03.407983 #7603] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
7
- E, [2012-04-14T10:07:39.296513 #7646] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
8
- E, [2012-04-14T10:07:40.044113 #7646] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
9
- E, [2012-04-14T10:09:32.694478 #7729] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
10
- E, [2012-04-14T10:09:33.329929 #7729] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
11
- E, [2012-04-14T10:10:26.426502 #7803] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
12
- E, [2012-04-14T10:10:27.075419 #7803] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
13
- E, [2012-04-14T10:10:45.926557 #7840] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
14
- E, [2012-04-14T10:10:46.579179 #7840] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
15
- E, [2012-04-14T10:11:13.375794 #7874] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
16
- E, [2012-04-14T10:11:14.041793 #7874] ERROR -- : Not able to get linked geo data information, through exception: uninitialized class variable @@NAMESPACES in SemanticCrawler::LinkedGeoData::RelevantNodes
17
- E, [2012-04-14T10:32:38.568406 #8687] ERROR -- : Not able to get linked geo data information, through exception: Invalid expression: /rdf:RDF/
18
- E, [2012-04-14T10:33:09.764135 #8706] ERROR -- : Not able to get linked geo data information, through exception: Invalid expression: /rdf:RDF/
19
- E, [2012-04-14T11:10:26.442364 #9625] ERROR -- : Not able to get country information, through exception: 404 Not Found
20
- E, [2012-04-14T11:10:27.864914 #9625] ERROR -- : Not able to get country information, through exception: can't convert nil into String
21
- E, [2012-04-14T11:10:28.050670 #9625] ERROR -- : Not able to get country information, through exception: can't convert nil into String
22
- E, [2012-04-14T11:13:18.022986 #10642] ERROR -- : Not able to get country information, through exception: 404 Not Found
23
- E, [2012-04-14T11:13:18.891837 #10642] ERROR -- : Not able to get country information, through exception: can't convert nil into String
24
- E, [2012-04-14T11:13:19.139060 #10642] ERROR -- : Not able to get country information, through exception: can't convert nil into String
25
- E, [2012-04-14T11:13:30.449721 #10751] ERROR -- : Not able to get country information, through exception: 404 Not Found
26
- E, [2012-04-14T11:13:31.360916 #10751] ERROR -- : Not able to get country information, through exception: can't convert nil into String
27
- E, [2012-04-14T11:13:31.545727 #10751] ERROR -- : Not able to get country information, through exception: can't convert nil into String
28
- E, [2012-04-14T11:18:28.474270 #10930] ERROR -- : Not able to get country information, through exception: 404 Not Found
29
- E, [2012-04-14T11:18:30.366721 #10930] ERROR -- : Not able to get country information, through exception: can't convert nil into String
30
- E, [2012-04-14T11:18:30.551181 #10930] ERROR -- : Not able to get country information, through exception: can't convert nil into String
31
- E, [2012-04-14T11:22:14.925238 #11327] ERROR -- : Not able to get country information, through exception: 404 Not Found
32
- E, [2012-04-14T11:22:15.989910 #11327] ERROR -- : Not able to get country information, through exception: can't convert nil into String
33
- E, [2012-04-14T11:22:16.172572 #11327] ERROR -- : Not able to get country information, through exception: can't convert nil into String
@@ -1,31 +0,0 @@
1
- # Logfile created on 2012-04-04 18:32:33 +0200 by logger.rb/31641
2
- E, [2012-04-04T18:32:52.742158 #8026] ERROR -- : Not able to get country information, through exception: 404 Not Found
3
- E, [2012-04-04T18:33:03.721040 #8026] ERROR -- : Not able to get country information, through exception: can't convert nil into String
4
- E, [2012-04-04T18:33:03.814128 #8026] ERROR -- : Not able to get country information, through exception: can't convert nil into String
5
- E, [2012-04-04T18:37:46.824597 #8271] ERROR -- : Not able to get country information, through exception: 404 Not Found
6
- E, [2012-04-04T18:37:57.830891 #8271] ERROR -- : Not able to get country information, through exception: can't convert nil into String
7
- E, [2012-04-04T18:37:57.919310 #8271] ERROR -- : Not able to get country information, through exception: can't convert nil into String
8
- E, [2012-04-04T18:42:49.437415 #8438] ERROR -- : Not able to get country information, through exception: 404 Not Found
9
- E, [2012-04-04T18:43:00.318476 #8438] ERROR -- : Not able to get country information, through exception: can't convert nil into String
10
- E, [2012-04-04T18:43:00.401323 #8438] ERROR -- : Not able to get country information, through exception: can't convert nil into String
11
- E, [2012-04-04T19:27:47.915748 #9687] ERROR -- : Not able to get country information, through exception: getaddrinfo: Name or service not known
12
- E, [2012-04-04T19:36:47.653949 #9827] ERROR -- : Not able to get country information, through exception: getaddrinfo: Name or service not known
13
- E, [2012-04-04T19:43:46.589712 #9999] ERROR -- : Not able to get country information, through exception: getaddrinfo: Name or service not known
14
- E, [2012-04-04T20:37:29.152328 #10688] ERROR -- : Not able to get country information, through exception: 404 Not Found
15
- E, [2012-04-04T20:37:47.063744 #10688] ERROR -- : Not able to get country information, through exception: can't convert nil into String
16
- E, [2012-04-04T20:37:47.147220 #10688] ERROR -- : Not able to get country information, through exception: can't convert nil into String
17
- E, [2012-04-04T21:22:53.102511 #12563] ERROR -- : Not able to get country information, through exception: 404 Not Found
18
- E, [2012-04-04T21:23:09.228370 #12563] ERROR -- : Not able to get country information, through exception: can't convert nil into String
19
- E, [2012-04-04T21:23:09.330013 #12563] ERROR -- : Not able to get country information, through exception: can't convert nil into String
20
- E, [2012-04-04T21:23:29.927309 #12676] ERROR -- : Not able to get country information, through exception: 404 Not Found
21
- E, [2012-04-04T21:23:47.565717 #12676] ERROR -- : Not able to get country information, through exception: can't convert nil into String
22
- E, [2012-04-04T21:23:47.649213 #12676] ERROR -- : Not able to get country information, through exception: can't convert nil into String
23
- E, [2012-04-04T21:48:35.742857 #13541] ERROR -- : Not able to get country information, through exception: 404 Not Found
24
- E, [2012-04-04T21:49:04.339012 #13541] ERROR -- : Not able to get country information, through exception: can't convert nil into String
25
- E, [2012-04-04T21:49:04.442848 #13541] ERROR -- : Not able to get country information, through exception: can't convert nil into String
26
- E, [2012-04-04T21:50:14.589091 #13602] ERROR -- : Not able to get country information, through exception: 404 Not Found
27
- E, [2012-04-04T21:50:38.906075 #13602] ERROR -- : Not able to get country information, through exception: can't convert nil into String
28
- E, [2012-04-04T21:50:39.011258 #13602] ERROR -- : Not able to get country information, through exception: can't convert nil into String
29
- E, [2012-04-04T21:56:52.520176 #13928] ERROR -- : Not able to get country information, through exception: 404 Not Found
30
- E, [2012-04-04T21:57:17.839197 #13928] ERROR -- : Not able to get country information, through exception: can't convert nil into String
31
- E, [2012-04-04T21:57:17.920295 #13928] ERROR -- : Not able to get country information, through exception: can't convert nil into String