private static Aggregator err(String label) { Log.fatal(AggregatorFactory.class, "Not implemented: "+label) ; return null ; } }
public SortCondition(Expr expr, int dir) { expression = expr ; direction = dir ; if ( dir != Query.ORDER_ASCENDING && dir != Query.ORDER_DESCENDING && dir != Query.ORDER_DEFAULT ) Log.fatal(this, "Unknown sort direction") ; }
public QueryIterRepeatApply( QueryIterator input , ExecutionContext context) { super(input, context) ; this.currentStage = null ; if ( input == null ) { Log.fatal(this, "[QueryIterRepeatApply] Repeated application to null input iterator") ; return ; } }
static public void fatal(Object caller, String msg) { fatal(caller.getClass(), msg) ; }
/** @deprecated Use {@code error}. */ @Deprecated static public void fatal(Object caller, String msg, Throwable th) { fatal(caller.getClass(), msg, th) ; }
/** @deprecated Use {@code error}. */ @Deprecated static public void fatal(Object caller, String msg) { fatal(caller.getClass(), msg) ; }
static public void fatal(Object caller, String msg, Throwable th) { fatal(caller.getClass(), msg, th) ; }
/** @deprecated Use {@code error}. */ @Deprecated static public void fatal(Object caller, String msg) { fatal(caller.getClass(), msg) ; }
/** @deprecated Use {@code error}. */ @Deprecated static public void fatal(Object caller, String msg, Throwable th) { fatal(caller.getClass(), msg, th) ; }
public ElementService(Node n, Element el, boolean silent) { if ( ! n.isURI() && ! n.isVariable() ) Log.fatal(this, "Must be a URI (or variable which will be bound) for a service endpoint") ; this.serviceNode = n ; this.element = el ; this.silent = silent ; }
@Override public QueryIterator execute(BasicPattern pattern, QueryIterator input, ExecutionContext execCxt) { if ( input == null ) Log.fatal(this, "Null input to "+Utils.classShortName(this.getClass())) ; Graph graph = execCxt.getActiveGraph() ; // Choose reorder transformation and execution strategy. final ReorderTransformation reorder ; final StageGenerator executor ; if ( graph instanceof GraphMem ) // Jena in-memory graph { reorder = reorderBasicStats(graph) ; executor = StageBuilder.executeInline ; ; } else { // When in doubt ... use the general pass-through to graph query handler matcher. // Includes union graphs, InfGraphs and other composite or unusual kinds. reorder = null ; executor = StageBuilder.executeInline ; } return execute(pattern, reorder, executor, input, execCxt) ; }
/** Return a new basic pattern with the same triples as the input, * but ordered as per the index list of this reorder processor. */ @Override public BasicPattern reorder(BasicPattern bgp) { if ( indexes.length != bgp.size() ) { String str = String.format("Expected size = %d : actual basic pattern size = %d", indexes.length, bgp.size()) ; Log.fatal(this, str) ; throw new ARQException(str) ; } BasicPattern bgp2 = new BasicPattern() ; for ( int j = 0 ; j < indexes.length ; j++ ) { int idx = indexes[j] ; Triple t = bgp.get(idx) ; bgp2.add(t) ; } return bgp2 ; }
} catch (QueryFatalException ex) Log.fatal(this, "QueryFatalException", ex) ; throw ex ;
/** final - subclasses implement hasNextBinding() */ @Override public final boolean hasNext() { if ( finished ) // Even if aborted. Finished is finished. return false ; if ( requestingCancel && abortIterator ) { // Try to close first to release resources (in case the user // doesn't have a close() call in a finally block) close() ; throw new QueryCancelledException() ; } // Handles exceptions boolean r = hasNextBinding() ; if ( r == false ) try { close() ; } catch (QueryFatalException ex) { Log.fatal(this, "Fatal exception: "+ex.getMessage() ) ; throw ex ; // And pass on up the exception. } return r ; }
@Override public Binding convert(Binding b) { if ( parentBinding == null || parentBinding.isEmpty() ) return b ; // This is the result. Could have BindingBase.setParent etc. BindingMap b2 = BindingFactory.create(parentBinding) ; // Copy the resultSet bindings to the combined result binding with checking. for ( Iterator<Var> iter = b.vars() ; iter.hasNext(); ) { Var v = iter.next(); Node n = b.get(v) ; if ( b2.contains(v) ) { Node n2 = b2.get(v) ; if ( n2.equals(n) ) Log.warn(this, "Binding already for "+v+" (same value)" ) ; else { Log.fatal(this, "Binding already for "+v+" (different values)" ) ; throw new ARQInternalErrorException("Incompatible bindings for "+v) ; } } b2.add(v, n) ; } return b2 ; } }
Log.fatal(this, "Unexpected throwable: ",th) ; throw new QueryException(th.getMessage(), th) ;
/** * Load a result set from file or URL into a result set (memory backed). * * @param filenameOrURI * @param format * @return ResultSet */ public static ResultSet load(String filenameOrURI, ResultsFormat format) { if (format == null) format = ResultsFormat.guessSyntax(filenameOrURI); if (format == null) { Log.warn(ResultSet.class, "Null format - defaulting to XML"); format = ResultsFormat.FMT_RS_XML; } if (format.equals(ResultsFormat.FMT_TEXT)) { Log.fatal(ResultSet.class, "Can't read a text result set"); throw new ResultSetException("Can't read a text result set"); } InputStream in = FileManager.get().open(filenameOrURI); if (in == null) throw new NotFoundException("Not found: " + filenameOrURI); return load(in, format); }