diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-05-04 10:29:55 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-05-04 10:29:55 +0000 |
commit | 8a5e3d69a16fc0c7d551e000270fe243ed121c85 (patch) | |
tree | 1f3dc8f4c2b9321fcda9aa4e44f5f26ba01cdb28 /lib/opentox.rb | |
parent | b317039ba3e5ba10e7ea4769f256e345829ce8ff (diff) |
ntriples as default format, rdfxml as fallback
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r-- | lib/opentox.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb index 2682258..f79b51b 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -21,9 +21,9 @@ module OpenTox # Load metadata from service def pull - # TODO generic method for all formats - #parse_rdfxml RestClientWrapper.get(@uri,{},{:accept => $default_rdf, :subjectid => @subjectid}) parse_ntriples RestClientWrapper.get(@uri,{},{:accept => "text/plain", :subjectid => @subjectid}) + rescue # fall back to rdfxml + parse_rdfxml RestClientWrapper.get(@uri,{},{:accept => "application/rdf+xml", :subjectid => @subjectid}) end # Get object metadata @@ -48,8 +48,9 @@ module OpenTox # Save object at service def save - #TODO: dynamic assignment - put self.to_rdfxml, { :content_type => $default_rdf} + put self.to_ntriples, { :content_type => "text/plain"} + rescue # fall back to rdfxml + put self.to_rdfxml, { :content_type => "application/rdf+xml"} end RDF_FORMATS.each do |format| |