Class: SemanticCrawler::LinkedGeoData::RelevantNode

Inherits:
Object
  • Object
show all
Defined in:
lib/semantic_crawler/linked_geo_data/relevant_node.rb

Overview

Specifies relevant node that is classified by a type and GPS coordinates.

Constant Summary collapse

@@NAMESPACES =

Namespace hash

{
    "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs" => "http://www.w3.org/2000/01/rdf-schema#",
    "lgd" => "http://linkedgeodata.org/triplify/",
    "lgdp" => "http://linkedgeodata.org/property/",
    "lgdo" => "http://linkedgeodata.org/ontology/",
    "geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#"
}

Instance Method Summary collapse

Constructor Details

#initialize(new_root_node) ⇒ RelevantNode

Constructor that takes the root node received from SemanticCrawler::LinkedGeoData::RelevantNodes



21
22
23
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 21

def initialize(new_root_node)
    @root_node = new_root_node
end

Instance Method Details

#contributorString

User link

Returns:

  • (String)


57
58
59
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 57

def contributor
    query_root_node("lgdo:contributor/@rdf:resource", @@NAMESPACES).to_s
end

#created_byString

Data Source

Returns:

  • (String)


51
52
53
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 51

def created_by
    query_root_node("lgdp:created_by/text()", @@NAMESPACES).to_s
end

#has_cityString

City name

Returns:

  • (String)


92
93
94
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 92

def has_city
    query_root_node("lgdo:hasCity/text()", @@NAMESPACES).to_s
end

#has_countryString

Country in ISO 3166-1 alpha-2

Returns:

  • (String)


86
87
88
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 86

def has_country
    query_root_node("lgdo:hasCountry/text()", @@NAMESPACES).to_s
end

#has_house_numberString

House number

Returns:

  • (String)


80
81
82
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 80

def has_house_number
    query_root_node("lgdo:hasHouseNumber/text()", @@NAMESPACES).to_s
end

#has_postal_codeString

Postal code

Returns:

  • (String)


74
75
76
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 74

def has_postal_code
    query_root_node("lgdo:hasPostalCode/text()", @@NAMESPACES).to_s
end

#has_streetString

Street name

Returns:

  • (String)


68
69
70
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 68

def has_street
    query_root_node("lgdo:hasStreet/text()", @@NAMESPACES).to_s
end

#latitudeString

geo:lat

Returns:

  • (String)


27
28
29
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 27

def latitude
    query_root_node("geo:lat/text()", @@NAMESPACES).to_s
end

#longitudeString

geo:long

Returns:

  • (String)


33
34
35
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 33

def longitude
    query_root_node("geo:long/text()", @@NAMESPACES).to_s
end

#member_of_wayObject

Link to way



62
63
64
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 62

def member_of_way
    query_root_node("lgdo:memberOfWay/@rdf:resource", @@NAMESPACES)
end

#noteString

Comment about the entity

Returns:

  • (String)


45
46
47
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 45

def note
    query_root_node("lgdp:note/text()", @@NAMESPACES).to_s
end

#query_root_node(xpath_query, namespaces = {}) ⇒ Object

Query the root_node



103
104
105
106
107
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 103

def query_root_node(xpath_query, namespaces = {})
    if !@root_node.nil?
        @root_node.xpath(xpath_query, namespaces)
    end
end

#typeString

The type as URL

Returns:

  • (String)


39
40
41
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 39

def type
    query_root_node("rdf:type/@rdf:resource", @@NAMESPACES).to_s
end

#wheelchairString

Is this place wheelchair friendly?

Returns:

  • (String)


98
99
100
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 98

def wheelchair
    query_root_node("lgdo:wheelchair/@rdf:resource", @@NAMESPACES).to_s
end

#xml_documentString

Outputs the document as XML

Returns:

  • (String)

    The document serialized as XML



111
112
113
# File 'lib/semantic_crawler/linked_geo_data/relevant_node.rb', line 111

def xml_document
    @root_node.to_s
end