Class: OpenTox::ValidationReport

Inherits:
Object
  • Object
show all
Includes:
OpenTox
Defined in:
lib/validation.rb

Instance Attribute Summary

Attributes included from OpenTox

#metadata, #uri

Class Method Summary collapse

Methods included from OpenTox

#add_metadata, all, #delete, #initialize, #load_metadata, sign_in, text_to_html, #to_rdfxml

Class Method Details

.create(validation_uri, params = {}, subjectid = nil, waiting_task = nil) ⇒ OpenTox::ValidationReport

creates a validation report via validation

Parameters:

  • validation (String)

    uri

  • params (Hash) (defaults to: {})

    addiditonal possible (min_confidence, params={}, min_num_predictions, max_num_predictions)

  • subjectid (String, optional) (defaults to: nil)
  • waiting_task (OpenTox::Task, optional) (defaults to: nil)

    (can be a OpenTox::Subtask as well), progress is updated accordingly

Returns:



239
240
241
242
243
244
245
246
247
# File 'lib/validation.rb', line 239

def self.create( validation_uri, params={}, subjectid=nil, waiting_task=nil )
  params = {} if params==nil
  raise OpenTox::BadRequestError.new "params is no hash" unless params.is_a?(Hash)
  params[:validation_uris] = validation_uri
  params[:subjectid] = subjectid
  uri = RestClientWrapper.post(File.join(CONFIG[:services]["opentox-validation"],"/report/validation"),
    params, {}, waiting_task )
  ValidationReport.new(uri)
end

.find(uri, subjectid = nil) ⇒ OpenTox::ValidationReport

finds ValidationReport via uri, raises error if not found

Parameters:

  • uri (String)
  • subjectid (String, optional) (defaults to: nil)

Returns:



215
216
217
218
219
220
# File 'lib/validation.rb', line 215

def self.find( uri, subjectid=nil )
  OpenTox::RestClientWrapper.get(uri,{:subjectid => subjectid})
  rep = ValidationReport.new(uri)
  rep.( subjectid )
  rep
end

.find_for_validation(validation_uri, subjectid = nil) ⇒ OpenTox::ValidationReport

finds ValidationReport for a particular validation

Parameters:

  • crossvalidation (String)

    uri

  • subjectid (String, optional) (defaults to: nil)

Returns:



226
227
228
229
230
# File 'lib/validation.rb', line 226

def self.find_for_validation( validation_uri, subjectid=nil )
  uris = RestClientWrapper.get(File.join(CONFIG[:services]["opentox-validation"],
    "/report/validation?validation="+validation_uri), {:subjectid => subjectid}).chomp.split("\n")
  uris.size==0 ? nil : ValidationReport.new(uris[-1])
end