summaryrefslogtreecommitdiff
path: root/lib/opentox-client.rb
blob: 276d378e153c05a84b8416992d04f40ddcad6354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'rubygems'
require "bundler/setup"
require 'rdf'
require 'rdf/raptor'
require 'rdf/n3'
require "rest-client"
require 'uri'
require 'yaml'
require 'json'
require 'logger'
require "securerandom"

# define constants and global variables
#TODO: switch services to 1.2
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#'
RDF::OLO =  RDF::Vocabulary.new 'http://purl.org/ontology/olo/core#'

CLASSES = ["Generic", "Compound", "Feature", "Dataset", "Algorithm", "Model", "Validation", "Task", "Investigation"]
RDF_FORMATS = [:rdfxml,:ntriples,:turtle]

# 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

[
  "overwrite.rb",
  "error.rb",
  "rest-client-wrapper.rb", 
  "authorization.rb", 
  "policy.rb", 
  "otlogger.rb", 
  "opentox.rb",
  "task.rb",
  "compound.rb",
  "dataset.rb",
  "model.rb",
].each{ |f| require File.join(File.dirname(__FILE__),f) }