Class: Mexico::FileSystem::Scale

Inherits:
Object
  • Object
show all
Includes:
Poseidon, ROXML
Defined in:
lib/mexico/file_system/scale.rb

Overview

A generic scale.

Constant Summary collapse

DIM_TIME =
'time'
DIM_SPACE =
'space'
DIM_OTHER =
'other'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Scale

OKunit : SI units or custom units OK dimension : String (x,y,z,t, etc.) OK role : String (free text) continuous? : Boolean



69
70
71
72
73
74
75
# File 'lib/mexico/file_system/scale.rb', line 69

def initialize(args={})
  args.each do |k,v|
    if self.respond_to?("#{k}=")
      send("#{k}=", v)
    end
  end
end

Instance Attribute Details

#documentObject

Returns the value of attribute document.



44
45
46
# File 'lib/mexico/file_system/scale.rb', line 44

def document
  @document
end

Class Method Details

.to_turtleString

Creates an RDF representation in Turtle notation for this class.

Returns:

  • (String)

    An RDF representation in Turtle notation for this class.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/mexico/file_system/scale.rb', line 86

def self.to_turtle
  rdf_writer = RDF::Turtle::Writer
  return rdf_writer.buffer(:base_uri => 'http://phoibos.sfb673.org/',
                           :prefixes => {
                               :cats => 'http://cats.sfb673.org/',
                               :rdfs => RDF::RDFS.to_uri,
                               :foaf => RDF::FOAF.to_uri,
                               :dc => RDF::DC.to_uri,
                               :owl => RDF::OWL.to_uri,
                               :xsd  => RDF::XSD.to_uri} #
  ) do |writer|
    as_rdf.each_statement do |statement|
      writer << statement
    end
  end
end

Instance Method Details

#after_parseObject

overrides method in ROXML callback after xml parsing process, to store this element in the document cache.



80
81
82
# File 'lib/mexico/file_system/scale.rb', line 80

def after_parse
  ::Mexico::FileSystem::FiestaDocument.store(self.identifier, self)
end

#identifier=(new_id) ⇒ Object



31
32
33
# File 'lib/mexico/file_system/scale.rb', line 31

def identifier=(new_id)
  @identifier = Mexico::Util::to_xml_id(new_id)
end

#is_spatial_axis?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/mexico/file_system/scale.rb', line 126

def is_spatial_axis?
  self.dimension == DIM_SPACE
end

#is_timeline?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'lib/mexico/file_system/scale.rb', line 122

def is_timeline?
  self.dimension == DIM_TIME
end

#to_turtleString

Creates an RDF representation in Turtle notation for this object.

Returns:

  • (String)

    An RDF representation in Turtle notation for this object.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/mexico/file_system/scale.rb', line 105

def to_turtle
  rdf_writer = RDF::Turtle::Writer
  return rdf_writer.buffer(:base_uri => 'http://phoibos.sfb673.org/',
                           :prefixes => {
                               :cats => 'http://cats.sfb673.org/',
                               :rdfs => RDF::RDFS.to_uri,
                               :foaf => RDF::FOAF.to_uri,
                               :dc => RDF::DC.to_uri,
                               :owl => RDF::OWL.to_uri,
                               :xsd  => RDF::XSD.to_uri} #
  ) do |writer|
    as_rdf.each_statement do |statement|
      writer << statement
    end
  end
end