Class: NCBO::Parser::Annotator
- Inherits:
-
BaseParser
- Object
- BaseParser
- NCBO::Parser::Annotator
- Defined in:
- lib/ncbo_annotator/parser.rb
Class Method Summary collapse
- .parse_included_ontologies(ontologies) ⇒ Object
- .parse_results(results) ⇒ Object
- .parse_semantic_types(semantic_types) ⇒ Object
Instance Method Summary collapse
-
#initialize(results) ⇒ Annotator
constructor
A new instance of Annotator.
- #parse_included_ontologies ⇒ Object
- #parse_results ⇒ Object
- #parse_semantic_types ⇒ Object
Methods inherited from BaseParser
Constructor Details
#initialize(results) ⇒ Annotator
Returns a new instance of Annotator.
20 21 22 23 |
# File 'lib/ncbo_annotator/parser.rb', line 20 def initialize(results) @root = "/success/data/annotatorResultBean" @results = parse_xml(results) end |
Class Method Details
.parse_included_ontologies(ontologies) ⇒ Object
38 39 40 |
# File 'lib/ncbo_annotator/parser.rb', line 38 def self.parse_included_ontologies(ontologies) new(ontologies).parse_included_ontologies end |
.parse_results(results) ⇒ Object
25 26 27 |
# File 'lib/ncbo_annotator/parser.rb', line 25 def self.parse_results(results) new(results).parse_results end |
.parse_semantic_types(semantic_types) ⇒ Object
48 49 50 |
# File 'lib/ncbo_annotator/parser.rb', line 48 def self.parse_semantic_types(semantic_types) new(semantic_types).parse_semantic_types end |
Instance Method Details
#parse_included_ontologies ⇒ Object
42 43 44 45 46 |
# File 'lib/ncbo_annotator/parser.rb', line 42 def parse_included_ontologies @root = "/success/data/list" ontologies = parse_ontologies("ontologyBean") ontologies.delete_if {|a| a[:status] != 28} end |
#parse_results ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/ncbo_annotator/parser.rb', line 29 def parse_results @result = AnnotatorResult.new @result.id = @results.find_first(@root + "/resultID").content @result.statistics = parse_statistics @result.annotations = parse_annotations @result.ontologies = parse_ontologies @result end |
#parse_semantic_types ⇒ Object
52 53 54 |
# File 'lib/ncbo_annotator/parser.rb', line 52 def parse_semantic_types _parse_semantic_types(@results.find_first("/success/data/list")) end |