Class: RDF::Tabular::Row::Cell
- Inherits:
-
Struct
- Object
- Struct
- RDF::Tabular::Row::Cell
- Defined in:
- lib/rdf/tabular/metadata.rb
Overview
Class for returning values
Instance Attribute Summary collapse
-
#aboutUrl ⇒ Object
Returns the value of attribute aboutUrl.
-
#column ⇒ Object
Returns the value of attribute column.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#propertyUrl ⇒ Object
Returns the value of attribute propertyUrl.
-
#row ⇒ Object
Returns the value of attribute row.
-
#stringValue ⇒ Object
Returns the value of attribute stringValue.
-
#table ⇒ Object
Returns the value of attribute table.
-
#value ⇒ Object
Returns the value of attribute value.
-
#valueUrl ⇒ Object
Returns the value of attribute valueUrl.
Instance Method Summary collapse
-
#id ⇒ RDF::URI
Identifier for this Cell, as an RFC7111 fragment.
- #set_urls(mapped_values) ⇒ Object
-
#to_atd ⇒ Object
Return Annotated Cell representation.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Instance Attribute Details
#aboutUrl ⇒ Object
Returns the value of attribute aboutUrl
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def aboutUrl @aboutUrl end |
#column ⇒ Object
Returns the value of attribute column
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def column @column end |
#errors ⇒ Object
Returns the value of attribute errors
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def errors @errors end |
#propertyUrl ⇒ Object
Returns the value of attribute propertyUrl
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def propertyUrl @propertyUrl end |
#row ⇒ Object
Returns the value of attribute row
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def row @row end |
#stringValue ⇒ Object
Returns the value of attribute stringValue
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def stringValue @stringValue end |
#table ⇒ Object
Returns the value of attribute table
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def table @table end |
#value ⇒ Object
Returns the value of attribute value
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def value @value end |
#valueUrl ⇒ Object
Returns the value of attribute valueUrl
1694 1695 1696 |
# File 'lib/rdf/tabular/metadata.rb', line 1694 def valueUrl @valueUrl end |
Instance Method Details
#id ⇒ RDF::URI
Identifier for this Cell, as an RFC7111 fragment
1714 |
# File 'lib/rdf/tabular/metadata.rb', line 1714 def id; table.url + "#cell=#{self.row.sourceNumber},#{self.column.sourceNumber}"; end |
#set_urls(mapped_values) ⇒ Object
1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 |
# File 'lib/rdf/tabular/metadata.rb', line 1695 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.(mapped_values).to_s # FIXME: don't expand here, do it in CSV2RDF url = row.context.(mapped, documentRelative: true) self.send("#{prop}=".to_sym, url) end end end |
#to_atd ⇒ Object
Return Annotated Cell representation
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 |
# File 'lib/rdf/tabular/metadata.rb', line 1717 def to_atd { "@id" => self.id, "@type" => "Cell", "column" => column.id, "row" => row.id, "stringValue" => self.stringValue, "value" => self.value, "errors" => self.errors } end |
#to_s ⇒ Object
1710 |
# File 'lib/rdf/tabular/metadata.rb', line 1710 def to_s; value.to_s; end |
#valid? ⇒ Boolean
1709 |
# File 'lib/rdf/tabular/metadata.rb', line 1709 def valid?; Array(errors).empty?; end |