diff options
author | Martin Gütlein <martin.guetlein@gmail.com> | 2010-03-30 16:44:22 +0200 |
---|---|---|
committer | Martin Gütlein <martin.guetlein@gmail.com> | 2010-03-30 16:44:22 +0200 |
commit | 483b89ab23449372582e8754b3b9b481d338654f (patch) | |
tree | fd8c16c86c5bce679499a86b3bb11bc1424684f0 /lib | |
parent | 5465f726b972c0c5430cce958a220bc0736f1bdc (diff) |
munich services
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dataset.rb | 2 | ||||
-rw-r--r-- | lib/model.rb | 3 | ||||
-rw-r--r-- | lib/owl.rb | 10 | ||||
-rw-r--r-- | lib/utils.rb | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb index 70edf1c..ee92a56 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -15,7 +15,7 @@ module OpenTox def self.find(uri) if uri.match(/webservices.in-silico.ch|localhost|ot.dataset.de|opentox.informatik.uni-freiburg.de/) # try to get YAML first - d = YAML.load RestClient.get(uri, :accept => 'application/x-yaml').to_s + d = YAML.load RestClientWrapper.get(uri, :accept => 'application/x-yaml').to_s else # get default rdf+xml owl = OpenTox::Owl.from_uri(uri) diff --git a/lib/model.rb b/lib/model.rb index 1f5f27d..5ca3914 100644 --- a/lib/model.rb +++ b/lib/model.rb @@ -56,6 +56,7 @@ module OpenTox redirect += line.chomp end end + raise "TASK ERROR" if $?!=0 sleep 0.3 end uri = redirect @@ -93,7 +94,7 @@ module OpenTox return true elsif @uri =~/ntua/ and @title =~ /mlr/ return false - elsif @uri =~/tu-muenchen/ and @title =~ /regression/ + elsif @uri =~/tu-muenchen/ and @title =~ /regression|M5P|GaussP/ return false else raise "unknown model, uri:'"+@uri.to_s+"' title:'"+@title.to_s+"'" @@ -160,7 +160,7 @@ module OpenTox value = true when FALSE_REGEXP # defined in environment.rb value = false - when /.*\^\^<.*XMLSchema#.*>/ + when /.*\^\^<.*XMLSchema#.*>/ #HACK for reading ambit datasets case value.to_s when /XMLSchema#string/ @@ -174,7 +174,13 @@ module OpenTox else LOGGER.warn compound_uri + " has value '" + value.to_s + "' for feature " + feature_uri value = nil - end + end + LOGGER.debug "converting owl to yaml, #compounds: "+(data.keys.size+1).to_s if (data.keys.size+1)%10==0 && !data.has_key?(compound_uri) + #return data if (data.keys.size+1)%2==0 && !data.has_key?(compound_uri) + #puts "c "+compound_uri.to_s + #puts "f "+feature_uri.to_s + #puts "v "+value.to_s + #puts "" data[compound_uri] = [] unless data[compound_uri] data[compound_uri] << {feature_uri => value} unless value.nil? elsif type == OT['Tuple'] diff --git a/lib/utils.rb b/lib/utils.rb index ed35563..a31e405 100644 --- a/lib/utils.rb +++ b/lib/utils.rb @@ -52,7 +52,7 @@ end rescue RestClient::RequestFailed, RestClient::RequestTimeout => ex do_halt 502,ex.message,uri,payload,headers rescue SocketError, RestClient::ResourceNotFound => ex - do_halt 400,"X"+ex.message,uri,payload,headers + do_halt 400,ex.message,uri,payload,headers rescue Exception => ex do_halt 500,"add error '"+ex.class.to_s+"'' to rescue in OpenTox::RestClientWrapper::execute(), msg: '"+ex.message.to_s+"'",uri,payload,headers end |