From e1ab21b21e88254b796c47c83f44d406e37f06a8 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 17 Jul 2013 14:50:35 +0200 Subject: uri objects fixed in ntriples serialsiation --- lib/opentox.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/opentox.rb') 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 -- cgit v1.2.3