diff options
author | Andreas Maunz <andreas@maunz.de> | 2012-09-07 16:50:22 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2012-09-07 16:50:22 +0200 |
commit | 5699010b993a84e6a885dd0c22403fe5221ab597 (patch) | |
tree | 3fce28388c9b33eebb37caf0b114f5f482509517 /application.rb | |
parent | 921810f6ba002e58755214cafec97d124b8fd1f2 (diff) |
Triggering algorithm
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/application.rb b/application.rb index 52475dc..b3682bc 100644 --- a/application.rb +++ b/application.rb @@ -5,6 +5,8 @@ module OpenTox post "/model/:id/?" do + bad_request_error "No compound URI provided" unless params[:compound_uri] + # Read turtle rdfstr = FourStore.get(@uri, "text/turtle") graph = RDF::Graph.new @@ -21,13 +23,14 @@ module OpenTox res = query.execute(graph) # Gather hash - params = res.inject({}) { |h,p| + m_params = res.inject({}) { |h,p| h[p.name.to_s] = p.value.to_s h } + m_params[:compound_uri] = params[:compound_uri] # Make prediction - RestClientWrapper.post File.join($algorithm[:uri],"lazar","predict"), params + RestClientWrapper.post File.join($algorithm[:uri],"lazar","predict"), m_params end end |