Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Nov 8, 2023
2 parents 32e93d5 + 9487c7f commit c391037
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
12 changes: 4 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Binary file not shown.
25 changes: 19 additions & 6 deletions lib/ontologies_linked_data/models/slice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/ontologies_linked_data/monkeypatches/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/ontologies_linked_data/parser/owlapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
23 changes: 22 additions & 1 deletion test/models/test_slice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
})

Expand All @@ -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
Expand Down

0 comments on commit c391037

Please sign in to comment.