semantic-crawler 0.0.5.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,6 +118,10 @@ module SemanticCrawler
118
118
  end
119
119
  end
120
120
 
121
+ def xml_document
122
+ @doc.to_s
123
+ end
124
+
121
125
  # Abstract method that allows to fetch rdfs properties via
122
126
  # xpath
123
127
  def get_rdfs_property(property_name, prefix = "/")
@@ -35,13 +35,15 @@ module SemanticCrawler
35
35
 
36
36
  # Get rss/channel/item*
37
37
  def items
38
- nodeset = query_root_node("item")
39
- @items = []
40
- nodeset.each do |item|
41
- item_obj = SemanticCrawler::Gdacs::EmergencyFeedItem.new(item)
42
- @items << item_obj
43
- end
44
- @items
38
+ nodeset = query_root_node("item")
39
+ @items = []
40
+ if !nodeset.nil?
41
+ nodeset.each do |item|
42
+ item_obj = SemanticCrawler::Gdacs::EmergencyFeedItem.new(item)
43
+ @items << item_obj
44
+ end
45
+ end
46
+ @items
45
47
  end
46
48
 
47
49
  # Query the root_node
@@ -57,11 +59,11 @@ module SemanticCrawler
57
59
  end
58
60
 
59
61
  private
60
- # Retrieves the RSS feed
61
- def fetch_feed
62
- @doc = Nokogiri::XML(open(@url))
63
- @root_node = @doc.xpath("/rss/channel")
64
- end
62
+ # Retrieves the RSS feed
63
+ def fetch_feed
64
+ @doc = Nokogiri::XML(open(@url))
65
+ @root_node = @doc.xpath("/rss/channel")
66
+ end
65
67
  end
66
68
  end
67
69
  end
@@ -71,9 +71,11 @@ module SemanticCrawler
71
71
  def items
72
72
  nodeset = query_root_node("item")
73
73
  @items = []
74
- nodeset.each do |item|
75
- item_obj = SemanticCrawler::Gdacs::FeedItem.new(item)
76
- @items << item_obj
74
+ if !nodeset.nil?
75
+ nodeset.each do |item|
76
+ item_obj = SemanticCrawler::Gdacs::FeedItem.new(item)
77
+ @items << item_obj
78
+ end
77
79
  end
78
80
  @items
79
81
  end
@@ -91,11 +93,11 @@ module SemanticCrawler
91
93
  end
92
94
 
93
95
  private
94
- # Retrieves the RSS feed
95
- def fetch_feed
96
- @doc = Nokogiri::XML(open(@url))
97
- @root_node = @doc.xpath("/rss/channel")
98
- end
96
+ # Retrieves the RSS feed
97
+ def fetch_feed
98
+ @doc = Nokogiri::XML(open(@url))
99
+ @root_node = @doc.xpath("/rss/channel")
100
+ end
99
101
  end
100
102
  end
101
103
  end
@@ -153,9 +153,11 @@ module SemanticCrawler
153
153
  def resources
154
154
  nodeset = query_root_node("gdacs:resources/gdacs:resource", @@NAMESPACES)
155
155
  @items = []
156
- nodeset.each do |item|
157
- item_obj = SemanticCrawler::Gdacs::Resource.new(item)
158
- @items << item_obj
156
+ if !nodeset.nil?
157
+ nodeset.each do |item|
158
+ item_obj = SemanticCrawler::Gdacs::Resource.new(item)
159
+ @items << item_obj
160
+ end
159
161
  end
160
162
  @items
161
163
  end
@@ -1,5 +1,5 @@
1
1
  module SemanticCrawler
2
2
 
3
3
  # The current version of this library.
4
- VERSION = "0.0.5.1"
4
+ VERSION = "0.1.0"
5
5
  end
@@ -1,113 +1,4 @@
1
- # Logfile created on 2012-04-07 11:21:07 +0200 by logger.rb/31641
2
- E, [2012-04-07T11:21:07.110105 #11268] ERROR -- : Not able to get country information, through exception: 404 Not Found
3
- E, [2012-04-07T11:21:07.313582 #11268] ERROR -- : Not able to get country information, through exception: can't convert nil into String
4
- E, [2012-04-07T11:21:07.344581 #11268] ERROR -- : Not able to get country information, through exception: can't convert nil into String
5
- E, [2012-04-07T11:22:13.443199 #11350] ERROR -- : Not able to get country information, through exception: bad URI(is not URI?): http://www.fao.org/countryprofiles/geoinfo/geopolitical/data/Papua New Guinea
6
- E, [2012-04-07T11:22:20.459945 #11350] ERROR -- : Not able to get country information, through exception: 404 Not Found
7
- E, [2012-04-07T11:22:23.549094 #11350] ERROR -- : Not able to get country information, through exception: can't convert nil into String
8
- E, [2012-04-07T11:22:23.560978 #11350] ERROR -- : Not able to get country information, through exception: can't convert nil into String
9
- E, [2012-04-07T11:24:35.586424 #11432] ERROR -- : Not able to get country information, through exception: 404 Not Found
10
- E, [2012-04-07T11:24:37.901019 #11432] ERROR -- : Not able to get country information, through exception: can't convert nil into String
11
- E, [2012-04-07T11:24:37.933283 #11432] ERROR -- : Not able to get country information, through exception: can't convert nil into String
12
- E, [2012-04-07T11:25:05.306644 #11444] ERROR -- : Not able to get country information, through exception: 404 Not Found
13
- E, [2012-04-07T11:25:05.598394 #11444] ERROR -- : Not able to get country information, through exception: can't convert nil into String
14
- E, [2012-04-07T11:25:05.614812 #11444] ERROR -- : Not able to get country information, through exception: can't convert nil into String
15
- E, [2012-04-07T11:25:42.379240 #11459] ERROR -- : Not able to get country information, through exception: 404 Not Found
16
- E, [2012-04-07T11:25:42.670498 #11459] ERROR -- : Not able to get country information, through exception: can't convert nil into String
17
- E, [2012-04-07T11:25:42.681989 #11459] ERROR -- : Not able to get country information, through exception: can't convert nil into String
18
- E, [2012-04-07T11:27:17.680372 #11633] ERROR -- : Not able to get country information, through exception: 404 Not Found
19
- E, [2012-04-07T11:27:18.038477 #11633] ERROR -- : Not able to get country information, through exception: can't convert nil into String
20
- E, [2012-04-07T11:27:18.057122 #11633] ERROR -- : Not able to get country information, through exception: can't convert nil into String
21
- E, [2012-04-07T11:30:39.020830 #11763] ERROR -- : Not able to get country information, through exception: 404 Not Found
22
- E, [2012-04-07T11:30:39.334938 #11763] ERROR -- : Not able to get country information, through exception: can't convert nil into String
23
- E, [2012-04-07T11:30:39.347117 #11763] ERROR -- : Not able to get country information, through exception: can't convert nil into String
24
- E, [2012-04-07T11:31:23.862722 #11772] ERROR -- : Not able to get country information, through exception: 404 Not Found
25
- E, [2012-04-07T11:31:24.195581 #11772] ERROR -- : Not able to get country information, through exception: can't convert nil into String
26
- E, [2012-04-07T11:31:24.215054 #11772] ERROR -- : Not able to get country information, through exception: can't convert nil into String
27
- E, [2012-04-07T11:32:56.924276 #11790] ERROR -- : Not able to get country information, through exception: 404 Not Found
28
- E, [2012-04-07T11:32:57.234434 #11790] ERROR -- : Not able to get country information, through exception: can't convert nil into String
29
- E, [2012-04-07T11:32:57.250915 #11790] ERROR -- : Not able to get country information, through exception: can't convert nil into String
30
- E, [2012-04-07T11:33:39.950002 #11810] ERROR -- : Not able to get country information, through exception: 404 Not Found
31
- E, [2012-04-07T11:33:40.280597 #11810] ERROR -- : Not able to get country information, through exception: can't convert nil into String
32
- E, [2012-04-07T11:33:40.294283 #11810] ERROR -- : Not able to get country information, through exception: can't convert nil into String
33
- E, [2012-04-07T11:34:03.423093 #11829] ERROR -- : Not able to get country information, through exception: 404 Not Found
34
- E, [2012-04-07T11:34:03.696623 #11829] ERROR -- : Not able to get country information, through exception: can't convert nil into String
35
- E, [2012-04-07T11:34:03.723172 #11829] ERROR -- : Not able to get country information, through exception: can't convert nil into String
36
- E, [2012-04-07T11:35:30.403738 #11878] ERROR -- : Not able to get country information, through exception: 404 Not Found
37
- E, [2012-04-07T11:35:30.678343 #11878] ERROR -- : Not able to get country information, through exception: can't convert nil into String
38
- E, [2012-04-07T11:35:30.711357 #11878] ERROR -- : Not able to get country information, through exception: can't convert nil into String
39
- E, [2012-04-07T11:36:11.844628 #11899] ERROR -- : Not able to get country information, through exception: 404 Not Found
40
- E, [2012-04-07T11:36:12.111924 #11899] ERROR -- : Not able to get country information, through exception: can't convert nil into String
41
- E, [2012-04-07T11:36:12.139426 #11899] ERROR -- : Not able to get country information, through exception: can't convert nil into String
42
- E, [2012-04-07T11:36:45.628433 #11908] ERROR -- : Not able to get country information, through exception: 404 Not Found
43
- E, [2012-04-07T11:36:45.891058 #11908] ERROR -- : Not able to get country information, through exception: can't convert nil into String
44
- E, [2012-04-07T11:36:45.926306 #11908] ERROR -- : Not able to get country information, through exception: can't convert nil into String
45
- E, [2012-04-07T11:37:44.800410 #11917] ERROR -- : Not able to get country information, through exception: 404 Not Found
46
- E, [2012-04-07T11:37:45.082496 #11917] ERROR -- : Not able to get country information, through exception: can't convert nil into String
47
- E, [2012-04-07T11:37:45.117405 #11917] ERROR -- : Not able to get country information, through exception: can't convert nil into String
48
- E, [2012-04-07T11:38:27.236987 #11928] ERROR -- : Not able to get country information, through exception: 404 Not Found
49
- E, [2012-04-07T11:38:27.516178 #11928] ERROR -- : Not able to get country information, through exception: can't convert nil into String
50
- E, [2012-04-07T11:38:27.553813 #11928] ERROR -- : Not able to get country information, through exception: can't convert nil into String
51
- E, [2012-04-07T11:38:47.022582 #11937] ERROR -- : Not able to get country information, through exception: 404 Not Found
52
- E, [2012-04-07T11:38:47.304101 #11937] ERROR -- : Not able to get country information, through exception: can't convert nil into String
53
- E, [2012-04-07T11:38:47.343860 #11937] ERROR -- : Not able to get country information, through exception: can't convert nil into String
54
- E, [2012-04-07T11:39:58.749181 #11946] ERROR -- : Not able to get country information, through exception: 404 Not Found
55
- E, [2012-04-07T11:39:59.018300 #11946] ERROR -- : Not able to get country information, through exception: can't convert nil into String
56
- E, [2012-04-07T11:39:59.043845 #11946] ERROR -- : Not able to get country information, through exception: can't convert nil into String
57
- E, [2012-04-07T11:40:30.986544 #11957] ERROR -- : Not able to get country information, through exception: 404 Not Found
58
- E, [2012-04-07T11:40:31.264356 #11957] ERROR -- : Not able to get country information, through exception: can't convert nil into String
59
- E, [2012-04-07T11:40:31.291712 #11957] ERROR -- : Not able to get country information, through exception: can't convert nil into String
60
- E, [2012-04-07T11:41:01.914290 #11966] ERROR -- : Not able to get country information, through exception: 404 Not Found
61
- E, [2012-04-07T11:41:02.180433 #11966] ERROR -- : Not able to get country information, through exception: can't convert nil into String
62
- E, [2012-04-07T11:41:02.216415 #11966] ERROR -- : Not able to get country information, through exception: can't convert nil into String
63
- E, [2012-04-07T11:41:43.066874 #11975] ERROR -- : Not able to get country information, through exception: 404 Not Found
64
- E, [2012-04-07T11:41:43.334195 #11975] ERROR -- : Not able to get country information, through exception: can't convert nil into String
65
- E, [2012-04-07T11:41:43.359735 #11975] ERROR -- : Not able to get country information, through exception: can't convert nil into String
66
- E, [2012-04-07T11:42:10.752685 #11984] ERROR -- : Not able to get country information, through exception: 404 Not Found
67
- E, [2012-04-07T11:42:11.027507 #11984] ERROR -- : Not able to get country information, through exception: can't convert nil into String
68
- E, [2012-04-07T11:42:11.058454 #11984] ERROR -- : Not able to get country information, through exception: can't convert nil into String
69
- E, [2012-04-07T11:42:32.438181 #11993] ERROR -- : Not able to get country information, through exception: 404 Not Found
70
- E, [2012-04-07T11:42:32.713769 #11993] ERROR -- : Not able to get country information, through exception: can't convert nil into String
71
- E, [2012-04-07T11:42:32.740402 #11993] ERROR -- : Not able to get country information, through exception: can't convert nil into String
72
- E, [2012-04-07T11:42:53.247901 #12002] ERROR -- : Not able to get country information, through exception: 404 Not Found
73
- E, [2012-04-07T11:42:53.521697 #12002] ERROR -- : Not able to get country information, through exception: can't convert nil into String
74
- E, [2012-04-07T11:42:53.556987 #12002] ERROR -- : Not able to get country information, through exception: can't convert nil into String
75
- E, [2012-04-07T11:43:22.891520 #12011] ERROR -- : Not able to get country information, through exception: 404 Not Found
76
- E, [2012-04-07T11:43:23.170173 #12011] ERROR -- : Not able to get country information, through exception: can't convert nil into String
77
- E, [2012-04-07T11:43:23.203406 #12011] ERROR -- : Not able to get country information, through exception: can't convert nil into String
78
- E, [2012-04-07T11:43:41.861387 #12020] ERROR -- : Not able to get country information, through exception: 404 Not Found
79
- E, [2012-04-07T11:43:42.131101 #12020] ERROR -- : Not able to get country information, through exception: can't convert nil into String
80
- E, [2012-04-07T11:43:42.164372 #12020] ERROR -- : Not able to get country information, through exception: can't convert nil into String
81
- E, [2012-04-07T11:44:46.724430 #12042] ERROR -- : Not able to get country information, through exception: 404 Not Found
82
- E, [2012-04-07T11:44:47.040199 #12042] ERROR -- : Not able to get country information, through exception: can't convert nil into String
83
- E, [2012-04-07T11:44:47.065830 #12042] ERROR -- : Not able to get country information, through exception: can't convert nil into String
84
- E, [2012-04-07T11:45:24.858416 #12051] ERROR -- : Not able to get country information, through exception: 404 Not Found
85
- E, [2012-04-07T11:45:27.169055 #12051] ERROR -- : Not able to get country information, through exception: can't convert nil into String
86
- E, [2012-04-07T11:45:27.203194 #12051] ERROR -- : Not able to get country information, through exception: can't convert nil into String
87
- E, [2012-04-07T11:46:11.044885 #12061] ERROR -- : Not able to get country information, through exception: 404 Not Found
88
- E, [2012-04-07T11:46:11.315591 #12061] ERROR -- : Not able to get country information, through exception: can't convert nil into String
89
- E, [2012-04-07T11:46:11.349234 #12061] ERROR -- : Not able to get country information, through exception: can't convert nil into String
90
- E, [2012-04-07T11:46:33.861699 #12080] ERROR -- : Not able to get country information, through exception: 404 Not Found
91
- E, [2012-04-07T11:46:34.155863 #12080] ERROR -- : Not able to get country information, through exception: can't convert nil into String
92
- E, [2012-04-07T11:46:34.188346 #12080] ERROR -- : Not able to get country information, through exception: can't convert nil into String
93
- E, [2012-04-07T11:51:54.866895 #12645] ERROR -- : Not able to get country information, through exception: 404 Not Found
94
- E, [2012-04-07T11:51:58.410023 #12645] ERROR -- : Not able to get country information, through exception: can't convert nil into String
95
- E, [2012-04-07T11:51:58.442218 #12645] ERROR -- : Not able to get country information, through exception: can't convert nil into String
96
- E, [2012-04-07T12:01:43.277692 #16114] ERROR -- : Not able to get country information, through exception: 404 Not Found
97
- E, [2012-04-07T12:01:43.659461 #16114] ERROR -- : Not able to get country information, through exception: can't convert nil into String
98
- E, [2012-04-07T12:01:43.687365 #16114] ERROR -- : Not able to get country information, through exception: can't convert nil into String
99
- E, [2012-04-07T12:02:09.552838 #16143] ERROR -- : Not able to get country information, through exception: 404 Not Found
100
- E, [2012-04-07T12:02:09.886720 #16143] ERROR -- : Not able to get country information, through exception: can't convert nil into String
101
- E, [2012-04-07T12:02:09.898726 #16143] ERROR -- : Not able to get country information, through exception: can't convert nil into String
102
- E, [2012-04-07T12:03:46.679538 #16180] ERROR -- : Not able to get country information, through exception: 404 Not Found
103
- E, [2012-04-07T12:03:47.037799 #16180] ERROR -- : Not able to get country information, through exception: can't convert nil into String
104
- E, [2012-04-07T12:03:47.048944 #16180] ERROR -- : Not able to get country information, through exception: can't convert nil into String
105
- E, [2012-04-07T12:04:08.441408 #16194] ERROR -- : Not able to get country information, through exception: 404 Not Found
106
- E, [2012-04-07T12:04:08.749003 #16194] ERROR -- : Not able to get country information, through exception: can't convert nil into String
107
- E, [2012-04-07T12:04:08.781459 #16194] ERROR -- : Not able to get country information, through exception: can't convert nil into String
108
- E, [2012-04-07T12:04:29.513014 #16208] ERROR -- : Not able to get country information, through exception: 404 Not Found
109
- E, [2012-04-07T12:04:29.837025 #16208] ERROR -- : Not able to get country information, through exception: can't convert nil into String
110
- E, [2012-04-07T12:04:29.848493 #16208] ERROR -- : Not able to get country information, through exception: can't convert nil into String
111
- E, [2012-04-07T12:08:45.082443 #16518] ERROR -- : Not able to get country information, through exception: 404 Not Found
112
- E, [2012-04-07T12:08:45.400533 #16518] ERROR -- : Not able to get country information, through exception: can't convert nil into String
113
- E, [2012-04-07T12:08:45.429861 #16518] ERROR -- : Not able to get country information, through exception: can't convert nil into String
1
+ # Logfile created on 2012-04-13 12:28:13 +0200 by logger.rb/31641
2
+ E, [2012-04-13T12:28:33.803715 #9639] ERROR -- : Not able to get country information, through exception: 404 Not Found
3
+ E, [2012-04-13T12:28:34.277902 #9639] ERROR -- : Not able to get country information, through exception: can't convert nil into String
4
+ E, [2012-04-13T12:28:34.408755 #9639] ERROR -- : Not able to get country information, through exception: can't convert nil into String
@@ -76,3 +76,27 @@
76
76
   (0.0ms) rollback transaction
77
77
   (0.3ms) begin transaction
78
78
   (0.0ms) rollback transaction
79
+  (0.1ms) begin transaction
80
+  (0.0ms) rollback transaction
81
+  (10.0ms) begin transaction
82
+  (0.1ms) rollback transaction
83
+  (0.1ms) begin transaction
84
+  (0.0ms) rollback transaction
85
+  (0.3ms) begin transaction
86
+  (0.0ms) rollback transaction
87
+  (0.1ms) begin transaction
88
+  (0.0ms) rollback transaction
89
+  (0.1ms) begin transaction
90
+  (0.0ms) rollback transaction
91
+  (0.2ms) begin transaction
92
+  (0.0ms) rollback transaction
93
+  (0.5ms) begin transaction
94
+  (0.0ms) rollback transaction
95
+  (0.5ms) begin transaction
96
+  (0.1ms) rollback transaction
97
+  (0.3ms) begin transaction
98
+  (0.0ms) rollback transaction
99
+  (0.4ms) begin transaction
100
+  (0.0ms) rollback transaction
101
+  (0.4ms) begin transaction
102
+  (0.1ms) 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.0.5.1
4
+ version: 0.1.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-07 00:00:00.000000000 Z
12
+ date: 2012-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -184,12 +184,10 @@ files:
184
184
  - lib/semantic_crawler/fao.rb
185
185
  - lib/semantic_crawler.rb
186
186
  - lib/tasks/semantic_crawler_tasks.rake
187
- - log/semantic-crawler.log.20120406
188
187
  - log/semantic-crawler.log
189
188
  - MIT-LICENSE
190
189
  - Rakefile
191
190
  - README.rdoc
192
- - CHANGELOG.rdoc
193
191
  - test/semantic_crawler_test.rb
194
192
  - test/dummy/config/initializers/wrap_parameters.rb
195
193
  - test/dummy/config/initializers/mime_types.rb
@@ -237,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
235
  version: '0'
238
236
  segments:
239
237
  - 0
240
- hash: 3454514324042663722
238
+ hash: -2431003029796020943
241
239
  required_rubygems_version: !ruby/object:Gem::Requirement
242
240
  none: false
243
241
  requirements:
@@ -246,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
244
  version: '0'
247
245
  segments:
248
246
  - 0
249
- hash: 3454514324042663722
247
+ hash: -2431003029796020943
250
248
  requirements: []
251
249
  rubyforge_project:
252
250
  rubygems_version: 1.8.21
data/CHANGELOG.rdoc DELETED
@@ -1,25 +0,0 @@
1
- = Semantic Crawler CHANGELOG
2
-
3
- == 0.0.4
4
-
5
- * Adding module for parsing country information from "Food and Agriculture
6
- Organization of the United Nations"
7
- * Adding emergency feed to Gdacs module
8
- * Adding basic module structure for all modules (not all implemented)
9
- * Adding basic rspec sructure for all modules (not all implemented)
10
-
11
- == 0.0.3
12
-
13
- * Implementing the Gdacs module
14
- * Improving documentation
15
- * Better Exception Handling
16
- * Minor bug fixing
17
-
18
- == 0.0.2
19
-
20
- * Factbook::Country implemented
21
- * First version that is released to rubygems.org for testing purpose
22
-
23
- == 0.0.1
24
-
25
- * Initial version that is not usable and not released.
@@ -1,4 +0,0 @@
1
- # Logfile created on 2012-04-06 15:27:20 +0200 by logger.rb/31641
2
- E, [2012-04-06T15:27:34.066078 #2430] ERROR -- : Not able to get country information, through exception: 404 Not Found
3
- E, [2012-04-06T15:27:35.096340 #2430] ERROR -- : Not able to get country information, through exception: can't convert nil into String
4
- E, [2012-04-06T15:27:35.151733 #2430] ERROR -- : Not able to get country information, through exception: can't convert nil into String