Skip to content

Commit

Permalink
Fix: the lexvo language validator to no check the iso version (#112)
Browse files Browse the repository at this point in the history
* update the lexvo language validator to no check the iso version
  • Loading branch information
syphax-bouazzouni authored Nov 13, 2023
1 parent 7d16b7b commit 4c7dfa8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 42 deletions.
29 changes: 14 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ GEM
public_suffix (>= 2.0.2, < 6.0)
ansi (1.5.0)
ast (2.4.2)
base64 (0.1.1)
bcrypt (3.1.19)
builder (3.2.4)
coderay (1.1.3)
Expand All @@ -46,7 +45,7 @@ GEM
rexml
cube-ruby (0.0.3)
daemons (1.4.1)
date (3.3.3)
date (3.3.4)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
Expand Down Expand Up @@ -94,7 +93,7 @@ GEM
launchy (2.5.2)
addressable (~> 2.8)
libxml-ruby (2.9.0)
logger (1.5.3)
logger (1.6.0)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.8.1)
Expand All @@ -116,12 +115,12 @@ GEM
multi_json (1.15.0)
multipart-post (2.3.0)
net-http-persistent (2.9.4)
net-imap (0.4.1)
net-imap (0.4.4)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-protocol
Expand All @@ -141,17 +140,17 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.3)
racc (1.7.1)
racc (1.7.3)
rack (1.6.13)
rack-test (0.8.3)
rack (>= 1.0, < 3)
rainbow (3.1.1)
rake (10.5.0)
rdf (1.0.8)
addressable (>= 2.2)
redis (5.0.7)
redis-client (>= 0.9.0)
redis-client (0.17.0)
redis (5.0.8)
redis-client (>= 0.17.0)
redis-client (0.18.0)
connection_pool
regexp_parser (2.8.2)
request_store (1.5.1)
Expand All @@ -164,8 +163,7 @@ GEM
rexml (3.2.6)
rsolr (1.1.2)
builder (>= 2.1.2)
rubocop (1.57.1)
base64 (~> 0.1.1)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -176,7 +174,7 @@ GEM
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand All @@ -198,11 +196,11 @@ GEM
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thread_safe (0.3.6)
timeout (0.4.0)
timeout (0.4.1)
tzinfo (0.3.62)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unf_ext (0.0.9)
unicode-display_width (2.5.0)
uuid (2.3.9)
macaddr (~> 1.0)
Expand All @@ -213,6 +211,7 @@ GEM

PLATFORMS
x86_64-darwin-21
x86_64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down Expand Up @@ -249,4 +248,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.3.26
2.4.21
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def is_person(inst, attr)
def lexvo_language(inst, attr)
values = Array(attr_value(inst, attr))

return if values.all? { |x| x&.to_s&.start_with?('http://lexvo.org/id/iso639-3') }
return if values.all? { |x| x&.to_s&.start_with?('http://lexvo.org/id/iso') }

[:lexvo_language, "#{attr} values need to be in the lexvo namespace (e.g http://lexvo.org/id/iso639-3/fra)"]
[:lexvo_language, "#{attr} values need to be in the lexvo namespace (e.g http://lexvo.org/id/iso639-1/fr)"]
end

def deprecated_retired_align(inst, attr)
Expand Down
25 changes: 0 additions & 25 deletions lib/ontologies_linked_data/models/agents/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,6 @@ class Agent < LinkedData::Models::Base
write_access :creator
access_control_load :creator

def usages
id = self.id
q = Goo.sparql_query_client.select(:id, :property, :status).distinct
.from(LinkedData::Models::OntologySubmission.uri_type)
.where(
[:id,
RDF::URI.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
LinkedData::Models::OntologySubmission.uri_type
],
[:id,
LinkedData::Models::OntologySubmission.attribute_uri(:submissionStatus),
:status
]
)

q = q.union([[:id, :property, id]])
q.filter("?status = <#{RDF::URI.new(LinkedData::Models::SubmissionStatus.id_prefix + 'RDF')}> || ?status = <#{RDF::URI.new(LinkedData::Models::SubmissionStatus.id_prefix + 'UPLOADED')}>")
data = q.each_solution.map { |x| [x[:id], x[:property], x[:status]] }
data = data.group_by(&:shift)
data.transform_values do |values|
r = values.select { |value| value.last['RDF'] }
r = values.select { |value| value.last['UPLOADED'] } if r.empty?
r.map(&:first)
end
end

def self.load_agents_usages(agents = [])
is_a = RDF::URI.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type')
Expand Down

0 comments on commit 4c7dfa8

Please sign in to comment.