Class: RDF::Tabular::Row::Cell

Inherits:
Struct
  • Object
show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb

Overview

Class for returning values

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aboutUrlObject

Returns the value of attribute aboutUrl

Returns:

  • (Object)

    the current value of aboutUrl



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def aboutUrl
  @aboutUrl
end

#columnObject

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def column
  @column
end

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def errors
  @errors
end

#propertyUrlObject

Returns the value of attribute propertyUrl

Returns:

  • (Object)

    the current value of propertyUrl



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def propertyUrl
  @propertyUrl
end

#rowObject

Returns the value of attribute row

Returns:

  • (Object)

    the current value of row



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def row
  @row
end

#stringValueObject

Returns the value of attribute stringValue

Returns:

  • (Object)

    the current value of stringValue



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def stringValue
  @stringValue
end

#tableObject

Returns the value of attribute table

Returns:

  • (Object)

    the current value of table



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def table
  @table
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def value
  @value
end

#valueUrlObject

Returns the value of attribute valueUrl

Returns:

  • (Object)

    the current value of valueUrl



1949
1950
1951
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1949

def valueUrl
  @valueUrl
end

Instance Method Details

#idRDF::URI

Identifier for this Cell, as an RFC7111 fragment

Returns:



1969
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1969

def id; table.url + "#cell=#{self.row.sourceNumber},#{self.column.sourceNumber}"; end

#inspectObject



1985
1986
1987
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1985

def inspect
  self.class.name + to_atd.inspect
end

#set_urls(mapped_values) ⇒ Object



1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1950

def set_urls(mapped_values)
  %w(aboutUrl propertyUrl valueUrl).each do |prop|
    # If the cell value is nil, and it is not a virtual column
    next if prop == "valueUrl" && value.nil? && !column.virtual
    if v = column.send(prop.to_sym)
      t = Addressable::Template.new(v)
      mapped = t.expand(mapped_values).to_s
      # FIXME: don't expand here, do it in CSV2RDF
      url = row.context.expand_iri(mapped, documentRelative: true)
      self.send("#{prop}=".to_sym, url)
    end
  end
end

#to_atdObject

Return Annotated Cell representation



1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1972

def to_atd
  {
    "@id" => id.to_s,
    "@type" => "Cell",
    "column" => column.id.to_s,
    "row" => row.id.to_s,
    "stringValue" => self.stringValue,
    "table" => (table.id.to_s if table.id),
    "value" => table.context.expand_value(nil, self.value),
    "errors" => self.errors
  }.delete_if {|k,v| Array(v).empty?}
end

#to_sObject



1965
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1965

def to_s; value.to_s; end

#valid?Boolean

Returns:

  • (Boolean)


1964
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-tabular-b6c38e4731e8/lib/rdf/tabular/metadata.rb', line 1964

def valid?; Array(errors).empty?; end