class RDF::Tabular::TableGroup

Constants

DEFAULTS
PROPERTIES
REQUIRED

Public Instance Methods

each_table() { |for_table(url)| ... } click to toggle source

Iterate over all tables @yield [Table]

# File lib/rdf/tabular/metadata.rb, line 1345
def each_table
  tables.map(&:url).each do |url|
    yield for_table(url)
  end
end
for_table(url) click to toggle source

Return the metadata for a specific table, re-basing context as necessary

@param [String] url of the table @return [Table]

# File lib/rdf/tabular/metadata.rb, line 1356
def for_table(url)
  # If there are no tables, assume there's one for this table
  #self.tables ||= [Table.new(url: url)]
  if table = Array(tables).detect {|t| t.url == url}
    # Set document base for this table for resolving URLs
    table.instance_variable_set(:@context, context.dup)
    table.context.base = url
    table
  end
end
has_annotations?() click to toggle source

Does the Metadata or any descendant have any common properties @return [Boolean]

Calls superclass method RDF::Tabular::Metadata#has_annotations?
# File lib/rdf/tabular/metadata.rb, line 1338
def has_annotations?
  super || tables.any? {|t| t.has_annotations? }
end
to_atd() click to toggle source

Return Annotated Table Group representation

# File lib/rdf/tabular/metadata.rb, line 1368
def to_atd
  object.inject({
    "@id" => (id.to_s if id),
    "@type" => "AnnotatedTableGroup",
    "tables" => Array(self.tables).map(&:to_atd)
  }) do |memo, (k, v)|
    memo[k.to_s] ||= v
    memo
  end.delete_if {|k,v| v.nil? || v.is_a?(Metadata) || k.to_s == "@context"}
end