summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2011-05-23 14:09:52 +0000
committerChristoph Helma <helma@in-silico.ch>2011-05-23 14:09:52 +0000
commita3d2867681dd728fdf88039b9b29ca6d5d8a7097 (patch)
tree116edbeec9330aa04de387d8ac3a6b068dee2b06
parentb7c063f7c256003e2e67ed0a626403de15f01a9b (diff)
owl-dl fixed for model and prediction datasets
-rw-r--r--lazar.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lazar.rb b/lazar.rb
index d297ccf..7a1494a 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -7,7 +7,8 @@ get '/:id/?' do
case @accept
when /application\/rdf\+xml/
s = OpenTox::Serializer::Owl.new
- s.add_model(@uri,YAML.load_file(@yaml_file).metadata)
+ metadata = YAML.load_file(@yaml_file).metadata
+ s.add_model(@uri,metadata)
s.to_rdfxml
when /yaml/
File.read @yaml_file
@@ -20,6 +21,7 @@ end
get '/:id/metadata.?:ext?' do
halt 404, "Model #{params[:id]} not found." unless File.exists? @yaml_file
+ @accept = "application/x-yaml" if params[:ext] and params[:ext].match?(/yaml/)
metadata = YAML.load_file(@yaml_file).metadata
case @accept
when /yaml/
@@ -31,8 +33,9 @@ get '/:id/metadata.?:ext?' do
end
end
-get '/:id/dependent' do
+get '/:id/dependent.?:ext?' do
halt 404, "Model #{params[:id]} not found." unless File.exists? @yaml_file
+ @accept = "application/x-yaml" if params[:ext].match?(/yaml/)
feature_uri = YAML.load_file(@yaml_file).metadata[OT.dependentVariables]
case @accept
when /yaml/
@@ -48,8 +51,9 @@ get '/:id/dependent' do
end
end
-get '/:id/predicted' do
+get '/:id/predicted.?:ext?' do
halt 404, "Model #{params[:id]} not found." unless File.exists? @yaml_file
+ @accept = "application/x-yaml" if params[:ext].match?(/yaml/)
return feature_uri if @accept == "text/uri-list"
predicted = OpenTox::Feature.new(File.join @uri,"predicted")
dependent = OpenTox::Feature.find(YAML.load_file(@yaml_file).metadata[OT.dependentVariables])