summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2014-11-05 16:44:54 +0100
committerrautenberg <rautenberg@in-silico.ch>2014-11-05 16:44:54 +0100
commit4dddb1e7a8166fbca382d5d312aa9e6fb5bb1c25 (patch)
treec3f46b097e47d299aaa963a2360530a43fb25c1d
parent7963fa05c510b3e503e04ce91d2cb1246e11a9b2 (diff)
parent9fc686c9f1dbf6155a95d6a9c884bc9eb531c797 (diff)
Merge branch 'development' of github.com:opentox/opentox-client into development
-rw-r--r--lib/opentox.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index 16cecca..9564e9c 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -244,14 +244,18 @@ module OpenTox
def self.find_or_create metadata
t = Time.now
sparql = "SELECT DISTINCT ?s WHERE { "
+ # flatten 3.level arrays in objects
+ metadata.each{|p,o| o.flatten! if o.is_a? Array}
metadata.each do |predicate,objects|
unless [RDF::DC.date,RDF::DC.modified,RDF::DC.description].include? predicate # remove dates and description (strange characters in description may lead to SPARQL errors)
if objects.is_a? String
- URI.valid?(objects) ? o = "<#{objects}>" : o = "'''#{objects}'''"
+ #URI.valid?(objects) ? o = "<#{objects}>" : o = "'''#{objects}'''" #DG: do not understand this quotation
+ URI.valid?(objects) ? o = "<#{objects}>" : o = "\"#{objects}\""
sparql << "?s <#{predicate}> #{o}. "
elsif objects.is_a? Array
objects.each do |object|
- URI.valid?(object) ? o = "<#{object}>" : o = "'#{object}'"
+ #URI.valid?(object) ? o = "<#{object}>" : o = "'#{object}'" #DG: do not understand this quotation
+ URI.valid?(object) ? o = "<#{object}>" : o = "\"#{object}\""
sparql << "?s <#{predicate}> #{o}. "
end
end