class SemanticCrawler::Gdacs::FeedItem

One crisis entity with related resources. Could be one of the following crisis types:

Public Class Methods

new(new_root_node) click to toggle source
# File lib/semantic_crawler/gdacs/feed_item.rb, line 21
def initialize(new_root_node)
    @root_node = new_root_node
end

Public Instance Methods

alertlevel() click to toggle source

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
country() click to toggle source

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
description() click to toggle source

Returns the crisis description

# File lib/semantic_crawler/gdacs/feed_item.rb, line 31
def description
    query_root_node("description/text()")
end
enclosure_length() click to toggle source

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
enclosure_type() click to toggle source

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
enclosure_url() click to toggle source

Returns the enclosure URL

# File lib/semantic_crawler/gdacs/feed_item.rb, line 36
def enclosure_url
    query_root_node("enclosure/@url")
end
episodeid() click to toggle source

Returns the episode id

# File lib/semantic_crawler/gdacs/feed_item.rb, line 118
def episodeid
    query_root_node("gdacs:episodeid/text()", @@NAMESPACES)
end
eventid() click to toggle source

Returns the event id

# File lib/semantic_crawler/gdacs/feed_item.rb, line 113
def eventid
    query_root_node("gdacs:eventid/text()", @@NAMESPACES)
end
eventname() click to toggle source

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
eventtype() click to toggle source

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
fromdate() click to toggle source

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
glide() click to toggle source

Returns …

# File lib/semantic_crawler/gdacs/feed_item.rb, line 173
def glide
    query_root_node("gdacs:glide/text()", @@NAMESPACES)
end
guid() click to toggle source

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
iso3() click to toggle source

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
latitude() click to toggle source

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
longitude() click to toggle source

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
population() click to toggle source

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
population_unit() click to toggle source

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
population_value() click to toggle source

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
pubDate() click to toggle source

Returns the publication date

# File lib/semantic_crawler/gdacs/feed_item.rb, line 56
def pubDate
    query_root_node("pubDate/text()")
end
query_root_node(xpath_query, namespaces = {}) click to toggle source

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
resources() click to toggle source

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
severity() click to toggle source

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
severity_unit() click to toggle source

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
severity_value() click to toggle source

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
subject() click to toggle source

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
title() click to toggle source

Returns the crisis title

# File lib/semantic_crawler/gdacs/feed_item.rb, line 26
def title
    query_root_node("title/text()")
end
todate() click to toggle source

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
version() click to toggle source

Returns the version

# File lib/semantic_crawler/gdacs/feed_item.rb, line 91
def version
    query_root_node("gdacs:version/text()", @@NAMESPACES)
end
vulnerability() click to toggle source

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
vulnerability_value() click to toggle source

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