diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/yaml2owl.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/yaml2owl.rb b/bin/yaml2owl.rb new file mode 100755 index 0000000..b259ad1 --- /dev/null +++ b/bin/yaml2owl.rb @@ -0,0 +1,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.source = 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} |