Class DataTable
In: lib/data_table.rb
Parent: Object

What is it

Each EML document can contain DataTable elements representing(in most cases) plain text data. The attributes of this data, such as column names, types, domain info, are documented in the eml metadata. DataTable encapsulates data table elements from eml documents in the instance variable @metadata.

The purpose of this class is to provide methods to easily access metadata attributes pertaining to the data table. It can also be extended for specific applications to process the data based on the metadata description.

Examples

Get the location where this data file is stored

  eml = metacat.find(:docid => 'somedoc.1.1')
  data_table = eml.data_tables[0]
  data_table.location
  => ecogrid://knb/pisco_cbs.30.3

Write the data file to disk

  # note we are using a block so the whole file isn't loaded to RAM
  file = File.new("./tmp/#{data_table.id}")
  data_table.read do |buffer|
    file.write(buffer)
  end
  file.close

Methods

Attributes

eml  [R] 
metadata  [R] 

Public Class methods

Public Instance methods

pulls the docid from distribution element

refers to the docid function

attribute reader for online distribution

reads the dataTable text from the url or docid specified by the physical/distribution/online/url entity

only supports unit bytes

[Validate]