ncbo_annotator 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,21 @@ module NCBO
44
44
  ontologies = parse_ontologies("ontologyBean")
45
45
  ontologies
46
46
  end
47
+
48
+ def self.parse_semantic_types(semantic_types)
49
+ new(semantic_types).parse_semantic_types
50
+ end
51
+
52
+ def parse_semantic_types
53
+ @root = "/success/data/list"
54
+ semantic_types = []
55
+ @results.find(@root + "/semanticTypeBean").each do |semantic_type_bean|
56
+ semantic_type = {}
57
+ semantic_type_bean.children.each { |child| semantic_type[child.name.to_sym] = safe_to_i(child.content) }
58
+ semantic_types << semantic_type
59
+ end
60
+ semantic_types
61
+ end
47
62
 
48
63
  private
49
64
 
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'net/http'
3
2
  require 'xml'
4
3
  require 'uri'
@@ -63,6 +62,19 @@ module NCBO
63
62
  end
64
63
  end
65
64
 
65
+ def self.semantic_types(options)
66
+ new(options).semantic_types
67
+ end
68
+
69
+ def semantic_types
70
+ if @semantic_types.nil?
71
+ semantic_types_xml = open("#{@options[:annotator_location]}/semanticTypes?apikey=#{@options[:apikey]}").read
72
+ @semantic_types = Parser::Annotator.parse_semantic_types(semantic_types_xml)
73
+ else
74
+ @semantic_types
75
+ end
76
+ end
77
+
66
78
  def options
67
79
  @options
68
80
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncbo_annotator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul R Alexander