com.hp.hpl.jena.query.Query.getProject()方法的使用及代码示例

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

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

Query.getProject介绍

[英]Return a list of the variables requested (SELECT)
[中]

代码示例

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public void visitSelectResultForm(Query query)
{ 
  //query.setResultVars() ;
  if ( ! query.isQueryResultStar() )
    x^= query.getProject().hashCode() ;
}

代码示例来源:origin: ldp4j/ldp4j

String query(String query) {
  LOGGER.info("Using JENA:");
  Query q=QueryFactory.create(query);
  LOGGER.info("-- Query:\n"+q);
  LOGGER.info("-- Base: "+q.getBaseURI());
  LOGGER.info("-- Prefixes: "+q.getPrefixMapping());
  LOGGER.info("-- Variables: "+q.getProjectVars());
  Set<Var> variables=new HashSet<Var>(q.getProjectVars());
  for(Entry<Var, Expr> entry:q.getProject().getExprs().entrySet()) {
    Var shadowing = entry.getKey();
    VariableShadowingDetector detector = new VariableShadowingDetector(new IndentUtils(),shadowing);
    entry.getValue().visit(detector);
    if(detector.isShadowing()) {
      variables.remove(shadowing);
      variables.add(detector.getShadowed());
    }
  }
  LOGGER.info("-- Graph URIS: "+q.getGraphURIs());
  LOGGER.info("-- Named graphd URIS: "+q.getNamedGraphURIs());
  List<String> search=q.getNamedGraphURIs();
  q.getQueryPattern().visit(new ElementVisitorImplementation(search,variables));
  return null;
}

代码示例来源:origin: com.hp.hpl.jena/arq

public void visitSelectResultForm(Query query)
{ 
  //query.setResultVars() ;
  if ( ! query.isQueryResultStar() )
    x^= query.getProject().hashCode() ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

private static void checkQueryScope(Query query)
{
  Collection<Var> vars = varsOfQuery(query) ;
  checkExprListAssignment(vars, query.getProject()) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public void visit(ElementSubQuery el)
{
  el.getQuery().setResultVars() ;
  VarExprList x = el.getQuery().getProject() ;
  acc.addAll(x.getVars()) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
public void visit(ElementSubQuery el)
{
  el.getQuery().setResultVars() ;
  VarExprList x = el.getQuery().getProject() ;
  acc.addAll(x.getVars()) ;
  
  // And any GROUP BY 
  x = el.getQuery().getGroupBy() ;
  acc.addAll(x.getVars()) ;
  
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@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: org.apache.clerezza.ext/org.apache.jena.jena-arq

VarExprList exprList = query.getProject() ;

代码示例来源:origin: com.hp.hpl.jena/arq

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: com.hp.hpl.jena/arq

VarExprList exprList = query.getProject() ;

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

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: com.hp.hpl.jena/arq

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: com.hp.hpl.jena/arq

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: org.apache.clerezza.ext/org.apache.jena.jena-arq

@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: com.hp.hpl.jena/arq

VarExprList projectVars = query.getProject() ;
    Log.warn(this,"No project variables") ;
  for ( Var v : query.getProject().getVars() )
    Expr e = query.getProject().getExpr(v) ;
    if ( e != null )

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

VarExprList projectVars = query.getProject() ;
    Log.warn(this,"No project variables") ;
  for ( Var v : query.getProject().getVars() )
    Expr e = query.getProject().getExpr(v) ;
    if ( e != null )

相关文章