semantic-crawler 0.0.2
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.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +70 -0
- data/Rakefile +38 -0
- data/lib/semantic_crawler.rb +13 -0
- data/lib/semantic_crawler/factbook/country.rb +124 -0
- data/lib/semantic_crawler/freebase/country.rb +33 -0
- data/lib/semantic_crawler/freebase/crawler.rb +21 -0
- data/lib/semantic_crawler/freebase/entity.rb +3 -0
- data/lib/semantic_crawler/version.rb +3 -0
- data/lib/tasks/semantic_crawler_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +55 -0
- data/test/dummy/log/test.log +2888 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/factbook_test.rb +86 -0
- data/test/semantic_crawler_test.rb +27 -0
- data/test/test_helper.rb +10 -0
- metadata +230 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby18
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
class FactbookTest < ActiveSupport::TestCase
|
5
|
+
test "truth" do
|
6
|
+
assert_kind_of Module, SemanticCrawler
|
7
|
+
end
|
8
|
+
|
9
|
+
test "init austria country information" do
|
10
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
11
|
+
assert austria.country_name.eql?("austria")
|
12
|
+
assert austria.url.eql?("http://www4.wiwiss.fu-berlin.de/factbook/data/austria")
|
13
|
+
end
|
14
|
+
|
15
|
+
test "get austria name" do
|
16
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
17
|
+
value = austria.name
|
18
|
+
assert value.to_s.eql?("Austria")
|
19
|
+
end
|
20
|
+
|
21
|
+
test "get austria background information" do
|
22
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
23
|
+
value = austria.background
|
24
|
+
assert !value.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
test "get austria population information" do
|
28
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
29
|
+
value = austria.population_total
|
30
|
+
assert !value.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
test "get austria legalsystem property (not wrapped)" do
|
34
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
35
|
+
value = austria.get_factbook_property("legalsystem")
|
36
|
+
assert !value.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
test "get austria latitude" do
|
40
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
41
|
+
value = austria.latitude
|
42
|
+
assert value.to_s.eql?("47.3333333333333")
|
43
|
+
end
|
44
|
+
|
45
|
+
test "get austria longitude" do
|
46
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
47
|
+
value = austria.longitude
|
48
|
+
assert value.to_s.eql?("13.3333333333333")
|
49
|
+
end
|
50
|
+
|
51
|
+
test "get austria landboundary" do
|
52
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
53
|
+
value = austria.landboundary
|
54
|
+
assert value.count == 7
|
55
|
+
end
|
56
|
+
|
57
|
+
test "get austria terrain" do
|
58
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
59
|
+
value = austria.terrain
|
60
|
+
assert !value.nil?
|
61
|
+
end
|
62
|
+
|
63
|
+
test "get austria total airports" do
|
64
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
65
|
+
value = austria.airports_total
|
66
|
+
assert value.to_s.eql?("55")
|
67
|
+
end
|
68
|
+
|
69
|
+
test "get austria heliports" do
|
70
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
71
|
+
value = austria.heliports
|
72
|
+
assert value.to_s.eql?("1")
|
73
|
+
end
|
74
|
+
|
75
|
+
test "get austria climate" do
|
76
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
77
|
+
value = austria.climate
|
78
|
+
assert !value.nil?
|
79
|
+
end
|
80
|
+
|
81
|
+
test "get austria location description" do
|
82
|
+
austria = SemanticCrawler::Factbook::Country.new("Austria")
|
83
|
+
value = austria.location
|
84
|
+
assert !value.nil?
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
class SemanticCrawlerTest < ActiveSupport::TestCase
|
5
|
+
test "truth" do
|
6
|
+
assert_kind_of Module, SemanticCrawler
|
7
|
+
end
|
8
|
+
|
9
|
+
test "init austria country information" do
|
10
|
+
austria = SemanticCrawler::Freebase::Crawler.new
|
11
|
+
countryObj = austria.getCountry("Austria")
|
12
|
+
countryNameNormalized = countryObj.input_name
|
13
|
+
assert countryNameNormalized.eql?("austria")
|
14
|
+
end
|
15
|
+
|
16
|
+
test "get austria country information" do
|
17
|
+
austria = SemanticCrawler::Freebase::Crawler.new
|
18
|
+
countryObj = austria.getCountry("Austria")
|
19
|
+
#pp countryObj.get["properties"]["/location/statistical_region/population"]
|
20
|
+
end
|
21
|
+
|
22
|
+
test "get empty crawler object" do
|
23
|
+
empty = SemanticCrawler::Freebase::Crawler.new
|
24
|
+
assert !empty.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
metadata
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: semantic-crawler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Alex Oberhauser
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-03-25 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: yard
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: httparty
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: json
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: nokogiri
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rails
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 11
|
85
|
+
segments:
|
86
|
+
- 3
|
87
|
+
- 2
|
88
|
+
- 2
|
89
|
+
version: 3.2.2
|
90
|
+
type: :development
|
91
|
+
version_requirements: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: sqlite3
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
type: :development
|
105
|
+
version_requirements: *id006
|
106
|
+
description: SemanticCrawler is a ruby library that encapsulates data gathering from different sources.
|
107
|
+
email:
|
108
|
+
- alex.oberhauser@sigimera.org
|
109
|
+
executables: []
|
110
|
+
|
111
|
+
extensions: []
|
112
|
+
|
113
|
+
extra_rdoc_files: []
|
114
|
+
|
115
|
+
files:
|
116
|
+
- lib/semantic_crawler.rb
|
117
|
+
- lib/tasks/semantic_crawler_tasks.rake
|
118
|
+
- lib/semantic_crawler/freebase/country.rb
|
119
|
+
- lib/semantic_crawler/freebase/crawler.rb
|
120
|
+
- lib/semantic_crawler/freebase/entity.rb
|
121
|
+
- lib/semantic_crawler/factbook/country.rb
|
122
|
+
- lib/semantic_crawler/version.rb
|
123
|
+
- MIT-LICENSE
|
124
|
+
- Rakefile
|
125
|
+
- README.rdoc
|
126
|
+
- test/test_helper.rb
|
127
|
+
- test/factbook_test.rb
|
128
|
+
- test/semantic_crawler_test.rb
|
129
|
+
- test/dummy/log/test.log
|
130
|
+
- test/dummy/log/development.log
|
131
|
+
- test/dummy/public/422.html
|
132
|
+
- test/dummy/public/favicon.ico
|
133
|
+
- test/dummy/public/500.html
|
134
|
+
- test/dummy/public/404.html
|
135
|
+
- test/dummy/config.ru
|
136
|
+
- test/dummy/config/locales/en.yml
|
137
|
+
- test/dummy/config/environments/production.rb
|
138
|
+
- test/dummy/config/environments/test.rb
|
139
|
+
- test/dummy/config/environments/development.rb
|
140
|
+
- test/dummy/config/boot.rb
|
141
|
+
- test/dummy/config/application.rb
|
142
|
+
- test/dummy/config/database.yml
|
143
|
+
- test/dummy/config/environment.rb
|
144
|
+
- test/dummy/config/routes.rb
|
145
|
+
- test/dummy/config/initializers/secret_token.rb
|
146
|
+
- test/dummy/config/initializers/inflections.rb
|
147
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
148
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
149
|
+
- test/dummy/config/initializers/mime_types.rb
|
150
|
+
- test/dummy/config/initializers/session_store.rb
|
151
|
+
- test/dummy/script/rails
|
152
|
+
- test/dummy/README.rdoc
|
153
|
+
- test/dummy/db/development.sqlite3
|
154
|
+
- test/dummy/db/test.sqlite3
|
155
|
+
- test/dummy/Rakefile
|
156
|
+
- test/dummy/app/helpers/application_helper.rb
|
157
|
+
- test/dummy/app/assets/stylesheets/application.css
|
158
|
+
- test/dummy/app/assets/javascripts/application.js
|
159
|
+
- test/dummy/app/controllers/application_controller.rb
|
160
|
+
- test/dummy/app/views/layouts/application.html.erb
|
161
|
+
homepage: https://github.com/obale/semantic_crawler
|
162
|
+
licenses: []
|
163
|
+
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
|
167
|
+
require_paths:
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
hash: 3
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
version: "0"
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
hash: 3
|
184
|
+
segments:
|
185
|
+
- 0
|
186
|
+
version: "0"
|
187
|
+
requirements: []
|
188
|
+
|
189
|
+
rubyforge_project:
|
190
|
+
rubygems_version: 1.8.21
|
191
|
+
signing_key:
|
192
|
+
specification_version: 3
|
193
|
+
summary: SemanticCrawler is a ruby library that encapsulates data gathering from different sources.
|
194
|
+
test_files:
|
195
|
+
- test/test_helper.rb
|
196
|
+
- test/factbook_test.rb
|
197
|
+
- test/semantic_crawler_test.rb
|
198
|
+
- test/dummy/log/test.log
|
199
|
+
- test/dummy/log/development.log
|
200
|
+
- test/dummy/public/422.html
|
201
|
+
- test/dummy/public/favicon.ico
|
202
|
+
- test/dummy/public/500.html
|
203
|
+
- test/dummy/public/404.html
|
204
|
+
- test/dummy/config.ru
|
205
|
+
- test/dummy/config/locales/en.yml
|
206
|
+
- test/dummy/config/environments/production.rb
|
207
|
+
- test/dummy/config/environments/test.rb
|
208
|
+
- test/dummy/config/environments/development.rb
|
209
|
+
- test/dummy/config/boot.rb
|
210
|
+
- test/dummy/config/application.rb
|
211
|
+
- test/dummy/config/database.yml
|
212
|
+
- test/dummy/config/environment.rb
|
213
|
+
- test/dummy/config/routes.rb
|
214
|
+
- test/dummy/config/initializers/secret_token.rb
|
215
|
+
- test/dummy/config/initializers/inflections.rb
|
216
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
217
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
218
|
+
- test/dummy/config/initializers/mime_types.rb
|
219
|
+
- test/dummy/config/initializers/session_store.rb
|
220
|
+
- test/dummy/script/rails
|
221
|
+
- test/dummy/README.rdoc
|
222
|
+
- test/dummy/db/development.sqlite3
|
223
|
+
- test/dummy/db/test.sqlite3
|
224
|
+
- test/dummy/Rakefile
|
225
|
+
- test/dummy/app/helpers/application_helper.rb
|
226
|
+
- test/dummy/app/assets/stylesheets/application.css
|
227
|
+
- test/dummy/app/assets/javascripts/application.js
|
228
|
+
- test/dummy/app/controllers/application_controller.rb
|
229
|
+
- test/dummy/app/views/layouts/application.html.erb
|
230
|
+
has_rdoc:
|