oba-client 2.0.2 → 2.0.3
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 +3 -0
- data/lib/oba-client.rb +12 -11
- metadata +4 -4
    
        data/History.md
    CHANGED
    
    
    
        data/lib/oba-client.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ require "uri" | |
| 9 9 | 
             
            # things we do: get text, and parse it. We can do both independently or 
         | 
| 10 10 | 
             
            # serially.
         | 
| 11 11 | 
             
            class OBAClient
         | 
| 12 | 
            -
              VERSION = "2.0. | 
| 12 | 
            +
              VERSION = "2.0.3"
         | 
| 13 13 |  | 
| 14 14 | 
             
              ##
         | 
| 15 15 | 
             
              # A high HTTP read timeout, as the service sometimes takes awhile to respond.
         | 
| @@ -117,8 +117,7 @@ class OBAClient | |
| 117 117 | 
             
              ONTOLOGY_BEANS_XPATH   = "/success/data/annotatorResultBean/ontologies/ontologyUsedBean"
         | 
| 118 118 |  | 
| 119 119 | 
             
              ##
         | 
| 120 | 
            -
              # Attributes for mapping concepts ( | 
| 121 | 
            -
              # attribute. See also {ANNOTATION_CONCEPT_ATTRIBUTES}.
         | 
| 120 | 
            +
              # Attributes for mapping concepts (only one type).
         | 
| 122 121 | 
             
              CONCEPT_ATTRIBUTES = {
         | 
| 123 122 | 
             
                :id              => lambda {|c| c.xpath("id").text.to_i},
         | 
| 124 123 | 
             
                :localConceptId  => lambda {|c| c.xpath("localConceptId").text},
         | 
| @@ -146,7 +145,7 @@ class OBAClient | |
| 146 145 |  | 
| 147 146 |  | 
| 148 147 | 
             
              ##
         | 
| 149 | 
            -
              #  | 
| 148 | 
            +
              # Attributes for mapping and mgrep contexts (both will add 
         | 
| 150 149 | 
             
              # additional attributes).
         | 
| 151 150 | 
             
              CONTEXT_ATTRIBUTES = {
         | 
| 152 151 | 
             
                :contextName     => lambda {|c| c.xpath("contextName").text},
         | 
| @@ -156,7 +155,7 @@ class OBAClient | |
| 156 155 | 
             
              }
         | 
| 157 156 |  | 
| 158 157 | 
             
              ##
         | 
| 159 | 
            -
              #   | 
| 158 | 
            +
              #  Attributes for annotation contexts.
         | 
| 160 159 | 
             
              ANNOTATION_CONTEXT_ATTRIBUTES = {
         | 
| 161 160 | 
             
                :score   => lambda {|c| c.xpath("score").text.to_i},
         | 
| 162 161 | 
             
                :concept => lambda {|c| parse_concept(c.xpath("concept").first)},
         | 
| @@ -164,14 +163,14 @@ class OBAClient | |
| 164 163 | 
             
              }
         | 
| 165 164 |  | 
| 166 165 | 
             
              ##
         | 
| 167 | 
            -
              #  | 
| 166 | 
            +
              # Attributes for mapping contexts.
         | 
| 168 167 | 
             
              MAPPED_CONTEXT_ATTRIBUTES = CONTEXT_ATTRIBUTES.merge(
         | 
| 169 | 
            -
                :mappingType | 
| 168 | 
            +
                :mappingType   => lambda {|c| c.xpath("mappingType").text},
         | 
| 170 169 | 
             
                :mappedConcept => lambda {|c| parse_concept(c.xpath("mappedConcept").first)}
         | 
| 171 170 | 
             
              )
         | 
| 172 171 |  | 
| 173 172 | 
             
              ##
         | 
| 174 | 
            -
              #  | 
| 173 | 
            +
              # Attributes for mgrep contexts.
         | 
| 175 174 | 
             
              MGREP_CONTEXT_ATTRIBUTES = CONTEXT_ATTRIBUTES.merge(
         | 
| 176 175 | 
             
                :name           => lambda {|c| c.xpath("term/name").text},
         | 
| 177 176 | 
             
                :localConceptId => lambda {|c| c.xpath("term/localConceptId").text},
         | 
| @@ -179,10 +178,12 @@ class OBAClient | |
| 179 178 | 
             
                :dictionaryId   => lambda {|c| c.xpath("term/dictionaryId").text}
         | 
| 180 179 | 
             
              )
         | 
| 181 180 |  | 
| 181 | 
            +
              ## 
         | 
| 182 | 
            +
              # Map the bean type to the set of attributes we parse from it.
         | 
| 182 183 | 
             
              CONTEXT_CLASSES = {
         | 
| 183 | 
            -
                "annotationContextBean" | 
| 184 | 
            -
                "mgrepContextBean" | 
| 185 | 
            -
                "mappingContextBean" | 
| 184 | 
            +
                "annotationContextBean" => ANNOTATION_CONTEXT_ATTRIBUTES,
         | 
| 185 | 
            +
                "mgrepContextBean"      => MGREP_CONTEXT_ATTRIBUTES,
         | 
| 186 | 
            +
                "mappingContextBean"    => MAPPED_CONTEXT_ATTRIBUTES,
         | 
| 186 187 | 
             
              }
         | 
| 187 188 |  | 
| 188 189 | 
             
              ##
         | 
    
        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: 9
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 2
         | 
| 8 8 | 
             
              - 0
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 2.0. | 
| 9 | 
            +
              - 3
         | 
| 10 | 
            +
              version: 2.0.3
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Rob Tirrell
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2010-07- | 
| 18 | 
            +
            date: 2010-07-16 00:00:00 -07:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         |