Class: RDF::Tabular::Table

Inherits:
Metadata show all
Defined in:
lib/rdf/tabular/metadata.rb

Constant Summary collapse

PROPERTIES =
{
  :@id              => :link,
  :@type            => :atomic,
  dialect:             :object,
  notes:               :array,
  suppressOutput:      :atomic,
  tableDirection:      :atomic,
  tableSchema:         :object,
  transformations:     :array,
  url:                 :link,
}.freeze
REQUIRED =
[:url].freeze

Constants inherited from Metadata

Metadata::DATATYPES, Metadata::INHERITED_PROPERTIES, Metadata::LOCAL_CONTEXT, Metadata::NAME_SYNTAX

Instance Attribute Summary

Attributes inherited from Metadata

#filenames, #id, #object, #parent, #url

Instance Method Summary collapse

Methods inherited from Metadata

#==, #[], #[]=, #base, #common_properties, #context, #dialect, #dialect=, #each, #each_row, #errors, for_input, #initialize, #inspect, #merge, #merge!, new, #normalize!, #normalize_datatype, #normalize_jsonld, open, #to_json, #type, #valid?, #valid_inherited_property?, #valid_natural_language_property?, #validate!

Methods included from Utils

debug, #depth

Constructor Details

This class inherits a constructor from RDF::Tabular::Metadata

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object

Logic for accessing elements as accessors



1388
1389
1390
1391
1392
1393
1394
# File 'lib/rdf/tabular/metadata.rb', line 1388

def method_missing(method, *args)
  if INHERITED_PROPERTIES.has_key?(method.to_sym)
    inherited_property_value(method.to_sym)
  else
    PROPERTIES.has_key?(method.to_sym) ? object[method.to_sym] : super
  end
end

Instance Method Details

#has_annotations?Boolean

Does the Metadata or any descendant have any common properties

Returns:

  • (Boolean)


1372
1373
1374
# File 'lib/rdf/tabular/metadata.rb', line 1372

def has_annotations?
  super || tableSchema && tableSchema.has_annotations?
end

#to_atdObject

Return Annotated Table representation



1377
1378
1379
1380
1381
1382
1383
1384
1385
# File 'lib/rdf/tabular/metadata.rb', line 1377

def to_atd
  {
    "@id" => id,
    "@type" => "AnnotatedTable",
    "columns" => tableSchema.columns.map(&:to_atd),
    "rows" => [],
    "url" => self.url.to_s
  }
end