summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2012-10-31 15:33:56 +0100
committerAndreas Maunz <andreas@maunz.de>2012-10-31 15:33:56 +0100
commitb1cc6d277c8c631a7ab54c6b8b654f7a1e05a88c (patch)
treed647fd4c75e9ade36c454fea554298a9416748b9
parentdfe5b9523a18dbb86bab433df8136166c9938d12 (diff)
Fixing allnde (params) and URL rewrite for dataset from RDF
-rw-r--r--application.rb2
-rw-r--r--webapp/dataset.rb3
2 files changed, 2 insertions, 3 deletions
diff --git a/application.rb b/application.rb
index 2d54eb2..a54a443 100644
--- a/application.rb
+++ b/application.rb
@@ -496,7 +496,7 @@ module OpenTox
get '/dataset/:id/allnde' do
case @accept
when "application/rdf+xml", "text/turtle", "text/plain"
- sparql = "CONSTRUCT {?s ?p ?o.} FROM <#{@uri}> WHERE { { ?s ?p ?o. <#{@uri}> ?p ?o. } UNION { ?s ?p ?o. ?s <#{RDF.type}> <#{RDF::OT.Feature}> } UNION { ?s ?p ?o. ?s <#{RDF.type}> <#{RDF::OT.Compound}> } }"
+ sparql = "CONSTRUCT {?s ?p ?o.} FROM <#{@uri}> WHERE { { ?s ?p ?o. <#{@uri}> ?p ?o. } UNION { ?s ?p ?o. ?s <#{RDF.type}> <#{RDF::OT.Feature}> } UNION { ?s ?p ?o. ?s <#{RDF.type}> <#{RDF::OT.Compound}> } UNION { ?s ?p ?o. ?s <#{RDF.type}> <#{RDF::OT.Parameter}> }}"
else
bad_request_error "'#{@accept}' is not a supported content type."
end
diff --git a/webapp/dataset.rb b/webapp/dataset.rb
index 21b6ae9..c75b722 100644
--- a/webapp/dataset.rb
+++ b/webapp/dataset.rb
@@ -95,7 +95,7 @@ module OpenTox
ds=OpenTox::Dataset.find("#{$dataset[:uri]}/#{dataset}",@subjectid)
ds.compounds.each { |cmpd|
ds_string = RestClient.post("#{$compound[:uri]}/#{cmpd.inchi}/pc", params, {:accept => "application/rdf+xml"})
- single_cmpd_ds = OpenTox::Dataset.new(nil,@subjectid)
+ single_cmpd_ds = OpenTox::Dataset.new(OpenTox::Dataset.uri_from_rdf(ds_string),@subjectid)
single_cmpd_ds.parse_rdfxml(ds_string)
single_cmpd_ds.get(true)
unless result_ds.features.size>0 # features present already?
@@ -104,7 +104,6 @@ module OpenTox
val = single_cmpd_ds.find_parameter_value(key)
{ DC.title => key, OT.paramValue => (val.nil? ? "" : val) }
}
- result_ds[RDF.type] = single_cmpd_ds[RDF.type] # AM: metadata
result_ds[DC.title] = single_cmpd_ds[DC.title]
result_ds[DC.creator] = url_for("/dataset/#{dataset}/pc",:full)
result_ds[OT.hasSource] = url_for("/dataset/#{dataset}/pc",:full)