diff --git a/Gemfile b/Gemfile index 84eff580..ba7af023 100644 --- a/Gemfile +++ b/Gemfile @@ -33,5 +33,5 @@ group :development do end # NCBO gems (can be from a local dev path or from rubygems/git) -gem 'goo', github: 'ncbo/goo', branch: 'master' -gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master' +gem 'goo', github: 'ncbo/goo', branch: 'develop' +gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'develop' diff --git a/Gemfile.lock b/Gemfile.lock index a16f9ac8..3a4a08fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/ncbo/goo.git - revision: daea7822af9e5ca1961d6873a758735133a1b2db - branch: master + revision: 6db93bb3d5095a5fe0d017e572c5a04caa34ebc6 + branch: develop specs: goo (0.0.2) addressable (~> 2.8) @@ -15,8 +15,8 @@ GIT GIT remote: https://github.com/ncbo/sparql-client.git - revision: d418d56a6c9ff5692f925b45739a2a1c66bca851 - branch: master + revision: 55e7dbf858eb571c767bc67868f9af61663859cb + branch: develop specs: sparql-client (1.0.1) json_pure (>= 1.4) @@ -181,11 +181,7 @@ GEM macaddr (~> 1.0) PLATFORMS - aarch64-linux - arm64-darwin-22 x86_64-darwin-18 - x86_64-darwin-21 - x86_64-linux DEPENDENCIES activesupport (~> 4) diff --git a/bin/owlapi-wrapper-1.4.1.jar b/bin/owlapi-wrapper-1.4.2.jar similarity index 90% rename from bin/owlapi-wrapper-1.4.1.jar rename to bin/owlapi-wrapper-1.4.2.jar index 1dd71029..7dd3cc48 100644 Binary files a/bin/owlapi-wrapper-1.4.1.jar and b/bin/owlapi-wrapper-1.4.2.jar differ diff --git a/lib/ontologies_linked_data/models/slice.rb b/lib/ontologies_linked_data/models/slice.rb index 65748f2e..c8e8f3c6 100644 --- a/lib/ontologies_linked_data/models/slice.rb +++ b/lib/ontologies_linked_data/models/slice.rb @@ -13,12 +13,25 @@ class Slice < LinkedData::Models::Base def self.validate_acronym(inst, attr) inst.bring(attr) if inst.bring?(attr) - value = inst.send(attr) - acronym_regex = /\A[-_a-z]+\Z/ - if (acronym_regex.match value).nil? - return [:acronym_value_validator,"The acronym value #{value} is invalid"] + acronym = inst.send(attr) + + return [] if acronym.nil? + + errors = [] + + if acronym.match(/\A[^a-z^A-Z]{1}/) + errors << [:start_with_letter, "`acronym` must start with a letter"] + end + + if acronym.match(/[^-0-9a-zA-Z]/) + errors << [:special_characters, "`acronym` must only contain the folowing characters: -, letters, and numbers"] + end + + if acronym.match(/.{17,}/) + errors << [:length, "`acronym` must be sixteen characters or less"] end - return [:acronym_value_validator, nil] + + return errors.flatten end def self.synchronize_groups_to_slices @@ -31,7 +44,7 @@ def self.synchronize_groups_to_slices slice.save if slice.valid? else slice = self.new({ - acronym: g.acronym.downcase.gsub(" ", "_"), + acronym: g.acronym.downcase.gsub(" ", "-"), name: g.name, description: g.description, ontologies: g.ontologies diff --git a/lib/ontologies_linked_data/monkeypatches/object.rb b/lib/ontologies_linked_data/monkeypatches/object.rb index deadf71c..414ab6fb 100644 --- a/lib/ontologies_linked_data/monkeypatches/object.rb +++ b/lib/ontologies_linked_data/monkeypatches/object.rb @@ -101,6 +101,7 @@ def to_flex_hash(options = {}, &block) hash, modified = embed_goo_objects_just_values(hash, k, v, options, &block) rescue Exception => e puts "Bad data found in submission: #{hash}" + puts "#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}" raise e end diff --git a/lib/ontologies_linked_data/parser/owlapi.rb b/lib/ontologies_linked_data/parser/owlapi.rb index 33a7dc4a..1a83239d 100644 --- a/lib/ontologies_linked_data/parser/owlapi.rb +++ b/lib/ontologies_linked_data/parser/owlapi.rb @@ -13,7 +13,7 @@ class RDFFileNotGeneratedException < Parser::ParserException class OWLAPICommand def initialize(input_file, output_repo, opts = {}) - @owlapi_wrapper_jar_path = LinkedData.bindir + "/owlapi-wrapper-1.4.1.jar" + @owlapi_wrapper_jar_path = LinkedData.bindir + "/owlapi-wrapper-1.4.2.jar" @input_file = input_file @output_repo = output_repo @master_file = opts[:master_file] diff --git a/test/models/test_slice.rb b/test/models/test_slice.rb index 699fb0f2..8cc243b1 100644 --- a/test/models/test_slice.rb +++ b/test/models/test_slice.rb @@ -54,7 +54,7 @@ def test_slice_lifecycle s = LinkedData::Models::Slice.new({ :name => "Test Slice", :description => "This is a test slice", - :acronym => "test_slice", + :acronym => "test-slice", :ontologies => @@onts[3..-1] }) @@ -70,6 +70,27 @@ def test_synchronization assert slices.map {|s| s.acronym}.include?(@@group_acronym) end + def test_slice_acronym_validity + s = LinkedData::Models::Slice.new({ + :name => "Test Slice", + :description => "This is a test slice", + :acronym => "test_slice", + :ontologies => @@onts[3..-1] + }) + + refute s.valid? + + s = LinkedData::Models::Slice.new({ + :name => "Test Slice", + :description => "This is a test slice", + :acronym => "test-slice", + :ontologies => @@onts[3..-1] + }) + + assert s.valid? + + end + private def self._create_group