org.apache.jena.query.Query.isSelectType()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(260)

本文整理了Java中org.apache.jena.query.Query.isSelectType方法的一些代码示例,展示了Query.isSelectType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.isSelectType方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:isSelectType

Query.isSelectType介绍

暂无

代码示例

代码示例来源:origin: at.researchstudio.sat/won-core

  1. public WonSparqlValidator(Query constraint) {
  2. if (!constraint.isAskType() && !constraint.isSelectType()) {
  3. throw new IllegalArgumentException("Wrong constraint type!");
  4. }
  5. this.constraint = constraint;
  6. }

代码示例来源:origin: at.researchstudio.sat/won-core

  1. public WonSparqlValidator(Query constraint, String name) {
  2. if (!constraint.isAskType() && !constraint.isSelectType()) {
  3. throw new IllegalArgumentException("Wrong constraint type!");
  4. }
  5. this.constraint = constraint;
  6. this.name = name;
  7. }

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

  1. @Override
  2. public ResultSet execSelect() {
  3. if (!query.isSelectType()) {
  4. throw new RuntimeException("SELECT query expected. Got: ["
  5. + query.toString() + "]");
  6. }
  7. return executeCoreSelect(query);
  8. }

代码示例来源:origin: apache/jena

  1. protected Query endSubSelect(int line, int column)
  2. {
  3. Query subQuery = query ;
  4. if ( ! subQuery.isSelectType() )
  5. throwParseException("Subquery not a SELECT query", line, column) ;
  6. popQuery();
  7. return subQuery ;
  8. }

代码示例来源:origin: vivo-project/Vitro

  1. public static Query createQuery(String queryParam) throws AjaxControllerException {
  2. Query query = QueryFactory.create(queryParam, Syntax.syntaxARQ);
  3. if (!query.isSelectType()) {
  4. throw new AjaxControllerException(SC_NOT_FOUND,
  5. "Only 'select' queries are allowed.");
  6. }
  7. return query;
  8. }

代码示例来源:origin: vivo-project/Vitro

  1. private String interpretRequestedFormats(HttpServletRequest req,
  2. String queryString) throws NotAcceptableException {
  3. Query query = SparqlQueryUtils.create(queryString);
  4. String parameterName = (query.isSelectType() || query.isAskType()) ? "resultFormat"
  5. : "rdfResultFormat";
  6. String parameterValue = req.getParameter(parameterName);
  7. if (StringUtils.isBlank(parameterValue)) {
  8. throw new NotAcceptableException("Parameter '" + parameterName
  9. + "' was '" + parameterValue + "'.");
  10. } else {
  11. return parameterValue;
  12. }
  13. }

代码示例来源:origin: dice-group/NLIWOD

  1. public Set<Triple> extractTriplePattern(final Query query, final boolean ignoreOptionals) {
  2. triplePattern = new HashSet<>();
  3. optionalTriplePattern = new HashSet<>();
  4. query.getQueryPattern().visit(this);
  5. // postprocessing: triplepattern in OPTIONAL clause
  6. if (!ignoreOptionals && query.isSelectType()) {
  7. for (Triple t : optionalTriplePattern) {
  8. if (!ListUtils.intersection(new ArrayList<>(VarUtils.getVars(t)), query.getProjectVars()).isEmpty()) {
  9. triplePattern.add(t);
  10. }
  11. }
  12. }
  13. return triplePattern;
  14. }

代码示例来源:origin: stackoverflow.com

  1. Query query = QueryFactory.create(queryString);
  2. query.isSelectType() && query.isQueryResultStar(); // of the form SELECT *?
  3. query.getDatasetDescription(); // FROM / FROM NAMED bits
  4. query.getQueryPattern(); // The meat of the query, the WHERE bit
  5. ...etc etc..
  6. Op op = Algebra.compile(query); // Get the algebra for the query

代码示例来源:origin: apache/jena

  1. /** Return a closable resultset for a {@link QueryExecution}.
  2. * The {@link QueryExecution} must be for a {@code SELECT} query.
  3. * @param queryExecution {@code QueryExecution} must be for a {@code SELECT} query.
  4. * @return ResultSetCloseable
  5. */
  6. public static ResultSetCloseable closeableResultSet(QueryExecution queryExecution) {
  7. if ( queryExecution.getQuery() != null && ! queryExecution.getQuery().isSelectType() )
  8. throw new IllegalArgumentException("Not an execution for a SELECT query");
  9. return new ResultSetCloseable(queryExecution.execSelect(), queryExecution) ;
  10. }

代码示例来源:origin: at.researchstudio.sat/won-core

  1. public ValidationResult validate(Dataset input) {
  2. if (logger.isDebugEnabled()) {
  3. logger.debug("validating constraint of WonSparqlValidator '{}'", name);
  4. }
  5. if (constraint.isAskType()) {
  6. return validateAsk(input);
  7. } else if (constraint.isSelectType()) {
  8. return validateSelect(input);
  9. }
  10. return new ValidationResult(false, "Invalid constraint: " + constraint.toString());
  11. }

代码示例来源:origin: com.github.galigator.openllet/openllet-jena

  1. private static QueryType getQueryType(final Query query)
  2. {
  3. if (query.isSelectType())
  4. return QueryType.SELECT;
  5. if (query.isConstructType())
  6. return QueryType.CONSTRUCT;
  7. if (query.isDescribeType())
  8. return QueryType.DESCRIBE;
  9. if (query.isAskType())
  10. return QueryType.ASK;
  11. return null;
  12. }

代码示例来源:origin: Galigator/openllet

  1. private static QueryType getQueryType(final Query query)
  2. {
  3. if (query.isSelectType())
  4. return QueryType.SELECT;
  5. if (query.isConstructType())
  6. return QueryType.CONSTRUCT;
  7. if (query.isDescribeType())
  8. return QueryType.DESCRIBE;
  9. if (query.isAskType())
  10. return QueryType.ASK;
  11. return null;
  12. }

代码示例来源:origin: Galigator/openllet

  1. private static QueryType getQueryType(final Query query)
  2. {
  3. if (query.isSelectType())
  4. return QueryType.SELECT;
  5. if (query.isConstructType())
  6. return QueryType.CONSTRUCT;
  7. if (query.isDescribeType())
  8. return QueryType.DESCRIBE;
  9. if (query.isAskType())
  10. return QueryType.ASK;
  11. return null;
  12. }

代码示例来源:origin: apache/jena

  1. /**
  2. * Execute a SELECT query and process the ResultSet with the handler code.
  3. * @param query
  4. * @param resultSetAction
  5. */
  6. @Override
  7. public default void queryResultSet(Query query, Consumer<ResultSet> resultSetAction) {
  8. if ( ! query.isSelectType() )
  9. throw new JenaConnectionException("Query is not a SELECT query");
  10. Txn.executeRead(this, ()->{
  11. try ( QueryExecution qExec = query(query) ) {
  12. ResultSet rs = qExec.execSelect();
  13. resultSetAction.accept(rs);
  14. }
  15. } );
  16. }

代码示例来源:origin: apache/jena

  1. static private String labelForQuery(Query q) {
  2. if ( q.isSelectType() ) return "SELECT" ;
  3. if ( q.isConstructType() ) return "CONSTRUCT" ;
  4. if ( q.isDescribeType() ) return "DESCRIBE" ;
  5. if ( q.isAskType() ) return "ASK" ;
  6. if ( q.isJsonType() ) return "JSON" ;
  7. return "<<unknown>>" ;
  8. }

代码示例来源:origin: apache/jena

  1. @Override
  2. public ResultSet execSelect() {
  3. checkNotClosed();
  4. if ( !query.isSelectType() )
  5. throw new QueryExecException("Attempt to have ResultSet from a " + labelForQuery(query) + " query");
  6. ResultSet rs = execResultSet();
  7. return new ResultSetCheckCondition(rs, this);
  8. }

代码示例来源:origin: Galigator/openllet

  1. private void printQueryResults()
  2. {
  3. if (query.isSelectType())
  4. printSelectQueryResuts();
  5. else
  6. if (query.isConstructType())
  7. printConstructQueryResults();
  8. else
  9. if (query.isAskType())
  10. printAskQueryResult();
  11. }

代码示例来源:origin: apache/jena

  1. /**
  2. * Execute a SELECT query and process the rows of the results with the handler code.
  3. * @param query
  4. * @param rowAction
  5. */
  6. @Override
  7. public default void querySelect(Query query, Consumer<QuerySolution> rowAction) {
  8. if ( ! query.isSelectType() )
  9. throw new JenaConnectionException("Query is not a SELECT query");
  10. Txn.executeRead(this, ()->{
  11. try ( QueryExecution qExec = query(query) ) {
  12. qExec.execSelect().forEachRemaining(rowAction);
  13. }
  14. } );
  15. }

代码示例来源:origin: org.apache.jena/jena-rdfconnection

  1. /**
  2. * Execute a SELECT query and process the rows of the results with the handler code.
  3. * @param query
  4. * @param rowAction
  5. */
  6. @Override
  7. public default void querySelect(Query query, Consumer<QuerySolution> rowAction) {
  8. if ( ! query.isSelectType() )
  9. throw new JenaConnectionException("Query is not a SELECT query");
  10. Txn.executeRead(this, ()->{
  11. try ( QueryExecution qExec = query(query) ) {
  12. qExec.execSelect().forEachRemaining(rowAction);
  13. }
  14. } );
  15. }

代码示例来源:origin: apache/jena

  1. @Override
  2. public void visitSelectResultForm(Query query1)
  3. {
  4. check("Not both SELECT queries", query2.isSelectType()) ;
  5. check("DISTINCT modifier",
  6. query1.isDistinct() == query2.isDistinct()) ;
  7. check("SELECT *", query1.isQueryResultStar() == query2.isQueryResultStar()) ;
  8. check("Result variables", query1.getProject(), query2.getProject() ) ;
  9. }

相关文章