diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-03-07 13:51:45 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-03-07 13:51:45 +0100 |
commit | 2e3db6f6532ded28dfada22d4445038b79271814 (patch) | |
tree | 89361d4f66daf70767d4bf45a185e2f237a4aafc | |
parent | 7588adffdbd48a73d8b22be2379a5afee79e5bea (diff) |
actor for error reports, turtle output for error reports
-rw-r--r-- | lib/error.rb | 13 | ||||
-rw-r--r-- | lib/opentox.rb | 9 | ||||
-rw-r--r-- | lib/overwrite.rb | 1 |
3 files changed, 19 insertions, 4 deletions
diff --git a/lib/error.rb b/lib/error.rb index 81ec979..90b55e3 100644 --- a/lib/error.rb +++ b/lib/error.rb @@ -93,9 +93,18 @@ module OpenTox #report.rdf << [subject, OT.errorCause, error.report] if error.respond_to?(:report) and !error.report.empty? report end + + def actor=(uri) + # TODO: test actor assignement (in opentox-server) + subject = RDF::Query.execute(@rdf) do + pattern [:subject, RDF.type, RDF::OT.ErrorReport] + end.limit(1).select(:subject) + }) + @rdf << [subject, RDF::OT.actor, uri] + end # define to_ and self.from_ methods for various rdf formats - [:rdfxml,:ntriples].each do |format| + [:rdfxml,:ntriples,:turtle].each do |format| define_singleton_method "from_#{format}".to_sym do |rdf| report = ErrorReport.new @@ -116,7 +125,7 @@ module OpenTox end end - # overwrite backtick operator to catch system errors +# overwrite backtick operator to catch system errors class Object def `(code) msg = super("#{code} 2>&1").chomp diff --git a/lib/opentox.rb b/lib/opentox.rb index 10c7895..566c458 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -2,10 +2,15 @@ RDF::OT = RDF::Vocabulary.new 'http://www.opentox.org/api/1.2#' RDF::OT1 = RDF::Vocabulary.new 'http://www.opentox.org/api/1.1#' RDF::OTA = RDF::Vocabulary.new 'http://www.opentox.org/algorithmTypes.owl#' + SERVICES = ["Compound", "Feature", "Dataset", "Algorithm", "Model", "Validation", "Task", "Investigation"] -# defaults to stderr, may be changed to file output -$logger = OTLogger.new(STDERR) # no rotation +# Regular expressions for parsing classification data +TRUE_REGEXP = /^(true|active|1|1.0|tox|activating|carcinogen|mutagenic)$/i +FALSE_REGEXP = /^(false|inactive|0|0.0|low tox|deactivating|non-carcinogen|non-mutagenic)$/i + +# defaults to stderr, may be changed to file output (e.g in opentox-service) +$logger = OTLogger.new(STDERR) $logger.level = Logger::DEBUG module OpenTox diff --git a/lib/overwrite.rb b/lib/overwrite.rb index e883d45..f0dcda9 100644 --- a/lib/overwrite.rb +++ b/lib/overwrite.rb @@ -35,5 +35,6 @@ module URI rescue URI::InvalidURIError false end + end |