AbstractSparqlWriter extends AbstractWriter { public AbstractSparqlWriter write(Prefix prefix) throws IOException { this.pm.putPrefix(prefix); this.write("PREFIX "); this.write(prefix.getPrefixName()); this.write(": <"); this.write(prefix.getPrefix()); this.writeln('>'); return this; } AbstractSparqlWriter(Writer out, URIzer urizer); AbstractSparqlWriter write(Prefix prefix); AbstractSparqlWriter writeComment(String comment); @Override void write(char c); @Override void write(String str);  }
@Test public void testWriteLiteral1() throws IOException { StringWriter sw = new StringWriter(); AbstractSparqlWriter w = createSparqlWriter(sw); w.write(DefaultTermFactory.instance().createLiteral(URIUtils.XSD_INTEGER, 1)); assertEquals("1",sw.toString()); }
@Test public void testWriteLiteral2() throws IOException { StringWriter sw = new StringWriter(); AbstractSparqlWriter w = createSparqlWriter(sw); String str = "hello world!"; w.write(DefaultTermFactory.instance().createLiteral(URIUtils.XSD_STRING, str)); assertEquals("\"" + str + "\"",sw.toString()); }