diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-03-14 11:44:53 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-03-14 11:44:53 +0000 |
commit | 1652bc3f3e635948fc3a73817f407adc6dee071a (patch) | |
tree | f62d525dae20a7e6178e259646cb5266450f4031 /lib/opentox.rb | |
parent | 99a1045502cabe4b39ebd1943bf46a7fcd42f128 (diff) |
metadata methods fixed
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r-- | lib/opentox.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb index 0d88eaa..9493362 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -31,10 +31,10 @@ module OpenTox pull if @rdf.empty? metadata = {} @rdf.query([RDF::URI.new(@uri),nil,nil]).collect do |statement| - metadata[statement.predicate.to_s] ||= [] - metadata[statement.predicate.to_s] << statement.object.to_s + metadata[statement.predicate] ||= [] + metadata[statement.predicate] << statement.object end - metadata + metadata.each{|k,v| metadata[k] = v.first if v.size == 1} end # Get metadata values @@ -42,7 +42,7 @@ module OpenTox # @return [Array] Values for supplied key def [](key) pull if @rdf.empty? - result = @rdf.query([RDF::URI.new(@uri),key,nil]).collect{|statement| statement.object.to_s} + result = @rdf.query([RDF::URI.new(@uri),key,nil]).collect{|statement| statement.object} result.size == 1 ? result.first : result end |