@Override public ResultSet read(Reader in, Context context) { SPARQLResult result = ResultsStAX.read(in, null, context); return result.getResultSet(); } }
/** * Read from an {@code InputStream} and produce a {@link ResultSet}. * Note that return result may stream and so the input stream may be read * while the {@link ResultSet} is used. * See {@link ResultSetFactory#copyResults(ResultSet)} for a ResultSet that is detached from the {@code InputStream}. * @param in InputStream to read from. * @param context * @return ResultSet */ public default ResultSet read(InputStream in, Context context) { return readAny(in, context).getResultSet(); }
private ResultSet readResultSet(InputStream input, Lang lang) { return readAny(input, lang).getResultSet(); }
public static ResultSet fromXML(String str, Model model) { return make(str, model).getResultSet(); }
public static ResultSet fromXML(InputStream in, Model model) { return make(in, model).getResultSet(); }
public static ResultSet fromXML(Reader in, Model model) { return make(in, model).getResultSet(); }
/** * Read from a {@code URL} (including filenames) and produce a {@link ResultSet}. * Note that returned result set may stream and so the input stream be read * while the ResultSet is used. * <p> * See {@link ResultSetFactory#copyResults(ResultSet)} * for a ResultSet that is detached from the {@code InputStream}. * * @param input * @return ResultSet */ public static ResultSet read(InputStream input) { ResultSet rs = readAny(input).getResultSet(); if ( rs == null ) throw new ResultSetException("Not a result set"); return rs; }
/** * Read from an {@code InputStream} and produce a {@link ResultSet}; * the stream is expect to use syntax {@code lang}. Note that returned * result set may stream and so the input stream be read while the ResultSet is used. * See {@link ResultSetFactory#copyResults(ResultSet)} * for a ResultSet that is detached from the {@code InputStream}. * * @param input * @param lang * @return ResultSet */ public static ResultSet read(InputStream input, Lang lang) { ResultSet rs = readAny(input, lang).getResultSet(); if ( rs == null ) throw new ResultSetException("Not a result set"); return rs; }
/** * Read from a {@code URL} (including filenames) and produce a {@link ResultSet}. * Note that returned result set may stream and so the input stream be read * while the ResultSet is used. * <p> * See {@link ResultSetFactory#copyResults(ResultSet)} * for a ResultSet that is detached from the {@code InputStream}. * * @param urlOrFilename * @return ResultSet */ public static ResultSet read(String urlOrFilename) { ResultSet rs = readAny(urlOrFilename).getResultSet(); if ( rs == null ) throw new ResultSetException("Not a result set"); return rs; }
/** * Read from a {@code URL} (including filenames) and produce a {@link ResultSet}; * the stream is expect to use syntax {@code lang}. Note that returned * result set may stream and so the input stream be read while the ResultSet is used. * See {@link ResultSetFactory#copyResults(ResultSet)} * for a ResultSet that is detached from the {@code InputStream}. * * @param urlOrFilename * @param lang * @return ResultSet */ public static ResultSet read(String urlOrFilename, Lang lang) { ResultSet rs = readAny(urlOrFilename, lang).getResultSet(); if ( rs == null ) throw new ResultSetException("Not a result set"); return rs; }
public SPARQLResultEx(SPARQLResult that) { if(that.isBoolean()) { set(that.getBooleanResult()); } else if(that.isDataset()) { set(that.getDataset()); } else if(that.isJson()) { set(that.getJsonItems()); } else if(that.isModel()) { set(that.getModel()); } else if(that.isResultSet()) { set(that.getResultSet()); } else { throw new IllegalArgumentException("Unknown SPARQLResult type"); } }
public static SPARQLResult copy(SPARQLResult that) { SPARQLResult result = that.isBoolean() ? new SPARQLResult(that.getBooleanResult()) : that.isDataset() ? new SPARQLResult(that.getDataset()) : that.isJson() ? new SPARQLResult(that.getJsonItems()) : that.isModel() ? new SPARQLResult(that.getModel()) : that.isResultSet() ? new SPARQLResult(that.getResultSet()) : null; return result; }
/** Ship the results to the remote caller. * @param action * @param result * @param qPrologue */ protected void sendResults(HttpAction action, SPARQLResult result, Prologue qPrologue) { if ( result.isResultSet() ) ResponseResultSet.doResponseResultSet(action, result.getResultSet(), qPrologue) ; else if ( result.isDataset() ) // CONSTRUCT is processed as a extended CONSTRUCT - result is a dataset. ResponseDataset.doResponseDataset(action, result.getDataset()); else if ( result.isModel() ) // DESCRIBE results are models ResponseDataset.doResponseModel(action, result.getModel()); else if ( result.isBoolean() ) ResponseResultSet.doResponseResultSet(action, result.getBooleanResult()) ; else if ( result.isJson() ) ResponseJson.doResponseJson(action, result.getJsonItems()) ; else ServletOps.errorOccurred("Unknown or invalid result type") ; }
/** Ship the results to the remote caller. * @param action * @param result * @param qPrologue */ protected void sendResults(HttpAction action, SPARQLResult result, Prologue qPrologue) { if ( result.isResultSet() ) ResponseResultSet.doResponseResultSet(action, result.getResultSet(), qPrologue) ; else if ( result.isDataset() ) // CONSTRUCT is processed as a extended CONSTRUCT - result is a dataset. ResponseDataset.doResponseDataset(action, result.getDataset()); else if ( result.isModel() ) // DESCRIBE results are models ResponseDataset.doResponseModel(action, result.getModel()); else if ( result.isBoolean() ) ResponseResultSet.doResponseResultSet(action, result.getBooleanResult()) ; else if ( result.isJson() ) ResponseJson.doResponseJson(action, result.getJsonItems()) ; else ServletOps.errorOccurred("Unknown or invalid result type") ; }
if ( results != null ) rs1 = ResultSetFactory.makeRewindable(results.getResultSet()) ; expectedLabel = "Results file" ;
if ( results != null ) rs1 = ResultSetFactory.makeRewindable(results.getResultSet()) ; expectedLabel = "Results file" ;
if ( results != null ) rs1$ = ResultSetFactory.makeRewindable(results.getResultSet()) ; expectedLabel$ = "Results file" ;
if ( results != null ) rs1$ = ResultSetFactory.makeRewindable(results.getResultSet()) ; expectedLabel$ = "Results file" ;
SPARQLResult x = ReadAnything.read(filenameOrURI); if (x.isResultSet()) RDFOutput.encodeAsRDF(model, x.getResultSet()); else if ( x.isBoolean() ) RDFOutput.encodeAsRDF(model, x.getBooleanResult());
resultsExpected = ResultSetFactory.makeRewindable(results.getResultSet()) ; else if ( results.isModel() ) resultsExpected = ResultSetFactory.makeRewindable(results.getModel()) ;