summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2012-10-23 13:54:09 +0200
committerAndreas Maunz <andreas@maunz.de>2012-10-23 13:54:09 +0200
commitbfacb73e0aacc45cef60834882ca8688337485c8 (patch)
tree32cb3916addc7ba53aedddda8d3cad154f3225a3
parent9c741a94ff18f046e71f3134ab270df30ec37de5 (diff)
Fixed metadata filling find_by_title
-rw-r--r--lib/utils/shims/feature.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/utils/shims/feature.rb b/lib/utils/shims/feature.rb
index 1c11f40..df39829 100644
--- a/lib/utils/shims/feature.rb
+++ b/lib/utils/shims/feature.rb
@@ -23,8 +23,9 @@ module OpenTox
# @param[Hash] metadata Feature metadata
# @return [OpenTox::Feature] Feature object with the full data, or nil
def self.find_by_title(title, metadata)
- metadata[RDF.type] << RDF::OT.Feature unless (metadata[RDF.type] and metadata[RDF.type].include?(RDF::OT.Feature))
- metadata[RDF::DC.title] = title unless (metadata[RDF::DC.title] and metadata[RDF::DC.title].include?(title))
+ metadata[RDF.type] = [] unless metadata[RDF.type]
+ metadata[RDF.type] << RDF::OT.Feature unless metadata[RDF.type].include?(RDF::OT.Feature)
+ metadata[RDF::DC.title] = title unless (metadata[RDF::DC.title])
feature = feature_new = OpenTox::Feature.new File.join($feature[:uri], SecureRandom.uuid), @subjectid
feature_new.metadata = metadata
sparql = "SELECT DISTINCT ?feature WHERE { ?feature <#{RDF.type}> <#{RDF::OT['feature'.capitalize]}>. ?feature <#{RDF::DC.title}> '#{title.to_s}' }"