Sha256: 8e7489922d36c95981e9aa73052b2ef1a0f24137c6586218aea5f5b9a5e97dd9
Contents?: true
Size: 901 Bytes
Versions: 4
Compression:
Stored size: 901 Bytes
Contents
module Spread2RDF module Mapping class Cell module Default def self.unit_mapping(value) @qudt ||= RDF::Graph.load File.join(ONTOLOGY_DIR, 'unit-v1.1.ttl') query = RDF::Query.new( unit: { RDF::URI.new('http://qudt.org/schema/qudt#symbol') => RDF::Literal.new(value, datatype: RDF::XSD.string) }) solutions = query.execute(@qudt) raise "unit #{value} is not unique; possible candidates: #{solutions.map(&:unit).ai}" if solutions.count > 1 raise "couldn't find a QUDT unit for unit '#{value}''" if solutions.empty? solutions.first.unit end def self.uri_normalization(string) string .gsub(' - ', '-') .gsub('- ', '-') .gsub(', ', '-') .gsub(' ', '_') end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems