Class: PubliSci::Readers::Base

Inherits:
Object
  • Object
show all
Includes:
Analyzer, Dataset::DataCube, Interactive, Parser, Query
Defined in:
lib/bio-publisci/readers/base.rb

Direct Known Subclasses

CSV, MAF

Instance Method Summary collapse

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 Parser

#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

Instance Method Details

#automatic(*args) ⇒ Object

should be overridden if extra processing/input is required



11
12
13
# File 'lib/bio-publisci/readers/base.rb', line 11

def automatic(*args)
  generate_n3(args[0],Hash[*args[1..-2]])
end

#generate_n3(*args) ⇒ Object



15
16
17
# File 'lib/bio-publisci/readers/base.rb', line 15

def generate_n3(*args)
  raise "#{self} does not implement a generate_n3 method!"
end

#next_labelObject



48
49
50
51
52
53
54
# File 'lib/bio-publisci/readers/base.rb', line 48

def next_label
  if @__current_label
    @__current_label += 1
  else
    @__current_label = 0
  end
end

#sio_attribute(attribute_type, value, data_type = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/bio-publisci/readers/base.rb', line 26

def sio_attribute(attribute_type,value,data_type=nil)
  inner = [
    "http://semanticscience.org/resource/SIO_000300",value
  ]
  if data_type
    inner = [["a", data_type], inner]
  end
  
  outer = 
  [
    "http://semanticscience.org/resource/SIO_000008",
      inner
  ]

  if attribute_type
    outer = [["a", attribute_type], outer] 
  end

  # puts "#{outer}"
  outer
end

#sio_value(type, value) ⇒ Object



19
20
21
22
23
24
# File 'lib/bio-publisci/readers/base.rb', line 19

def sio_value(type,value)
  [
    ["a", type],
    ["http://semanticscience.org/resource/SIO_000300",value]
  ]
end