From 8a5e3d69a16fc0c7d551e000270fe243ed121c85 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 4 May 2012 10:29:55 +0000 Subject: ntriples as default format, rdfxml as fallback --- lib/opentox.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/opentox.rb') 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| -- cgit v1.2.3