helpers/ontology_helper.rb
##
# Create a new OntologySubmission object based on the request data
Create a new OntologySubmission object based on the request data
Create a new OntologySubmission object based on the request data
def create_submission(ont)
        params = @params
        submission_id = ont.next_submission_id
        ont_submission = instance_from_params(OntologySubmission, params)
        ont_submission.ontology = ont
        ont_submission.submissionId = submission_id
        add_file_to_submission(ont, ont_submission)
        if ont_submission.hasOntologyLanguage.nil?
          error 422, "You must specify the ontology format using the `hasOntologyLanguage` parameter" if params["hasOntologyLanguage"].nil? || params["hasOntologyLanguage"].empty?
          ont_submission.hasOntologyLanguage = OntologyFormat.find(params["hasOntologyLanguage"]).first
        end
        if ont_submission.valid?
          ont_submission.save
          cron = NcboCron::Models::OntologySubmissionParser.new
          cron.queue_submission(ont_submission, {all: true, params: params})
        else
          error 400, ont_submission.errors
        end
        ont_submission
      end
def create_submission ( ont ) params = @params submission_id = ont . next_submission_id ont_submission = instance_from_params ( OntologySubmission , params ) ont_submission . ontology = ont ont_submission . submissionId = submission_id add_file_to_submission ( ont , ont_submission ) if ont_submission . hasOntologyLanguage . nil? error 422 , "You must specify the ontology format using the `hasOntologyLanguage` parameter" if params [ "hasOntologyLanguage" ] . nil? || params [ "hasOntologyLanguage" ] . empty? ont_submission . hasOntologyLanguage = OntologyFormat . find ( params [ "hasOntologyLanguage" ] ) . first end if ont_submission . valid? ont_submission . save cron = NcboCron :: Models :: OntologySubmissionParser . new cron . queue_submission ( ont_submission , { all : true , params : params } ) else error 400 , ont_submission . errors end ont_submission end
Create a new OntologySubmission object based on the request data
Create a new OntologySubmission object based on the request data
# Create OntologySubmission # Get file info # Add new format if it doesn't exist # Check if the naturalLanguage provided is a valid ISO-639-1 code (not used anymore, we let lexvo URI) =begin
        if !ont_submission.naturalLanguage.nil?
          if ISO_LANGUAGE_LIST.has_key?(ont_submission.naturalLanguage.downcase)
            ont_submission.naturalLanguage = ont_submission.naturalLanguage.downcase
          else
            error 422, "You must specify a valid 2 digits language code (ISO-639-1) for naturalLanguage"
          end
        end
=end
ont
<not_specific>