summaryrefslogtreecommitdiff
path: root/bin/yaml2owl.rb
blob: 10029125ffe6694bd1f6ce321cead3c6b2c3a710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
require 'rubygems'
require 'opentox-ruby-api-wrapper'

input = YAML.load_file(ARGV[0])
dataset = OpenTox::Dataset.new
dataset.title = input[:title]
dataset.creator = input[:source]
input[:data].each do |c,f|
	f.each do |k,v|
		v.each do |value|
			dataset.add c,k,value
		end
	end
end
outfile = File.expand_path(File.join(File.dirname(__FILE__),ARGV[0].sub(/yaml/,'owl')))
dataset.uri = outfile
File.open(outfile,'w+'){|f| f.puts dataset.rdf}