Skip to content

Commit

Permalink
fix: ontology importer miss type
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Jun 6, 2024
1 parent e15e218 commit 6bb53a1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bin/ncbo_ontology_import
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def create_ontology(ont_info)
has_domains << category if category
end

new_ontology.groups = groups
new_ontology.group = groups
new_ontology.hasDomain = has_domains
new_ontology
end
Expand All @@ -106,6 +106,10 @@ def upload_submission(sub_info, ontology)
sub_info['pullLocation'] = "#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}"
end

if sub_info['URI'].blank?
sub_info['URI'] = "#{sub_info['id']}"
end

# Build the json body
# hasOntologyLanguage options: OWL, UMLS, SKOS, OBO
# status: alpha, beta, production, retired
Expand All @@ -128,12 +132,16 @@ def upload_submission(sub_info, ontology)
attribute_settings = new_submission.class.attribute_settings(key.to_sym)

if attribute_settings
if attribute_settings[:enforce]&.include?(:date_time)
value = DateTime.parse(value)
if attribute_settings[:enforce]&.include?(:date_time) && attribute_settings[:enforce]&.include?(:list)
value = value.map { |v| DateTime.parse(v) rescue DateTime.now }.uniq
elsif attribute_settings[:enforce]&.include?(:date_time)
value = DateTime.parse(value) rescue DateTime.now
elsif attribute_settings[:enforce]&.include?(:uri) && attribute_settings[:enforce]&.include?(:list)
value = value.map { |v| RDF::IRI.new(v) }
elsif attribute_settings[:enforce]&.include?(:uri)
value = RDF::IRI.new(value)
elsif attribute_settings[:enforce]&.include?(:Agent)
next #TODO implement agent auto-creation
end
end

Expand Down

0 comments on commit 6bb53a1

Please sign in to comment.