diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 569b9bd..0650cf0 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: ['3.0', '3.1'] + ruby-version: ['3.1'] steps: - uses: actions/checkout@v3 - name: Set up Ruby diff --git a/Gemfile.lock b/Gemfile.lock index 4cb70a6..241d1b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ontologies_api_client (2.4.0) + ontologies_api_client (2.5.0) activesupport (= 7.0.8) addressable (~> 2.8) excon @@ -23,73 +23,75 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) - bigdecimal (3.1.8) + bigdecimal (3.1.9) coderay (1.1.3) - concurrent-ruby (1.3.3) - excon (0.111.0) - faraday (2.10.0) - faraday-net_http (>= 2.0, < 3.2) + concurrent-ruby (1.3.5) + excon (1.2.3) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) + json logger - faraday-excon (2.1.0) - excon (>= 0.27.4) - faraday (~> 2.0) + faraday-excon (2.3.0) + excon (>= 1.0.0) + faraday (>= 2.11.0, < 3) faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (3.1.0) - net-http - i18n (1.14.5) + faraday-multipart (1.1.0) + multipart-post (~> 2.0) + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + i18n (1.14.7) concurrent-ruby (~> 1.0) - json (2.7.2) - language_server-protocol (3.17.0.3) - logger (1.6.0) + json (2.9.1) + language_server-protocol (3.17.0.4) + logger (1.6.5) lz4-ruby (0.3.3) method_source (1.1.0) - minitest (5.25.1) - minitest-hooks (1.5.1) + minitest (5.25.4) + minitest-hooks (1.5.2) minitest (> 5.3) multi_json (1.15.0) multipart-post (2.4.1) - net-http (0.4.1) + net-http (0.6.0) uri - oj (3.16.4) + oj (3.16.9) bigdecimal (>= 3.0) - parallel (1.25.1) - parser (3.3.4.0) + ostruct (>= 0.2) + ostruct (0.6.1) + parallel (1.26.3) + parser (3.3.7.1) ast (~> 2.4.1) racc - pry (0.14.2) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (6.0.0) - racc (1.8.0) + public_suffix (6.0.1) + racc (1.8.1) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.2) - rexml (3.3.2) - strscan - rubocop (1.65.0) + regexp_parser (2.10.0) + rubocop (1.71.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.38.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) - strscan (3.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) - uri (0.13.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.2) PLATFORMS + arm64-darwin-24 ruby x86_64-darwin-16 x86_64-darwin-17 @@ -105,4 +107,4 @@ DEPENDENCIES rubocop (~> 1.43) BUNDLED WITH - 2.4.18 + 2.5.11 diff --git a/LICENSE.txt b/LICENSE.txt index 5774c19..8b0d9e2 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2021, The Board of Trustees of Leland Stanford Junior University +Copyright (c) 2025, The Board of Trustees of Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are diff --git a/README.md b/README.md index 9bc1f70..4feda27 100644 --- a/README.md +++ b/README.md @@ -153,14 +153,4 @@ For questions please email [support@bioontology.org](support@bioontology.org.) ## License -Copyright (c) 2024, The Board of Trustees of Leland Stanford Junior University All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE BOARD OF TRUSTEES OF LELAND STANFORD JUNIOR UNIVERSITY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL The Board of Trustees of Leland Stanford Junior University OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of The Board of Trustees of Leland Stanford Junior University. +This project is licensed under the [FreeBSD License](LICENSE.txt) © 2025 The Board of Trustees of Leland Stanford Junior University. \ No newline at end of file diff --git a/lib/ontologies_api_client/link_explorer.rb b/lib/ontologies_api_client/link_explorer.rb index 421a5f5..cc4c328 100644 --- a/lib/ontologies_api_client/link_explorer.rb +++ b/lib/ontologies_api_client/link_explorer.rb @@ -61,9 +61,15 @@ def replace_template_elements(url, values = []) values = values.dup values = [values] unless values.is_a?(Array) - return url.gsub(/(\{.*?\})/) do - Addressable::URI.encode_component(values.shift, Addressable::URI::CharacterClasses::UNRESERVED) + escaped_value = Addressable::URI.encode_component(values.shift, Addressable::URI::CharacterClasses::UNRESERVED) + if url.match(/(\{.*?\})/) + url.gsub(/(\{.*?\})/) do + escaped_value + end + else + url + '/' + escaped_value end + end def linkable_attributes diff --git a/lib/ontologies_api_client/version.rb b/lib/ontologies_api_client/version.rb index ef2e69e..f433cf8 100644 --- a/lib/ontologies_api_client/version.rb +++ b/lib/ontologies_api_client/version.rb @@ -2,6 +2,6 @@ module LinkedData module Client - VERSION = '2.4.0' + VERSION = '2.5.0' end end diff --git a/test/test_link_explorer.rb b/test/test_link_explorer.rb new file mode 100644 index 0000000..408c2bc --- /dev/null +++ b/test/test_link_explorer.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require_relative 'test_case' + +class LinkExplorerTest < LinkedData::Client::TestCase + def test_explore_ontology_submission_by_id + ont = LinkedData::Client::Models::Ontology.get('FMA') + sub = ont.explore.submissions('29') + refute_nil(sub) + assert_instance_of(LinkedData::Client::Models::OntologySubmission, sub) + assert_equal(29, sub.submissionId) + end + + def test_explore_ontology_class_by_id + ont = LinkedData::Client::Models::Ontology.get('FMA') + cls = ont.explore.classes('http://purl.org/sig/ont/fma/fma70742') + refute_nil(cls) + assert_instance_of(LinkedData::Client::Models::Class, cls) + assert_equal('http://purl.org/sig/ont/fma/fma70742', cls.id) + assert_equal('Set of eyelashes', cls.prefLabel) + end + + def test_explore_ontology_single_class + ont = LinkedData::Client::Models::Ontology.get('FMA') + cls = ont.explore.single_class('http://purl.org/sig/ont/fma/fma322428') + refute_nil(cls) + assert_instance_of(LinkedData::Client::Models::Class, cls) + assert_equal('http://purl.org/sig/ont/fma/fma322428', cls.id) + assert_equal('Set of salivary glands', cls.prefLabel) + end +end