oba-client 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +5 -1
- data/Manifest.txt +1 -1
- data/README.md +16 -17
- data/lib/{oba_client.rb → oba-client.rb} +7 -5
- data/test/test_oba_client.rb +1 -2
- metadata +4 -4
data/History.md
CHANGED
data/Manifest.txt
CHANGED
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
:semanticTypes => [
|
50
|
+
{:id => 230820, :semanticType => "T043", :description => "desc"},
|
51
|
+
"etc..."
|
52
|
+
]
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
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.
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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|
|
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: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.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/
|
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
|