protected static void error(String msg) { throw new UpdateException(msg); } }
req = UpdateFactory.read(usingList, input, UpdateParseBase, Syntax.syntaxARQ); catch (UpdateException ex) { ServletOps.errorBadRequest(ex.getMessage()) ; return ; } catch (QueryParseException ex) { ServletOps.errorBadRequest(messageForQueryException(ex)) ; return ; } action.abort() ; incCounter(action.getEndpoint().getCounters(), UpdateExecErrors) ; ServletOps.errorOccurred(ex.getMessage()) ; } catch (QueryParseException|QueryBuildException ex) { action.abort() ;
req = UpdateFactory.read(usingList, input, UpdateParseBase, Syntax.syntaxARQ); catch (UpdateException ex) { ServletOps.errorBadRequest(ex.getMessage()) ; return ; } catch (QueryParseException ex) { ServletOps.errorBadRequest(messageForQueryException(ex)) ; return ; } action.abort() ; incCounter(action.getEndpoint().getCounters(), UpdateExecErrors) ; ServletOps.errorOccurred(ex.getMessage()) ; } catch (QueryParseException|QueryBuildException ex) { action.abort() ;
/** Create an UpdateRequest by reading it from a file */ public static UpdateRequest read(UsingList usingList, String fileName, String baseURI, Syntax syntax) { InputStream in = null ; try { if ( fileName.equals("-") ) in = System.in ; else { in = IO.openFile(fileName) ; if ( in == null ) throw new UpdateException("File could not be opened: "+fileName) ; } return read(usingList, in, baseURI, syntax) ; } finally { if ( in != null && ! fileName.equals("-") ) IO.close(in) ; } }
/** Parse update operations into a GraphStore by reading it from a file */ @SuppressWarnings("resource") public static void parseExecute(UsingList usingList, DatasetGraph dataset, String fileName, Binding inputBinding, String baseURI, Syntax syntax) { InputStream in = null ; if ( fileName.equals("-") ) in = System.in ; else { in = IO.openFile(fileName) ; if ( in == null ) throw new UpdateException("File could not be opened: "+fileName) ; } parseExecute(usingList, dataset, in, inputBinding, baseURI, syntax) ; if ( in != System.in ) IO.close(in) ; }
@Override public void send(Update update) { // ---- check USING/USING NAMED/WITH not used. // ---- update request to have USING/USING NAMED if ( null != usingList && usingList.usingIsPresent() ) { if ( update instanceof UpdateWithUsing ) { UpdateWithUsing upu = (UpdateWithUsing)update ; if ( upu.getUsing().size() != 0 || upu.getUsingNamed().size() != 0 || upu.getWithIRI() != null ) throw new UpdateException("SPARQL Update: Protocol using-graph-uri or using-named-graph-uri present where update request has USING, USING NAMED or WITH") ; for ( Node node : usingList.getUsing() ) upu.addUsing(node) ; for ( Node node : usingList.getUsingNamed() ) upu.addUsingNamed(node) ; } } sink.send(update); }
Lang lang = RDFDataMgr.determineLang(source, contentType, Lang.TTL); if ( lang == null ) throw new UpdateException("Failed to determine the syntax for '"+source+"'"); if ( ! RDFLanguages.isTriples(lang) ) throw new UpdateException("Attempt to load quads into a graph"); RDFParser parser = RDFParser .source(input.getInputStream()) if ( ex instanceof UpdateException ) throw ex; throw new UpdateException("Failed to LOAD '" + source + "' :: " + ex.getMessage(), ex);