Try something like this:
String syntax = "RDF/XML-ABBREV"; // also try "N-TRIPLE" and "TURTLE"
StringWriter out = new StringWriter();
model.write(out, syntax);
String result = out.toString();
It uses Jena's built-in authors, who can already output RDF graphics in various supported RDF syntaxes, such as RDF / XML and Turtle and N-Triples. If you just want to reset to System.out, then this is even easier:
model.write(System.out, "RDF/XML-ABBREV");
source
share