diff options
author | Christoph Helma <helma@in-silico.ch> | 2013-01-23 12:53:43 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2013-01-23 12:53:43 +0100 |
commit | 147e1b7351975f19697e1e6ff4a6106fd38174ae (patch) | |
tree | bfae2caf360efdc9631a376f4341a9b9c3ecbf7b | |
parent | cc8dfb6c1344c2d37fafa932ac945468cbd00b2a (diff) |
url_for removed
auto insertion of RDF::DC.modified
-rw-r--r-- | Gemfile.lock | 12 | ||||
-rw-r--r-- | lib/4store.rb | 10 | ||||
-rw-r--r-- | lib/compound.rb | 4 | ||||
-rw-r--r-- | lib/opentox.rb | 2 | ||||
-rw-r--r-- | lib/utils/html.rb | 2 |
5 files changed, 16 insertions, 14 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 345faf2..f778e78 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,16 +13,16 @@ GEM remote: http://rubygems.org/ specs: addressable (2.3.2) - ffi (1.1.5) + ffi (1.3.1) mime-types (1.19) open4 (1.3.0) - rdf (0.3.8) + rdf (0.3.11.1) addressable (>= 2.2.6) - rdf-n3 (0.3.7) - rdf (>= 0.3.4) - rdf-raptor (0.4.1) + rdf-n3 (0.3.8) + rdf (>= 0.3.11) + rdf-raptor (0.4.2) ffi (>= 1.0) - rdf (~> 0.3.0) + rdf (~> 0.3.8) rest-client (1.6.7) mime-types (>= 1.16) diff --git a/lib/4store.rb b/lib/4store.rb index c9947a7..32d8817 100644 --- a/lib/4store.rb +++ b/lib/4store.rb @@ -29,6 +29,7 @@ module OpenTox mime_type = "application/x-turtle" if mime_type == "text/plain" # ntriples is turtle in 4store begin RestClient.post File.join(four_store_uri,"data")+"/", :data => rdf, :graph => uri, "mime-type" => mime_type + update "INSERT DATA { GRAPH <#{uri}> { <#{uri}> <#{RDF::DC.modified}> \"#{DateTime.now}\" } }" rescue bad_request_error $!.message, File.join(four_store_uri,"data")+"/" end @@ -38,11 +39,12 @@ module OpenTox bad_request_error "'#{mime_type}' is not a supported content type. Please use one of #{@@content_type_formats.join(", ")}." unless @@content_type_formats.include? mime_type bad_request_error "Reqest body empty." unless rdf mime_type = "application/x-turtle" if mime_type == "text/plain" - #begin + begin RestClientWrapper.put File.join(four_store_uri,"data",uri), rdf, :content_type => mime_type - #rescue - #bad_request_error $!.message, File.join(four_store_uri,"data",uri) - #end + update "INSERT DATA { GRAPH <#{uri}> { <#{uri}> <#{RDF::DC.modified}> \"#{DateTime.now}\" } }" + rescue + bad_request_error $!.message, File.join(four_store_uri,"data",uri) + end end def self.delete uri diff --git a/lib/compound.rb b/lib/compound.rb index da16c85..a0d6ec7 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -11,7 +11,7 @@ module OpenTox # @param [String] smiles Smiles string # @return [OpenTox::Compound] Compound def self.from_smiles service_uri, smiles, subjectid=nil - @smiles = smiles + #@smiles = smiles Compound.new RestClientWrapper.post(service_uri, smiles, {:content_type => 'chemical/x-daylight-smiles', :subjectid => subjectid}) end @@ -19,7 +19,7 @@ module OpenTox # @param [String] smiles InChI string # @return [OpenTox::Compound] Compound def self.from_inchi service_uri, inchi, subjectid=nil - @inchi = inchi + #@inchi = inchi Compound.new RestClientWrapper.post(service_uri, inchi, {:content_type => 'chemical/x-inchi', :subjectid => subjectid}) end diff --git a/lib/opentox.rb b/lib/opentox.rb index 0f29c30..877c5d5 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -104,7 +104,7 @@ module OpenTox # Save object at webservice def put wait=true # TODO: RDFXML - append RDF::DC.modified, DateTime.now + #append RDF::DC.modified, DateTime.now uri = RestClientWrapper.put @uri.to_s, self.to_ntriples, { :content_type => "text/plain", :subjectid => @subjectid} wait_for_task uri if wait end diff --git a/lib/utils/html.rb b/lib/utils/html.rb index d1fb323..4a4c9e1 100644 --- a/lib/utils/html.rb +++ b/lib/utils/html.rb @@ -34,7 +34,7 @@ module OpenTox def self.text_to_html( text, subjectid=nil, related_links=nil, description=nil, post_command=nil, png_image=nil ) # TODO add title as parameter - title = nil #$sinatra.url_for($sinatra.request.env['PATH_INFO'], :full) if $sinatra + title = nil #$sinatra.to($sinatra.request.env['PATH_INFO'], :full) if $sinatra html = "<html>" html += "<title>"+title+"</title>" if title #html += "<img src=\""+OT_LOGO+"\"><\/img><body>" |