oba-client 2.0.0 → 2.0.1

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.
data/History.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 2.0.0 / 2010-07-08
1
+ ## 2.0.1 / 2010-07-08
2
+
3
+ Rubyforge doesn't allow "_", so we have "oba-client", not "oba_client".
4
+
5
+ # 2.0.0 / 2010-07-08
2
6
 
3
7
  * Parse XML entirely. See README for more information on the return value.
4
8
 
data/Manifest.txt CHANGED
@@ -3,5 +3,5 @@ History.md
3
3
  Manifest.txt
4
4
  README.md
5
5
  Rakefile
6
- lib/oba_client.rb
6
+ lib/oba-client.rb
7
7
  test/test_oba_client.rb
data/README.md CHANGED
@@ -46,34 +46,33 @@ See [the Annotator documentation](http://www.bioontology.org/wiki/index.php/Anno
46
46
  :synonyms => ["body cell"],
47
47
  :definitions => ["a cell", "some other definition"],
48
48
 
49
- :semanticTypes => [
50
- {:id => 230820, :semanticType => "T043", :description => "desc"},
51
- "etc..."
52
- ]
49
+ :semanticTypes => [
50
+ {:id => 230820, :semanticType => "T043", :description => "desc"},
51
+ "etc..."
52
+ ]
53
53
 
54
- :context => {
55
- :contextName => "MAPPING",
56
- :isDirect => false,
57
- :from => 10,
58
- :to => 20,
59
- :mappedConcept => {
60
- "has" => "the same information as other annotations, minus score"
61
- }
62
- }
54
+ :context => {
55
+ :contextName => "MAPPING",
56
+ :isDirect => false,
57
+ :from => 10,
58
+ :to => 20,
59
+ :mappedConcept => {
60
+ "has" => "the same information as other annotations, minus score"
61
+ }
62
+ }
63
63
 
64
64
  :mappingType => "Automatic"
65
65
  }, "more annotations..."]
66
66
 
67
67
  :ontologies => [{
68
- :localOntologyId => 40404,
69
- :name => "Ontology Name",
70
- :virtualOntologyId => 1042
68
+ :localOntologyId => 40404,
69
+ :name => "Ontology Name",
70
+ :virtualOntologyId => 1042
71
71
  }, "more ontologies..."]
72
72
 
73
73
  client2.execute("another text string, maybe longer this time.")
74
74
  client2.execute("this is the second query for this client!")
75
75
 
76
-
77
76
  # Or, parse some file you've already got lying about (pass as a string).
78
77
  parsed = OBAClient::parse("<?xml version='1.0'>...</xml>")
79
78
 
@@ -5,7 +5,7 @@ require "net/http"
5
5
  require "uri"
6
6
 
7
7
  class OBAClient
8
- VERSION = "2.0.0"
8
+ VERSION = "2.0.1"
9
9
 
10
10
  # A high HTTP read timeout, as the service sometimes takes awhile to respond.
11
11
  DEFAULT_TIMEOUT = 30
@@ -117,8 +117,9 @@ class OBAClient
117
117
  end
118
118
  end
119
119
 
120
- # Attributes for mapping concepts (annotation concepts add one,
121
- # @see ANNOTATION_CONCEPT_ATTRIBUTES.
120
+ # Attributes for mapping concepts (annotation concepts add one additional
121
+ # attribute.
122
+ # @see ANNOTATION_CONCEPT_ATTRIBUTES
122
123
  CONCEPT_ATTRIBUTES = {
123
124
  :id => lambda {|c| c.xpath("id").text.to_i},
124
125
  :localConceptId => lambda {|c| c.xpath("localConceptId").text},
@@ -149,7 +150,7 @@ class OBAClient
149
150
  :mappingType => lambda {|c| c.xpath("mappingType").text}
150
151
  )
151
152
 
152
- # # Toplevel attributes for annotation contexts.
153
+ # Toplevel attributes for annotation contexts.
153
154
  ANNOTATION_CONTEXT_ATTRIBUTES = {
154
155
  :score => lambda {|c| c.xpath("score").text.to_i},
155
156
  :concept => lambda {|c| parse_concept(c.xpath("concept").first)},
@@ -164,7 +165,7 @@ class OBAClient
164
165
  :to => lambda {|c| c.xpath("to").text.to_i},
165
166
  }
166
167
 
167
- # # Toplevel attributes for mapping contexts.
168
+ # Toplevel attributes for mapping contexts.
168
169
  MAPPED_CONTEXT_ATTRIBUTES = CONTEXT_ATTRIBUTES.merge(
169
170
  :mappedConcept => lambda {|c| parse_concept(c.xpath("mappedConcept").first)}
170
171
  )
@@ -227,6 +228,7 @@ class OBAClient
227
228
  # @return [Hash<Symbol, Object>] A Hash representation of the XML, as
228
229
  # described above.
229
230
  def self.parse(xml)
231
+ puts "WARNING: text is empty!" if (xml.gsub(/\n/, "") == "")
230
232
  doc = Nokogiri::XML.parse(xml)
231
233
 
232
234
  statistics = Hash[doc.xpath(STATISTICS_BEANS_XPATH).map do |sb|
@@ -1,6 +1,5 @@
1
1
  require "test/unit"
2
- require "oba_client"
3
- require "pp"
2
+ require "oba-client"
4
3
 
5
4
  TEST_TEXTS = [
6
5
  "Mexico,, Disease Thing \o\r\m\n\t\v\l\rzebrafish !!! cancer of the thorax. large intestine thorax",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oba-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 0
10
- version: 2.0.0
9
+ - 1
10
+ version: 2.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rob Tirrell
@@ -84,7 +84,7 @@ files:
84
84
  - Manifest.txt
85
85
  - README.md
86
86
  - Rakefile
87
- - lib/oba_client.rb
87
+ - lib/oba-client.rb
88
88
  - test/test_oba_client.rb
89
89
  has_rdoc: yard
90
90
  homepage: http://rubyforge.org/projects/oba-client