diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-05-02 20:06:16 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-05-02 20:06:16 +0000 |
commit | 1d49fe0da8e7d4dfc57fdbfffdc4e32db2ef0647 (patch) | |
tree | b8418124dd391965018704986edb39858055d8e7 /lib/opentox.rb | |
parent | f8b6f8d19566d372e47edba7968ce66ff09052c9 (diff) |
initial task service
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r-- | lib/opentox.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb index 6ce439d..2682258 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -22,7 +22,8 @@ module OpenTox # Load metadata from service def pull # TODO generic method for all formats - parse_rdfxml RestClientWrapper.get(@uri,{},{:accept => $default_rdf, :subjectid => @subjectid}) + #parse_rdfxml RestClientWrapper.get(@uri,{},{:accept => $default_rdf, :subjectid => @subjectid}) + parse_ntriples RestClientWrapper.get(@uri,{},{:accept => "text/plain", :subjectid => @subjectid}) end # Get object metadata @@ -48,7 +49,7 @@ module OpenTox # Save object at service def save #TODO: dynamic assignment - post self.to_rdfxml, { :content_type => $default_rdf} + put self.to_rdfxml, { :content_type => $default_rdf} end RDF_FORMATS.each do |format| @@ -111,7 +112,7 @@ module OpenTox end def create service_uri, subjectid=nil - #uri = uri(SecureRandom.uuid) + #uri = File.join(service_uri,SecureRandom.uuid) uri = RestClientWrapper.post(service_uri, {}, {:accept => 'text/uri-list', :subjectid => subjectid}) URI.task?(service_uri) ? from_uri(uri, subjectid, false) : from_uri(uri, subjectid) end @@ -126,7 +127,7 @@ module OpenTox uri.chomp! # TODO add waiting task - if URI.task? uri and wait + if URI.task?(uri) and wait t = OpenTox::Task.new(uri) t.wait uri = t.resultURI |