oba-client 1.1.1 → 1.2.0
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 +5 -1
- data/README.md +4 -0
- data/lib/oba_client.rb +11 -3
- data/test/test_oba_client.rb +0 -1
- metadata +4 -4
data/History.md
CHANGED
data/README.md
CHANGED
@@ -31,6 +31,10 @@ See [the Annotator documentation](http://www.bioontology.org/wiki/index.php/Anno
|
|
31
31
|
# :annotations => [Array of annotations of text],
|
32
32
|
# :ontologies => [Array of ontologies used]}
|
33
33
|
client2.execute("another text string, maybe longer this time.")
|
34
|
+
client2.execute("this is the second query for this client!")
|
35
|
+
|
36
|
+
# Or, parse some file you've already got lying about (pass as a string).
|
37
|
+
parsed = OBAClient::parse("<?xml ... ")
|
34
38
|
|
35
39
|
## LICENSE:
|
36
40
|
|
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.
|
8
|
+
VERSION = "1.2.0"
|
9
9
|
|
10
10
|
# A high HTTP read timeout, as the service sometimes takes awhile to respond.
|
11
11
|
DEFAULT_TIMEOUT = 30
|
@@ -37,6 +37,10 @@ class OBAClient
|
|
37
37
|
:withDefaultStopWords,
|
38
38
|
:withSynonyms,
|
39
39
|
]
|
40
|
+
|
41
|
+
STATISTICS_BEANS_XPATH = "/success/data/annotatorResultBean/statistics/statisticsBean"
|
42
|
+
ANNOTATION_BEANS_XPATH = "/success/data/annotatorResultBean/annotations/annotationBean"
|
43
|
+
ONTOLOGY_BEANS_XPATH = "/success/data/annotatorResultBean/ontologies/ontologyUsedBean"
|
40
44
|
|
41
45
|
# Instantiate the class with a set of reused options. Options used by the
|
42
46
|
# method are:
|
@@ -115,7 +119,11 @@ class OBAClient
|
|
115
119
|
ontologies = []
|
116
120
|
doc = Nokogiri::XML.parse(xml)
|
117
121
|
|
118
|
-
doc.xpath(
|
122
|
+
doc.xpath(STATISTICS_BEANS_XPATH).each do |sb|
|
123
|
+
statistics[sb.xpath("mapping").text] = sb.xpath("nbAnnotation").text.to_i
|
124
|
+
end
|
125
|
+
|
126
|
+
doc.xpath(ANNOTATION_BEANS_XPATH).each do |ann|
|
119
127
|
parsed = {
|
120
128
|
:score => ann.xpath("score").text.to_i,
|
121
129
|
:id => ann.xpath("concept/id").text.to_i,
|
@@ -144,7 +152,7 @@ class OBAClient
|
|
144
152
|
annotations << parsed
|
145
153
|
end
|
146
154
|
|
147
|
-
doc.xpath(
|
155
|
+
doc.xpath(ONTOLOGY_BEANS_XPATH).each do |ontology|
|
148
156
|
parsed = {}
|
149
157
|
parsed[:localOntologyId] = ontology.xpath("localOntologyId").text.to_i
|
150
158
|
parsed[:virtualOntologyId] = ontology.xpath("virtualOntologyId").text.to_i
|
data/test/test_oba_client.rb
CHANGED
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rob Tirrell
|