Class: SimpleBioC::Passage

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_bioc/passage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Passage

Returns a new instance of Passage.


6
7
8
9
10
11
12
# File 'lib/simple_bioc/passage.rb', line 6

def initialize(parent)
  @infons = {}
  @sentences = []
  @annotations = []
  @relations = []
  @document = parent
end

Instance Attribute Details

#annotationsObject

Returns the value of attribute annotations.


3
4
5
# File 'lib/simple_bioc/passage.rb', line 3

def annotations
  @annotations
end

#documentObject (readonly)

Returns the value of attribute document.


4
5
6
# File 'lib/simple_bioc/passage.rb', line 4

def document
  @document
end

#infonsObject

Returns the value of attribute infons.


3
4
5
# File 'lib/simple_bioc/passage.rb', line 3

def infons
  @infons
end

#offsetObject

Returns the value of attribute offset.


3
4
5
# File 'lib/simple_bioc/passage.rb', line 3

def offset
  @offset
end

#relationsObject

Returns the value of attribute relations.


3
4
5
# File 'lib/simple_bioc/passage.rb', line 3

def relations
  @relations
end

#sentencesObject

Returns the value of attribute sentences.


3
4
5
# File 'lib/simple_bioc/passage.rb', line 3

def sentences
  @sentences
end

#textObject

Returns the value of attribute text.


3
4
5
# File 'lib/simple_bioc/passage.rb', line 3

def text
  @text
end

Instance Method Details

#each_relationObject


27
28
29
30
# File 'lib/simple_bioc/passage.rb', line 27

def each_relation
  @relations.each{|r| yield r}
  @sentences.each{|s| s.each_relation{|r| yield r}}
end

#find_node(id) ⇒ Object


18
19
20
21
22
23
24
25
# File 'lib/simple_bioc/passage.rb', line 18

def find_node(id)
  (@relations+@annotations).each{|n| return n if n.id == id}
  @sentences.each do |s|
    ret = s.find_node(id)
    return ret unless ret.nil?
  end
  nil
end

#to_sObject


14
15
16
# File 'lib/simple_bioc/passage.rb', line 14

def to_s
  "Passage @#{@offset}: #{@text}"  
end