@Override public void output(IndentedWriter out, SerializationContext sCxt) { UpdateWriter.output(this, out, sCxt) ; }
@Override public void output(IndentedWriter out) { UpdateWriter.output(this, out, null) ; }
public static void output(UpdateRequest request, IndentedWriter out) { Prologue prologue = request ; if ( ! request.explicitlySetBaseURI() ) prologue = new Prologue(request.getPrefixMapping(), (IRIResolver)null) ; SerializationContext sCxt = new SerializationContext(prologue, new NodeToLabelMapBNode()) ; output(request, out, sCxt); }
public static void checkUpdate(UpdateRequest req, Syntax syntax) { IndentedLineBuffer w = new IndentedLineBuffer() ; UpdateWriter.output(req, w) ; String updateString2 = w.asString() ; UpdateRequest req2; try { String baseURI = null ; if ( ! req.explicitlySetBaseURI() ) baseURI = req.getBaseURI() ; req2 = UpdateFactory.create(updateString2, syntax) ; } catch (UnsupportedOperationException ex) { // No parser after all. return ; } catch (QueryException ex) { System.err.println(updateString2) ; throw new QueryCheckException("could not parse output update request", ex) ; } // if ( req.hashCode() != req2.hashCode() ) // throw new UpdateCheckException("reparsed query hashCode does not equal parsed input update \nUpdate (hashCode: " + req.hashCode() + ")=\n" + req + "\n\nUpdate2 (hashCode: " + req2.hashCode() + ")=\n" + req2) ; // // if ( ! req.equals(req2) ) // throw new UpdateCheckException("reparsed output does not equal parsed input") ; }
public static void checkUpdate(UpdateRequest req, Syntax syntax) { IndentedLineBuffer w = new IndentedLineBuffer() ; UpdateWriter.output(req, w) ; String updateString2 = w.asString() ; UpdateRequest req2; try { String baseURI = null ; if ( ! req.explicitlySetBaseURI() ) baseURI = req.getBaseURI() ; req2 = UpdateFactory.create(updateString2, syntax) ; } catch (UnsupportedOperationException ex) { // No parser after all. return ; } catch (QueryException ex) { System.err.println(updateString2) ; throw new QueryCheckException("could not parse output update request", ex) ; } // if ( req.hashCode() != req2.hashCode() ) // throw new UpdateCheckException("reparsed query hashCode does not equal parsed input update \nUpdate (hashCode: " + req.hashCode() + ")=\n" + req + "\n\nUpdate2 (hashCode: " + req2.hashCode() + ")=\n" + req2) ; // // if ( ! req.equals(req2) ) // throw new UpdateCheckException("reparsed output does not equal parsed input") ; }
@Override public void output(IndentedWriter out) { // Try to use a serializer factory if available UpdateSerializerFactory factory = SerializerRegistry.get().getUpdateSerializerFactory( Syntax.defaultUpdateSyntax); if (factory != null) { UpdateSerializer serializer = factory.create(Syntax.defaultUpdateSyntax, this, out); serializer.open(); serializer.update(this); serializer.close(); } else { // Otherwise fall back to old default behaviour UpdateWriter.output(this, out); } }
private void test(String updateString) { UpdateRequest update1 = UpdateFactory.create(updateString); IndentedLineBuffer w = new IndentedLineBuffer() ; UpdateWriter.output(update1, w) ; String s = w.asString() ; UpdateRequest update2 = UpdateFactory.create(s); assertTrue(update1.equalTo(update2)) ; } }