class SemanticCrawler::Gdacs::FeedItem
One crisis entity with related resources. Could be one of the following crisis types:
-
Floods
-
Earthquakes
-
Tropical Cyclones
-
Volcanoes
Public Class Methods
# File lib/semantic_crawler/gdacs/feed_item.rb, line 21 def initialize(new_root_node) @root_node = new_root_node end
Public Instance Methods
Returns the alert level, could be GREEN, ORANGE or RED
# File lib/semantic_crawler/gdacs/feed_item.rb, line 103 def alertlevel query_root_node("gdacs:alertlevel/text()", @@NAMESPACES) end
Returns the country name(s)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 168 def country query_root_node("gdacs:country/text()", @@NAMESPACES) end
Returns the crisis description
# File lib/semantic_crawler/gdacs/feed_item.rb, line 31 def description query_root_node("description/text()") end
Returns the enclosure length, e.g. 1
# File lib/semantic_crawler/gdacs/feed_item.rb, line 46 def enclosure_length query_root_node("enclosure/@length") end
Returns the enclosure type, e.g. image/png
# File lib/semantic_crawler/gdacs/feed_item.rb, line 41 def enclosure_type query_root_node("enclosure/@type") end
Returns the enclosure URL
# File lib/semantic_crawler/gdacs/feed_item.rb, line 36 def enclosure_url query_root_node("enclosure/@url") end
Returns the episode id
# File lib/semantic_crawler/gdacs/feed_item.rb, line 118 def episodeid query_root_node("gdacs:episodeid/text()", @@NAMESPACES) end
Returns the event id
# File lib/semantic_crawler/gdacs/feed_item.rb, line 113 def eventid query_root_node("gdacs:eventid/text()", @@NAMESPACES) end
Returns the event name if available
# File lib/semantic_crawler/gdacs/feed_item.rb, line 108 def eventname query_root_node("gdacs:eventname/text()", @@NAMESPACES) end
Returns the event type abbreviation, e.g. VO (for volcanic eruption, EQ (for earthquake), FL (for flood), TC (for tropical cyclone)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 98 def eventtype query_root_node("gdacs:eventtype/text()", @@NAMESPACES) end
Returns the crisis start date
# File lib/semantic_crawler/gdacs/feed_item.rb, line 61 def fromdate query_root_node("gdacs:fromdate/text()", @@NAMESPACES) end
Returns …
# File lib/semantic_crawler/gdacs/feed_item.rb, line 173 def glide query_root_node("gdacs:glide/text()", @@NAMESPACES) end
Returns an unique crisis identifier (could be non permanent)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 76 def guid query_root_node("guid/text()") end
Returns the country iso3 code if available
# File lib/semantic_crawler/gdacs/feed_item.rb, line 163 def iso3 query_root_node("gdacs:iso3/text()", @@NAMESPACES) end
Returns the latitude GPS coordinate where the crisis has occurred
# File lib/semantic_crawler/gdacs/feed_item.rb, line 81 def latitude query_root_node("geo:Point/geo:lat/text()", @@NAMESPACES) end
Returns the crisis gdacs link
# File lib/semantic_crawler/gdacs/feed_item.rb, line 51 def link query_root_node("link/text()") end
Returns the longitude GPS coordinate where the crisis has occurred
# File lib/semantic_crawler/gdacs/feed_item.rb, line 86 def longitude query_root_node("geo:Point/geo:long/text()", @@NAMESPACES) end
Returns the population as human readable string
# File lib/semantic_crawler/gdacs/feed_item.rb, line 138 def population query_root_node("gdacs:population/text()", @@NAMESPACES) end
Returns the population unit (without further text)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 148 def population_unit query_root_node("gdacs:population/@unit", @@NAMESPACES) end
Returns the population value (without further text)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 143 def population_value query_root_node("gdacs:population/@value", @@NAMESPACES) end
Returns the publication date
# File lib/semantic_crawler/gdacs/feed_item.rb, line 56 def pubDate query_root_node("pubDate/text()") end
Query the root_node
# File lib/semantic_crawler/gdacs/feed_item.rb, line 191 def query_root_node(xpath_query, namespaces = {}) if !@root_node.nil? @root_node.xpath(xpath_query, namespaces) end end
Returns an array of SemanticCrawler::Gdacs::Resource
objects
# File lib/semantic_crawler/gdacs/feed_item.rb, line 178 def resources nodeset = query_root_node("gdacs:resources/gdacs:resource", @@NAMESPACES) @items = [] if !nodeset.nil? nodeset.each do |item| item_obj = SemanticCrawler::Gdacs::Resource.new(item) @items << item_obj end end @items end
Returns the severity as human readable string
# File lib/semantic_crawler/gdacs/feed_item.rb, line 123 def severity query_root_node("gdacs:severity/text()", @@NAMESPACES) end
Returns the severity unit (without further text)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 133 def severity_unit query_root_node("gdacs:severity/@unit", @@NAMESPACES) end
Returns the severity value (without further text)
# File lib/semantic_crawler/gdacs/feed_item.rb, line 128 def severity_value query_root_node("gdacs:severity/@value", @@NAMESPACES) end
Returns the crisis subject abbreviation
# File lib/semantic_crawler/gdacs/feed_item.rb, line 71 def subject query_root_node("dc:subject/text()", @@NAMESPACES) end
Returns the crisis title
# File lib/semantic_crawler/gdacs/feed_item.rb, line 26 def title query_root_node("title/text()") end
Returns the crisis end date
# File lib/semantic_crawler/gdacs/feed_item.rb, line 66 def todate query_root_node("gdacs:todate/text()", @@NAMESPACES) end
Returns the version
# File lib/semantic_crawler/gdacs/feed_item.rb, line 91 def version query_root_node("gdacs:version/text()", @@NAMESPACES) end
Returns the vulnerability as human readable string
# File lib/semantic_crawler/gdacs/feed_item.rb, line 153 def vulnerability query_root_node("gdacs:vulnerability/text()", @@NAMESPACES) end
Returns the vulnerability as number
# File lib/semantic_crawler/gdacs/feed_item.rb, line 158 def vulnerability_value query_root_node("gdacs:vulnerability/@value", @@NAMESPACES) end