vivo/utilities/languageSupport/translateLabelsInOntology/label_common.rb
j2blake c3d7651c82 VIVO-75 Ruby scripts to help with good-enough translation.
One set will take an ontology file, extract the labels for Google translation, and create RDF for those translated labels. The other set does the same for a properties file.
2013-06-11 13:03:03 -04:00

33 lines
No EOL
946 B
Ruby

#!/usr/bin/ruby
=begin
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
=end
require 'rubygems'
require 'rdf'
require 'rdf/rdfxml'
require 'rdf/ntriples'
include RDF
class LabelCommon
# ------------------------------------------------------------------------------------
private
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
public
# ------------------------------------------------------------------------------------
def initialize(rdf_file, &filter)
@filter = filter.nil? ? lambda{true} : filter
@graph = Graph.load(rdf_file)
end
def process(query, &filter)
solutions = query.execute(@graph)
solutions.filter!(&filter)
solutions.order(:prop)
end
end