Class: PubliSci::Readers::MAF

Inherits:
Object
  • Object
show all
Extended by:
Base
Defined in:
lib/publisci/readers/maf.rb

Class Method Summary collapse

Methods included from Base

automatic, generate_n3, next_label, sio_attribute, sio_value

Methods included from Dataset::DataCube

#abbreviate_known, #code_lists, #component_gen, #component_specifications, #concept_codes, #data_structure_definition, #dataset, #defaults, #dimension_properties, #encode_data, #generate, #generate_resources, #measure_properties, #observations, #prefixes, #vocabulary

Methods included from PubliSci::RDFParser

#add_node, #bnode_value, #encode_value, #get_ary, #get_hashes, #is_complex?, #is_uri?, #load_string, #observation_hash, #sanitize, #sanitize_hash, #strip_prefixes, #strip_uri, #to_literal, #to_resource, #turtle_indent

Methods included from Interactive

#interact

Methods included from Analyzer

#check_integrity, #dirty?, #recommend_range, #recommend_range_strings

Methods included from Query

#execute, #execute_from_file, #property_names, #property_values, #row_names, #vocabulary

Class Method Details

.generate_n3(input_file, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/publisci/readers/maf.rb', line 6

def self.generate_n3(input_file, options={})
  input_file = open(input_file,'r')

  out_base = options[:output_base] || File.basename(input_file,'.*')

  if options[:output] == :print
    output = StringIO.new("")
  else
    output = open "#{out_base}.ttl",'w'
  end

  PubliSci::Generators::MAF.write_structure(input_file, output, options)

  PubliSci::Parsers::MAF.each_record(input_file) do |rec, label|
    PubliSci::Generators::MAF.write(rec, output, label, options)
  end

  output.close

  if options[:output] == :print
    output.string
  else
    output.path
  end
end