oba-client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -1,8 +1,7 @@
1
1
  .autotest
2
2
  History.txt
3
3
  Manifest.txt
4
- README.txt
4
+ README.md
5
5
  Rakefile
6
- bin/oba_client
7
6
  lib/oba_client.rb
8
7
  test/test_oba_client.rb
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # oba-client
2
+
3
+ * http://rubyforge.org/projects/oba-client
4
+
5
+ ## DESCRIPTION:
6
+
7
+ A client for accessing the NCBO's Open Biomedical Annotator service.
8
+
9
+ ## FEATURES:
10
+
11
+ * Many
12
+
13
+ ## REQUIREMENTS:
14
+
15
+ * None
16
+
17
+ ## INSTALL:
18
+
19
+ sudo gem install oba-client
20
+ gem install --user-install oba-client
21
+
22
+ ## USAGE:
23
+
24
+ client = OBAClient.new
25
+ result = client.execute("some text string") # As XML.
26
+
27
+ client2 = OBAClient.new({:parse_xml => true})
28
+ # Returns {:statistics => {information about the annotation},
29
+ # :annotations => [Array of annotations of text],
30
+ # :ontologies => [Array of ontologies used]}
31
+ client2.execute("another text string, maybe longer this time.")
32
+
33
+ ## LICENSE:
34
+
35
+ Copyright (c) 2010 Rob Tirrell
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy
38
+ of this software and associated documentation files (the "Software"), to deal
39
+ in the Software without restriction, including without limitation the rights
40
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41
+ copies of the Software, and to permit persons to whom the Software is
42
+ furnished to do so, subject to the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be included in
45
+ all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53
+ THE SOFTWARE.
54
+
data/Rakefile CHANGED
@@ -4,8 +4,11 @@ require "hoe"
4
4
  Hoe.plugin :yard
5
5
 
6
6
  Hoe.spec "oba-client" do
7
- developer("Rob Tirrell", "rpt@stanford.edu")
8
- self.yard_options = ["--default-return", "void", "--readme", "README.txt"]
7
+ self.developer "Rob Tirrell", "rpt@stanford.edu"
8
+ self.yard_options = ["--default-return", "void"]
9
+ self.yard_markup = "markdown"
10
+ self.remote_yard_dir = ""
11
+
9
12
  self.rubyforge_name = "oba-client"
10
13
  end
11
14
 
data/lib/oba_client.rb CHANGED
@@ -5,7 +5,7 @@ require "net/http"
5
5
  require "uri"
6
6
 
7
7
  class OBAClient
8
- VERSION = "1.0.1"
8
+ VERSION = "1.0.2"
9
9
 
10
10
  # A high HTTP read timeout, as the service sometimes takes awhile to respond.
11
11
  DEFAULT_TIMEOUT = 30
@@ -31,10 +31,12 @@ class OBAClient
31
31
  :email
32
32
  ]
33
33
 
34
- # Annotate a blob of text. Method options are:
35
- # - [String] uri: the URI of the annotator service (default: {DEFAULT_URI}).
36
- # - [Fixnum] timeout: the length of the read timeout (default: {DEFAULT_TIMEOUT}).
37
- # - [Boolean] parse_xml: whether to parse the received text (default: false).
34
+ # Instantiate the class with a set of reused options. Options used by the
35
+ # method are:
36
+ #
37
+ # * [String] uri: the URI of the annotator service (default: {DEFAULT_URI}).
38
+ # * [Fixnum] timeout: the length of the read timeout (default: {DEFAULT_TIMEOUT}).
39
+ # * [Boolean] parse_xml: whether to parse the received text (default: false).
38
40
  # @param [Hash<String, String>] options Parameters for the annotation.
39
41
  def initialize(options = {})
40
42
  @uri = URI.parse(options.delete(:uri) || DEFAULT_URI)
@@ -122,8 +124,8 @@ class OBAClient
122
124
 
123
125
  doc.xpath("//ontologyUsedBean").each do |ontology|
124
126
  parsed = {}
125
- parsed[:localOntologyId] = ontology.xpath("localOntologyId").text
126
- parsed[:virtualOntologyId] = ontology.xpath("virtualOntologyId").text
127
+ parsed[:localOntologyId] = ontology.xpath("localOntologyId").text.to_i
128
+ parsed[:virtualOntologyId] = ontology.xpath("virtualOntologyId").text.to_i
127
129
  parsed[:name] = ontology.xpath("name").text
128
130
  ontologies << parsed
129
131
  end
@@ -2,9 +2,7 @@ require "test/unit"
2
2
  require "oba_client"
3
3
 
4
4
  TEST_TEXTS = [
5
- "hello I am a monkeyfish with a benign neoplastic....\t\n\\n",
6
- "zebrafish echo delta tango TURN <?xml MY VOLUME UP cancer of the thorax.",
7
- "zebrafish DROP TABLE !!! TURN MY VOLUME UP cancer of the thorax.",
5
+ "Mexico,, Disease Thing \o\r\m\n\t\v\l\rzebrafish !!! cancer of the thorax.",
8
6
  %Q{LOROE aonuhaso unseu anoeuhs aeuhsaonuh asoneuhason uaosenuh aosenuhaose
9
7
  aoneuhasonuhaoenuh anoeuhasn euhasoneu haosneuhaosenuhaoesunahoeusnaoeuteeano
10
8
  aot tt t t t t t t tae \n!!@)$@(#)%@#!)@# asoeuaohsenutahoeusaheou
@@ -53,9 +51,7 @@ class TestOBAClient < Test::Unit::TestCase
53
51
  :parse_xml => true
54
52
  )
55
53
  parsed = ann.execute(text)
56
- assert parsed[:statistics].is_a?(Array)
57
- assert parsed[:annotations].is_a?(Array)
58
- assert parsed[:ontologies].is_a?(Array)
54
+ assert (parsed[:ontologies].all? {|o| o[:localOntologyId] == 42812})
59
55
  end
60
56
  end
61
57
 
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rob Tirrell
@@ -66,38 +66,36 @@ dependencies:
66
66
  version: 2.6.1
67
67
  type: :development
68
68
  version_requirements: *id003
69
- description: FIX (describe your package)
69
+ description: A client for accessing the NCBO's Open Biomedical Annotator service.
70
70
  email:
71
71
  - rpt@stanford.edu
72
- executables:
73
- - oba_client
72
+ executables: []
73
+
74
74
  extensions: []
75
75
 
76
76
  extra_rdoc_files:
77
77
  - History.txt
78
78
  - Manifest.txt
79
- - README.txt
80
79
  files:
81
80
  - .autotest
82
81
  - History.txt
83
82
  - Manifest.txt
84
- - README.txt
83
+ - README.md
85
84
  - Rakefile
86
- - bin/oba_client
87
85
  - lib/oba_client.rb
88
86
  - test/test_oba_client.rb
89
87
  has_rdoc: yard
90
- homepage: http://rubyforge.org/oba-client
88
+ homepage: http://rubyforge.org/projects/oba-client
91
89
  licenses: []
92
90
 
93
91
  post_install_message:
94
92
  rdoc_options:
95
93
  - --default-return
96
94
  - void
97
- - --readme
98
- - README.txt
99
95
  - --title
100
96
  - ObaClient Documentation
97
+ - --markup
98
+ - markdown
101
99
  - --quiet
102
100
  require_paths:
103
101
  - lib
@@ -125,6 +123,6 @@ rubyforge_project: oba-client
125
123
  rubygems_version: 1.3.7
126
124
  signing_key:
127
125
  specification_version: 3
128
- summary: FIX (describe your package)
126
+ summary: A client for accessing the NCBO's Open Biomedical Annotator service.
129
127
  test_files:
130
128
  - test/test_oba_client.rb
data/README.txt DELETED
@@ -1,57 +0,0 @@
1
- = oba_client
2
-
3
- * http://rubyforge.org/oba-client
4
-
5
- == DESCRIPTION:
6
-
7
- FIX (describe your package)
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * FIX (list of features or problems)
12
-
13
- == SYNOPSIS:
14
-
15
- FIX (code sample of usage)
16
-
17
- == REQUIREMENTS:
18
-
19
- * None
20
-
21
- == INSTALL:
22
-
23
- * FIX (sudo gem install, anything else)
24
-
25
- == DEVELOPERS:
26
-
27
- After checking out the source, run:
28
-
29
- $ rake newb
30
-
31
- This task will install any missing dependencies, run the tests/specs,
32
- and generate the RDoc.
33
-
34
- == LICENSE:
35
-
36
- (The MIT License)
37
-
38
- Copyright (c) 2010 FIX
39
-
40
- Permission is hereby granted, free of charge, to any person obtaining
41
- a copy of this software and associated documentation files (the
42
- 'Software'), to deal in the Software without restriction, including
43
- without limitation the rights to use, copy, modify, merge, publish,
44
- distribute, sublicense, and/or sell copies of the Software, and to
45
- permit persons to whom the Software is furnished to do so, subject to
46
- the following conditions:
47
-
48
- The above copyright notice and this permission notice shall be
49
- included in all copies or substantial portions of the Software.
50
-
51
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
52
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
55
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/oba_client DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- abort "you need to write me"