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") ; }
public static UpdateRequest clone(UpdateRequest request) { UpdateRequest result = new UpdateRequest(); result.setBaseURI(request.getBaseURI()); result.setPrefixMapping(request.getPrefixMapping()); result.setResolver(request.getResolver()); for(Update update : request.getOperations()) { Update clone = UpdateUtils.clone(update); result.add(clone); } return result; }