Writing Turtle with additional prefixes

Hi all,
I'd like to write a graph that I've created, as Turtle, but using
additional @prefix declarations for the new triples I've added.

So:

2.0.0p247 :006 > g = RDF::Repository.new
 => #<RDF::Repository:0xc51354()>

2.0.0p247 :007 > v = RDF::Vocabulary.new( "http://foo.com/schema#" )
 => #<RDF::Vocabulary:0xc58258(http://foo.com/schema#)>

2.0.0p247 :008 > g << [v.s, v.p, v.o]
 => #<RDF::Repository:0xc51354()>

2.0.0p247 :009 > g.to_ttl
 => "\n<http://foo.com/schema#s> <http://foo.com/schema#p>
<http://foo.com/schema#o> .\n"

2.0.0p247 :016 > g.to_ttl( prefixes: {foo: "http://foo.com/schema#"} )
 => "\n<http://foo.com/schema#s> <http://foo.com/schema#p>
<http://foo.com/schema#o> .\n"

What I'd like to happen is (something like):

2.0.0p247 :016 > g.to_ttl( prefixes: {foo: "http://foo.com/schema#"} )
 => "@prefix foo: <http://foo.com/schema#>.\nfoo:s foo:p foo:o .\n"

Any suggestions?

Thanks,
Ian

Received on Wednesday, 27 November 2013 16:43:49 UTC