27 lines
925 B
Ruby
Executable file
27 lines
925 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
require_relative 'database'
|
|
require_relative 'vocabularies'
|
|
require_relative 'migrants'
|
|
|
|
output = File.open(File.join('data', 'organisations.ttl'), 'w')
|
|
|
|
output.puts prefixes(:rdfs, :tm, :schema, :location, :organisation)
|
|
output.puts
|
|
|
|
DB[:organisation].each do |row|
|
|
id = row[:IDOrganisation]
|
|
props = ["a schema:Organization"]
|
|
|
|
props << "schema:name #{ttl_literal(row[:inst_name])}" unless row[:inst_name].to_s.empty?
|
|
props << "tm:institutionType #{ttl_literal(row[:InstType])}" unless row[:InstType].to_s.empty?
|
|
props << "schema:location location:#{row[:IDLocation]}" unless row[:IDLocation].to_s.empty?
|
|
props << "rdfs:comment #{ttl_literal(row[:comment])}" unless row[:comment].to_s.empty?
|
|
|
|
output.puts "organisation:#{id} #{props.first} ;"
|
|
props[1..-2].each { |p| output.puts " #{p} ;" }
|
|
output.puts " #{props.last} ."
|
|
output.puts
|
|
end
|
|
|
|
output.close
|