本文整理了Java中org.apache.jena.query.Query.isQueryResultStar
方法的一些代码示例,展示了Query.isQueryResultStar
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.isQueryResultStar
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:isQueryResultStar
[英]Answer whether the query had SELECT/DESCRIBE/CONSTRUCT
[中]回答查询是否包含SELECT/DESCRIBE/CONSTRUCT
代码示例来源:origin: apache/tinkerpop
if (!query.isQueryResultStar() && !query.hasGroupBy()) {
final String[] all = new String[vars.size()];
vars.toArray(all);
代码示例来源:origin: apache/jena
@Override
public void visitSelectResultForm(Query query)
{
//query.setResultVars() ;
if ( ! query.isQueryResultStar() )
x^= query.getProject().hashCode() ;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static boolean isDistinctConceptVar(Query query, Var conceptVar) {
boolean isDistinct = query.isDistinct();
Collection<Var> projectVars = query.getProjectVars();
boolean hasSingleVar = !query.isQueryResultStar() && projectVars != null && projectVars.size() == 1;
boolean result = isDistinct && hasSingleVar && projectVars.iterator().next().equals(conceptVar);
return result;
}
代码示例来源: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
@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() ) ;
}
代码示例来源:origin: dkuppitz/sparql-gremlin
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()) {
代码示例来源:origin: TopQuadrant/shacl
@Override
public void startElement(ElementSubQuery el) {
if(el.getQuery().isQueryResultStar()) {
Set<Var> queryVars = new LinkedHashSet<>() ;
PatternVars.vars(queryVars, el.getQuery().getQueryPattern()) ;
for(String varName : preBoundVars) {
if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) {
if(!queryVars.contains(Var.alloc(varName))) {
results.add("Sub-query must return all potentially pre-bound variables including $" + varName);
}
}
}
}
else {
VarExprList project = el.getQuery().getProject();
for(String varName : preBoundVars) {
if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) {
if(!project.contains(Var.alloc(varName))) {
results.add("Sub-query must return all potentially pre-bound variables including $" + varName);
}
}
}
}
}
代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl
@Override
public void startElement(ElementSubQuery el) {
if(el.getQuery().isQueryResultStar()) {
Set<Var> queryVars = new LinkedHashSet<>() ;
PatternVars.vars(queryVars, el.getQuery().getQueryPattern()) ;
for(String varName : preBoundVars) {
if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) {
if(!queryVars.contains(Var.alloc(varName))) {
results.add("Sub-query must return all potentially pre-bound variables including $" + varName);
}
}
}
}
else {
VarExprList project = el.getQuery().getProject();
for(String varName : preBoundVars) {
if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) {
if(!project.contains(Var.alloc(varName))) {
results.add("Sub-query must return all potentially pre-bound variables including $" + varName);
}
}
}
}
}
代码示例来源:origin: apache/jena
@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() ;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public Op getApplicableViews(Query query)
{
Op op = Algebra.compile(query);
op = Algebra.toQuadForm(op);
op = ReplaceConstants.replace(op);
//op = FilterPlacementOptimizer.optimize(op);
// Add a projection if the query contains a result star
// in order to filter out auto-generated variables
if(query.isSelectType() && query.isQueryResultStar()) {
List<Var> vars = query.getProjectVars();
op = new OpProject(op, vars);
}
System.out.println("Quad form:" + op);
//Set<OpSparqlViewPattern> result = getApplicableViews(op);
//Set<OpSparqlViewPattern> result = getApplicableViews(op);
//TransformFilterPlacement transformer = new TransformFilterPlacement();
//op.(transformer);
//op = Algebra.optimize(op);
Op augmented = _getApplicableViews(op);
//Op optimizedFilters = FilterPlacementOptimizer2.optimize(augmented);
//System.out.println(optimizedFilters);
Op result = augmented;
//Op result = optimizedFilters;
System.out.println(result);
return result;
//return getApp
}
代码示例来源:origin: apache/jena
if ( isQueryResultStar() )
findAndAddNamedVars() ;
return ;
if ( isQueryResultStar() )
findAndAddNamedVars() ;
return ;
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
if(query.isSelectType() && query.isQueryResultStar()) {
List<Var> vars = query.getProjectVars();
op = new OpProject(op, vars);
代码示例来源:origin: apache/jena
private static void check(Query query, Collection<Var> vars)
{
// Check any expressions are assigned to fresh variables.
checkExprListAssignment(vars, query.getProject()) ;
// Check for SELECT * GROUP BY
// Legal in ARQ, not in SPARQL 1.1
if ( ! Syntax.syntaxARQ.equals(query.getSyntax()) )
{
if ( query.isQueryResultStar() && query.hasGroupBy() )
throw new QueryParseException("SELECT * not legal with GROUP BY", -1 , -1) ;
}
// Check any variable in an expression is in scope (if GROUP BY)
checkExprVarUse(query) ;
// Check GROUP BY AS
// ENABLE
if ( false && query.hasGroupBy() )
{
VarExprList exprList2 = query.getGroupBy() ;
checkExprListAssignment(vars, exprList2) ;
// CHECK
}
}
代码示例来源:origin: apache/jena
@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() ;
}
代码示例来源:origin: apache/jena
@Override
public void startVisit(Query query) {
newQuery.setSyntax(query.getSyntax());
if (query.explicitlySetBaseURI())
newQuery.setBaseURI(query.getPrologue().getResolver());
newQuery.setQueryResultStar(query.isQueryResultStar());
if (query.hasDatasetDescription()) {
DatasetDescription desc = query.getDatasetDescription();
for (String x : desc.getDefaultGraphURIs())
newQuery.addGraphURI(x);
for (String x : desc.getDefaultGraphURIs())
newQuery.addNamedGraphURI(x);
}
// Aggregators.
newQuery.getAggregators().addAll(query.getAggregators());
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void startVisit(Query query) {
newQuery.setSyntax(query.getSyntax()) ;
if ( query.explicitlySetBaseURI() )
newQuery.setBaseURI(query.getPrologue().getResolver()) ;
newQuery.setQueryResultStar(query.isQueryResultStar()) ;
if ( query.hasDatasetDescription() ) {
DatasetDescription desc = query.getDatasetDescription() ;
for (String x : desc.getDefaultGraphURIs())
newQuery.addGraphURI(x) ;
for (String x : desc.getDefaultGraphURIs())
newQuery.addNamedGraphURI(x) ;
}
// Aggregators.
newQuery.getAggregators().addAll(query.getAggregators()) ;
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Add all the variables from the select handler variable.
*
* @param selectHandler
* The select handler to copy the variables from.
*/
public void addAll(SelectHandler selectHandler) {
setReduced(selectHandler.query.isReduced());
setDistinct(selectHandler.query.isDistinct());
query.setQueryResultStar(selectHandler.query.isQueryResultStar());
VarExprList shProjectVars = selectHandler.query.getProject();
VarExprList qProjectVars = query.getProject();
for (Var var : shProjectVars.getVars()) {
// make sure there are no duplicates
if (!qProjectVars.contains(var)) {
qProjectVars.add(var, shProjectVars.getExpr(var));
}
}
aggHandler.addAll( selectHandler.aggHandler );
}
代码示例来源:origin: tarql/tarql
for (Var var: table.getVars()) {
if (query.isSelectType() && query.isQueryResultStar()
&& var.equals(TarqlQuery.ROWNUM)) continue;
tableElement.add(var);
if (query.isSelectType() && query.isQueryResultStar()) {
代码示例来源:origin: apache/jena
/**
* Add all the variables from the select handler variable.
*
* @param selectHandler
* The select handler to copy the variables from.
*/
public void addAll(SelectHandler selectHandler) {
setReduced(selectHandler.query.isReduced());
setDistinct(selectHandler.query.isDistinct());
query.setQueryResultStar(selectHandler.query.isQueryResultStar());
VarExprList shProjectVars = selectHandler.query.getProject();
VarExprList qProjectVars = query.getProject();
for (Var var : shProjectVars.getVars()) {
// make sure there are no duplicates
if (!qProjectVars.contains(var)) {
qProjectVars.add(var, shProjectVars.getExpr(var));
}
}
aggHandler.addAll( selectHandler.aggHandler );
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static long countQuery(Query query, QueryExecutionFactory qef) {
boolean needsWrapping = !query.getGroupBy().isEmpty() || !query.getAggregators().isEmpty();
boolean useCountDistinct = !needsWrapping && query.isDistinct() && query.isQueryResultStar();
内容来源于网络,如有侵权,请联系作者删除!