本文整理汇总了Java中org.apache.jena.query.Query.setQueryResultStar方法的典型用法代码示例。如果您正苦于以下问题:Java Query.setQueryResultStar方法的具体用法?Java Query.setQueryResultStar怎么用?Java Query.setQueryResultStar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.query.Query
的用法示例。
在下文中一共展示了Query.setQueryResultStar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toSPARQL
import org.apache.jena.query.Query; //导入方法依赖的package包/类
public Query toSPARQL(Set<Var> select) {
Query q = new Query();
q.setQuerySelectType();
for (Var var : select) {
q.addResultVar(var);
}
q.setQueryResultStar(false);
q.setQueryPattern(clause);
return q;
}
示例2: _addAgg
import org.apache.jena.query.Query; //导入方法依赖的package包/类
private static void _addAgg(Query q, List<ExprAggregator> aggs, Agg type) {
if (q.isQueryResultStar()) {
q.setQueryResultStar(false);
q.getProject().clear();
}
aggs.forEach(expr -> q.addResultVar(expr.getVar().getName() + "_" + type, expr));
}
示例3: modifyQuery
import org.apache.jena.query.Query; //导入方法依赖的package包/类
/**
* Modifies a query so that it operates onto a table. This is achieved
* by appending the table as a VALUES block to the end of the main
* query pattern.
*
* @param query Original query; will be modified in place
* @param table Data table to be added into the query
*/
private void modifyQuery(Query query, final Table table) {
ElementData tableElement = new ElementData() {
@Override
public Table getTable() {
return table;
}
};
for (Var var: table.getVars()) {
// Skip ?ROWNUM for "SELECT *" queries -- see further below
if (query.isSelectType() && query.isQueryResultStar()
&& var.equals(TarqlQuery.ROWNUM)) continue;
tableElement.add(var);
}
ElementGroup groupElement = new ElementGroup();
groupElement.addElement(tableElement);
if (query.getQueryPattern() instanceof ElementGroup) {
for (Element element: ((ElementGroup) query.getQueryPattern()).getElements()) {
groupElement.addElement(element);
}
} else {
groupElement.addElement(query.getQueryPattern());
}
query.setQueryPattern(groupElement);
// For SELECT * queries, we don't want to include pseudo
// columns such as ?ROWNUM that may exist in the table.
// That's why we skipped ?ROWNUM further up.
if (query.isSelectType() && query.isQueryResultStar()) {
// Force expansion of "SELECT *" to actual projection list
query.setResultVars();
// Tell ARQ that it actually needs to pay attention to
// the projection list
query.setQueryResultStar(false);
// And now we can add ?ROWNUM to the table, as the "*"
// has already been expanded.
tableElement.add(TarqlQuery.ROWNUM);
}
// Data can only be added to table after we've finished the
// ?ROWNUM shenangians
/*for (Binding binding: table.getRows()) {
tableElement.add(binding);
}*/
}