本文整理了Java中org.apache.jena.query.Query.isSelectType
方法的一些代码示例,展示了Query.isSelectType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.isSelectType
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:isSelectType
暂无
代码示例来源:origin: at.researchstudio.sat/won-core
public WonSparqlValidator(Query constraint) {
if (!constraint.isAskType() && !constraint.isSelectType()) {
throw new IllegalArgumentException("Wrong constraint type!");
}
this.constraint = constraint;
}
代码示例来源:origin: at.researchstudio.sat/won-core
public WonSparqlValidator(Query constraint, String name) {
if (!constraint.isAskType() && !constraint.isSelectType()) {
throw new IllegalArgumentException("Wrong constraint type!");
}
this.constraint = constraint;
this.name = name;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public ResultSet execSelect() {
if (!query.isSelectType()) {
throw new RuntimeException("SELECT query expected. Got: ["
+ query.toString() + "]");
}
return executeCoreSelect(query);
}
代码示例来源:origin: apache/jena
protected Query endSubSelect(int line, int column)
{
Query subQuery = query ;
if ( ! subQuery.isSelectType() )
throwParseException("Subquery not a SELECT query", line, column) ;
popQuery();
return subQuery ;
}
代码示例来源:origin: vivo-project/Vitro
public static Query createQuery(String queryParam) throws AjaxControllerException {
Query query = QueryFactory.create(queryParam, Syntax.syntaxARQ);
if (!query.isSelectType()) {
throw new AjaxControllerException(SC_NOT_FOUND,
"Only 'select' queries are allowed.");
}
return query;
}
代码示例来源:origin: vivo-project/Vitro
private String interpretRequestedFormats(HttpServletRequest req,
String queryString) throws NotAcceptableException {
Query query = SparqlQueryUtils.create(queryString);
String parameterName = (query.isSelectType() || query.isAskType()) ? "resultFormat"
: "rdfResultFormat";
String parameterValue = req.getParameter(parameterName);
if (StringUtils.isBlank(parameterValue)) {
throw new NotAcceptableException("Parameter '" + parameterName
+ "' was '" + parameterValue + "'.");
} else {
return parameterValue;
}
}
代码示例来源:origin: dice-group/NLIWOD
public Set<Triple> extractTriplePattern(final Query query, final boolean ignoreOptionals) {
triplePattern = new HashSet<>();
optionalTriplePattern = new HashSet<>();
query.getQueryPattern().visit(this);
// postprocessing: triplepattern in OPTIONAL clause
if (!ignoreOptionals && query.isSelectType()) {
for (Triple t : optionalTriplePattern) {
if (!ListUtils.intersection(new ArrayList<>(VarUtils.getVars(t)), query.getProjectVars()).isEmpty()) {
triplePattern.add(t);
}
}
}
return triplePattern;
}
代码示例来源:origin: stackoverflow.com
Query query = QueryFactory.create(queryString);
query.isSelectType() && query.isQueryResultStar(); // of the form SELECT *?
query.getDatasetDescription(); // FROM / FROM NAMED bits
query.getQueryPattern(); // The meat of the query, the WHERE bit
...etc etc..
Op op = Algebra.compile(query); // Get the algebra for the query
代码示例来源:origin: apache/jena
/** Return a closable resultset for a {@link QueryExecution}.
* The {@link QueryExecution} must be for a {@code SELECT} query.
* @param queryExecution {@code QueryExecution} must be for a {@code SELECT} query.
* @return ResultSetCloseable
*/
public static ResultSetCloseable closeableResultSet(QueryExecution queryExecution) {
if ( queryExecution.getQuery() != null && ! queryExecution.getQuery().isSelectType() )
throw new IllegalArgumentException("Not an execution for a SELECT query");
return new ResultSetCloseable(queryExecution.execSelect(), queryExecution) ;
}
代码示例来源:origin: at.researchstudio.sat/won-core
public ValidationResult validate(Dataset input) {
if (logger.isDebugEnabled()) {
logger.debug("validating constraint of WonSparqlValidator '{}'", name);
}
if (constraint.isAskType()) {
return validateAsk(input);
} else if (constraint.isSelectType()) {
return validateSelect(input);
}
return new ValidationResult(false, "Invalid constraint: " + constraint.toString());
}
代码示例来源:origin: com.github.galigator.openllet/openllet-jena
private static QueryType getQueryType(final Query query)
{
if (query.isSelectType())
return QueryType.SELECT;
if (query.isConstructType())
return QueryType.CONSTRUCT;
if (query.isDescribeType())
return QueryType.DESCRIBE;
if (query.isAskType())
return QueryType.ASK;
return null;
}
代码示例来源:origin: Galigator/openllet
private static QueryType getQueryType(final Query query)
{
if (query.isSelectType())
return QueryType.SELECT;
if (query.isConstructType())
return QueryType.CONSTRUCT;
if (query.isDescribeType())
return QueryType.DESCRIBE;
if (query.isAskType())
return QueryType.ASK;
return null;
}
代码示例来源:origin: Galigator/openllet
private static QueryType getQueryType(final Query query)
{
if (query.isSelectType())
return QueryType.SELECT;
if (query.isConstructType())
return QueryType.CONSTRUCT;
if (query.isDescribeType())
return QueryType.DESCRIBE;
if (query.isAskType())
return QueryType.ASK;
return null;
}
代码示例来源:origin: apache/jena
/**
* Execute a SELECT query and process the ResultSet with the handler code.
* @param query
* @param resultSetAction
*/
@Override
public default void queryResultSet(Query query, Consumer<ResultSet> resultSetAction) {
if ( ! query.isSelectType() )
throw new JenaConnectionException("Query is not a SELECT query");
Txn.executeRead(this, ()->{
try ( QueryExecution qExec = query(query) ) {
ResultSet rs = qExec.execSelect();
resultSetAction.accept(rs);
}
} );
}
代码示例来源:origin: apache/jena
static private String labelForQuery(Query q) {
if ( q.isSelectType() ) return "SELECT" ;
if ( q.isConstructType() ) return "CONSTRUCT" ;
if ( q.isDescribeType() ) return "DESCRIBE" ;
if ( q.isAskType() ) return "ASK" ;
if ( q.isJsonType() ) return "JSON" ;
return "<<unknown>>" ;
}
代码示例来源:origin: apache/jena
@Override
public ResultSet execSelect() {
checkNotClosed();
if ( !query.isSelectType() )
throw new QueryExecException("Attempt to have ResultSet from a " + labelForQuery(query) + " query");
ResultSet rs = execResultSet();
return new ResultSetCheckCondition(rs, this);
}
代码示例来源:origin: Galigator/openllet
private void printQueryResults()
{
if (query.isSelectType())
printSelectQueryResuts();
else
if (query.isConstructType())
printConstructQueryResults();
else
if (query.isAskType())
printAskQueryResult();
}
代码示例来源:origin: apache/jena
/**
* Execute a SELECT query and process the rows of the results with the handler code.
* @param query
* @param rowAction
*/
@Override
public default void querySelect(Query query, Consumer<QuerySolution> rowAction) {
if ( ! query.isSelectType() )
throw new JenaConnectionException("Query is not a SELECT query");
Txn.executeRead(this, ()->{
try ( QueryExecution qExec = query(query) ) {
qExec.execSelect().forEachRemaining(rowAction);
}
} );
}
代码示例来源:origin: org.apache.jena/jena-rdfconnection
/**
* Execute a SELECT query and process the rows of the results with the handler code.
* @param query
* @param rowAction
*/
@Override
public default void querySelect(Query query, Consumer<QuerySolution> rowAction) {
if ( ! query.isSelectType() )
throw new JenaConnectionException("Query is not a SELECT query");
Txn.executeRead(this, ()->{
try ( QueryExecution qExec = query(query) ) {
qExec.execSelect().forEachRemaining(rowAction);
}
} );
}
代码示例来源:origin: apache/jena
@Override
public void visitSelectResultForm(Query query1)
{
check("Not both SELECT queries", query2.isSelectType()) ;
check("DISTINCT modifier",
query1.isDistinct() == query2.isDistinct()) ;
check("SELECT *", query1.isQueryResultStar() == query2.isQueryResultStar()) ;
check("Result variables", query1.getProject(), query2.getProject() ) ;
}
内容来源于网络,如有侵权,请联系作者删除!