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.
This commit is contained in:
parent
2c49931672
commit
c3d7651c82
6 changed files with 575 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue