rake_helper.rb revision 97669a2ab79fef55a04bd6f0e51267e5119ddab7
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa user = User.find_by_email! email unless email.nil?
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa LogicgraphParser.parse(File.open(File.join(dir, 'LogicGraph.xml')),
bc9e15ca07956db262187916be61f3567167e1c6Eugen Kuksa symbol.user = user if symbol.has_attribute? "user_id"
bc9e15ca07956db262187916be61f3567167e1c6Eugen Kuksa puts "Validation-Error: #{e.record} (#{e.message})"
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa download_from_ontohub_meta('proof_statuses.owl', 'proof_statuses.owl')
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa puts "Could not create symbol tree for: #{ontology.name} (#{ontology.id}) caused #{e}"
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa #cleaning up to prevent duplicated symbol_groups
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa puts "Could not create entity tree for: #{ontology.name} (#{ontology.id}) caused #{e}"
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa Settings.formality_levels.each { |t| update_or_create_by_name(FormalityLevel, t.to_h) }
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa Settings.license_models.each { |t| update_or_create_by_name(LicenseModel, t.to_h) }
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa Settings.ontology_types.each { |t| update_or_create_by_name(OntologyType, t.to_h) }
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa Settings.tasks.each { |t| update_or_create_by_name(Task, t.to_h) }
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa first_or_create!(description: 'Meta ontologies for Ontohub')
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa def self.download_from_ontohub_meta(source_file, target_file)
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa filepath = "#{Rails.root}/spec/fixtures/seeds/#{target_file}"
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa "https://ontohub.org/repositories/meta/master/download/#{source_file}"
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa temp_file = Tempfile.new([target_file, File.extname(target_file)]).path
994db9f9453a462e4235246a79f9a7fd2769a93fEugen Kuksa puts 'No connection to ontohub.org. Using local file for the current task.'
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksa save_file(filepath, basename, "Add #{basename}.", user, do_parse: false)