summaryrefslogtreecommitdiff
path: root/lib/opentox.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-07-17 14:50:35 +0200
committerChristoph Helma <helma@in-silico.ch>2013-07-17 14:50:35 +0200
commite1ab21b21e88254b796c47c83f44d406e37f06a8 (patch)
treea98ac755c87e13981a6d39e80bbf33dff80c0420 /lib/opentox.rb
parent16414dd1acc267211b55f222c31f4a8d299f23bb (diff)
uri objects fixed in ntriples serialsiation
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r--lib/opentox.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index 87b241a..5e0bc29 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -233,6 +233,7 @@ module OpenTox
end
def self.find_or_create metadata
+ t = Time.now
sparql = "SELECT DISTINCT ?s WHERE { "
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)
@@ -248,11 +249,19 @@ module OpenTox
end
end
sparql << "}"
+ puts "Create SPARQL: #{Time.now-t}"
+ t = Time.new
uris = RestClientWrapper.get(service_uri,{:query => sparql},{:accept => "text/uri-list"}).split("\n")
+ puts "Query: #{Time.now-t}"
+ t = Time.new
if uris.empty?
- self.create metadata
+ f=self.create metadata
+ puts "Create: #{Time.now-t}"
+ f
else
- self.new uris.first
+ f=self.new uris.first
+ puts "Found: #{Time.now-t}"
+ f
end
end
end