class SemanticCrawler::Gdacs::Resource
A resource is always related to one FeedItem
and could have different types. For example xml, map and a lot more.
Public Class Methods
new(new_root_node)
click to toggle source
Initializes a resource that is related to a crisis element.
# File lib/semantic_crawler/gdacs/resource.rb, line 14 def initialize(new_root_node) @root_node = new_root_node end
Public Instance Methods
accesslevel()
click to toggle source
- OPTIONAL
-
Returns the gdacs:accesslevel
# File lib/semantic_crawler/gdacs/resource.rb, line 49 def accesslevel query_root_node("gdacs:accesslevel/text()", @@NAMESPACES) end
acknowledgements()
click to toggle source
- OPTIONAL
-
Returns the gdacs:acknowledgements
# File lib/semantic_crawler/gdacs/resource.rb, line 44 def acknowledgements query_root_node("gdacs:acknowledgements/text()", @@NAMESPACES) end
description()
click to toggle source
- OPTIONAL
-
Returns the gdacs:description
# File lib/semantic_crawler/gdacs/resource.rb, line 39 def description query_root_node("gdacs:description/text()", @@NAMESPACES) end
query_root_node(xpath_query, namespaces = {})
click to toggle source
Query the root_node
# File lib/semantic_crawler/gdacs/resource.rb, line 59 def query_root_node(xpath_query, namespaces = {}) if !@root_node.nil? @root_node.xpath(xpath_query, namespaces) end end
source()
click to toggle source
Returns the source organization abbreviation (‘source’ attribute in gdacs:resource)
# File lib/semantic_crawler/gdacs/resource.rb, line 34 def source query_root_node("@source") end
title()
click to toggle source
Returns the gdacs:title
# File lib/semantic_crawler/gdacs/resource.rb, line 24 def title query_root_node("gdacs:title/text()", @@NAMESPACES) end
type()
click to toggle source
Returns the type (attribute in gdacs:resource)
# File lib/semantic_crawler/gdacs/resource.rb, line 29 def type query_root_node("@type") end
url()
click to toggle source
Returns the resource URL
# File lib/semantic_crawler/gdacs/resource.rb, line 19 def url query_root_node("@url", @@NAMESPACES).to_s.gsub("[gdacs]", "http://www.gdacs.org") end
xslt()
click to toggle source
- OPTIONAL
-
Returns the gdacs:xslt. Only for XML resources!
# File lib/semantic_crawler/gdacs/resource.rb, line 54 def xslt query_root_node("gdacs:xslt/text()", @@NAMESPACES) end