当前位置: 首页>>代码示例>>Java>>正文


Java Query.isQueryResultStar方法代码示例

本文整理汇总了Java中org.apache.jena.query.Query.isQueryResultStar方法的典型用法代码示例。如果您正苦于以下问题:Java Query.isQueryResultStar方法的具体用法?Java Query.isQueryResultStar怎么用?Java Query.isQueryResultStar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jena.query.Query的用法示例。


在下文中一共展示了Query.isQueryResultStar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitSelectResultForm

import org.apache.jena.query.Query; //导入方法依赖的package包/类
@Override
public void visitSelectResultForm(Query query) {
    if(query.isQueryResultStar()) {
        return;
    }
    final VarExprList project = query.getProject();
    final VarExprList newProject = new VarExprList();
    final ExprNormalizer enzer = new ExprNormalizer();
    project.getVars().forEach((var) -> {
        if(project.hasExpr(var)) {
            final Expr nzed = enzer.normalize(project.getExpr(var));
            newProject.add(var, nzed);
        } else {
            newProject.add(var);
        }
    });
    project.clear();
    project.addAll(newProject);
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:20,代码来源:QueryNormalizer.java

示例2: visitSelectResultForm

import org.apache.jena.query.Query; //导入方法依赖的package包/类
@Override
public void visitSelectResultForm(Query query) {
    out.print("SELECT ");
    if (query.isDistinct()) {
        out.print("DISTINCT ");
    }
    if (query.isReduced()) {
        out.print("REDUCED ");
    }
    out.print(" "); //Padding

    if (query.isQueryResultStar()) {
        out.print("*");
    } else {
        appendNamedExprList(query, out, query.getProject());
    }
    out.newline();
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:19,代码来源:SPARQLGenerateQuerySerializer.java

示例3: visitDescribeResultForm

import org.apache.jena.query.Query; //导入方法依赖的package包/类
@Override
public void visitDescribeResultForm(Query query) {
    out.print("DESCRIBE ");

    if (query.isQueryResultStar()) {
        out.print("*");
    } else {
        appendVarList(query, out, query.getResultVars());
        if (query.getResultVars().size() > 0
                && query.getResultURIs().size() > 0) {
            out.print(" ");
        }
        appendURIList(query, out, query.getResultURIs());
    }
    out.newline();
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:17,代码来源:SPARQLGenerateQuerySerializer.java

示例4: _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));
}
 
开发者ID:xgfd,项目名称:ASPG,代码行数:9,代码来源:QueryDressing.java

示例5: convertToGremlinTraversal

import org.apache.jena.query.Query; //导入方法依赖的package包/类
GraphTraversal<Vertex, ?> convertToGremlinTraversal(final Query query) {
    final Op op = Algebra.compile(query);
    OpWalker.walk(op, this);
    if (!query.isQueryResultStar()) {
        final List<String> vars = query.getResultVars();
        switch (vars.size()) {
            case 0:
                throw new IllegalStateException();
            case 1:
                if (query.isDistinct()) {
                    traversal = traversal.dedup(vars.get(0));
                }
                traversal = traversal.select(vars.get(0));
                break;
            case 2:
                if (query.isDistinct()) {
                    traversal = traversal.dedup(vars.get(0), vars.get(1));
                }
                traversal = traversal.select(vars.get(0), vars.get(1));
                break;
            default:
                final String[] all = new String[vars.size()];
                vars.toArray(all);
                if (query.isDistinct()) {
                    traversal = traversal.dedup(all);
                }
                final String[] others = Arrays.copyOfRange(all, 2, vars.size());
                traversal = traversal.select(vars.get(0), vars.get(1), others);
                break;
        }
    } else {
        if (query.isDistinct()) {
            traversal = traversal.dedup();
        }
    }
    return traversal;
}
 
开发者ID:dkuppitz,项目名称:sparql-gremlin,代码行数:38,代码来源:SparqlToGremlinCompiler.java

示例6: 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);
	}*/
}
 
开发者ID:tarql,项目名称:tarql,代码行数:52,代码来源:TarqlQueryExecution.java


注:本文中的org.apache.jena.query.Query.isQueryResultStar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。