Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-implement PR#55, fix for remote ontology pull with gzipped submissions #73

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions lib/ncbo_cron/ontology_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,39 +101,27 @@ def self.create_submission(ont, sub, file, filename, logger = nil, add_to_queue
new_sub.submissionStatus = nil
new_sub.creationDate = nil
new_sub.missingImports = nil
new_sub.masterFileName = nil
new_sub.metrics = nil
full_file_path = File.expand_path(file_location)

# check if OWLAPI is able to parse the file before creating a new submission
owlapi = LinkedData::Parser::OWLAPICommand.new(
full_file_path,
File.expand_path(new_sub.data_folder.to_s),
logger: logger)
owlapi.disable_reasoner
parsable = true

begin
owlapi.parse
rescue Exception => e
logger.error("The new file for ontology #{ont.acronym}, submission id: #{submission_id} did not clear OWLAPI: #{e.class}: #{e.message}\n#{e.backtrace.join("\n\t")}")
logger.error("A new submission has NOT been created.")
logger.flush
parsable = false
end

if parsable
if new_sub.parsable?(logger: logger)
if new_sub.valid?
new_sub.save()
new_sub.save

if add_to_queue
self.queue_submission(new_sub, { all: true })
queue_submission(new_sub, { all: true })
logger.info("OntologyPull created a new submission (#{submission_id}) for ontology #{ont.acronym}")
end
else
logger.error("Unable to create a new submission for ontology #{ont.acronym} with id #{submission_id}: #{new_sub.errors}")
logger.flush
end
else
logger.error("The new file for ontology #{ont.acronym}, submission id: #{submission_id} did not clear OWLAPI: #{e.class}: #{e.message}\n#{e.backtrace.join("\n\t")}")
logger.error("A new submission has NOT been created.")
logger.flush
# delete the bad file
File.delete full_file_path if File.exist? full_file_path
end
Expand Down Expand Up @@ -182,4 +170,4 @@ def self.new_file_exists?(file, last)

end
end
end
end
Loading