Class: SimpleBioC::Document
- Inherits:
-
Object
- Object
- SimpleBioC::Document
- Defined in:
- lib/simple_bioc/document.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
parent.
-
#id ⇒ Object
attribute.
-
#infons ⇒ Object
attribute.
-
#passages ⇒ Object
attribute.
-
#relations ⇒ Object
attribute.
Instance Method Summary collapse
- #adjust_ref ⇒ Object
- #all_annotations ⇒ Object
- #all_relations ⇒ Object
- #all_texts ⇒ Object
- #each_relation ⇒ Object
- #find_node(id) ⇒ Object
-
#initialize(parent) ⇒ Document
constructor
A new instance of Document.
- #to_s ⇒ Object
Constructor Details
#initialize(parent) ⇒ Document
Returns a new instance of Document.
9 10 11 12 13 14 |
# File 'lib/simple_bioc/document.rb', line 9 def initialize(parent) @infons = {} @passages = [] @relations = [] @collection = parent end |
Instance Attribute Details
#collection ⇒ Object (readonly)
parent
7 8 9 |
# File 'lib/simple_bioc/document.rb', line 7 def collection @collection end |
#id ⇒ Object
attribute
4 5 6 |
# File 'lib/simple_bioc/document.rb', line 4 def id @id end |
#infons ⇒ Object
attribute
4 5 6 |
# File 'lib/simple_bioc/document.rb', line 4 def infons @infons end |
#passages ⇒ Object
attribute
4 5 6 |
# File 'lib/simple_bioc/document.rb', line 4 def passages @passages end |
#relations ⇒ Object
attribute
4 5 6 |
# File 'lib/simple_bioc/document.rb', line 4 def relations @relations end |
Instance Method Details
#adjust_ref ⇒ Object
25 26 27 |
# File 'lib/simple_bioc/document.rb', line 25 def adjust_ref each_relation{|r| r.adjust_ref} end |
#all_annotations ⇒ Object
42 43 44 45 46 |
# File 'lib/simple_bioc/document.rb', line 42 def all_annotations ret = [] @passages.each{|p| p.all_annotations(ret)} ret end |
#all_relations ⇒ Object
48 49 50 51 52 53 |
# File 'lib/simple_bioc/document.rb', line 48 def all_relations ret = [] @relations.each{|r| ret << r} @passages.each{|p| p.all_relations(ret)} ret end |
#all_texts ⇒ Object
38 39 40 |
# File 'lib/simple_bioc/document.rb', line 38 def all_texts @passages.map{|p| p.all_texts}.join(" ") end |
#each_relation ⇒ Object
29 30 31 32 |
# File 'lib/simple_bioc/document.rb', line 29 def each_relation @relations.each{|r| yield r} @passages.each{|p| p.each_relation{|r| yield r}} end |
#find_node(id) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/simple_bioc/document.rb', line 16 def find_node(id) @relations.each{|r| return r if r.id == id} @passages.each do |p| ret = p.find_node(id) return ret unless ret.nil? end nil end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/simple_bioc/document.rb', line 34 def to_s "Document:#{@id}" end |