org.apache.jena.query.Query.getProject()方法的使用及代码示例

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

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

Query.getProject介绍

[英]Return a list of the variables requested (SELECT)
[中]返回所请求变量的列表(选择)

代码示例

代码示例来源:origin: apache/jena

/**
 * Return the projected var expression list.
 * 
 * @return The projected var expression list.
 */
public VarExprList getProject() {
  return query.getProject();
}

代码示例来源:origin: apache/jena

@Override
  public void build() {
    if (query.getProject().getVars().isEmpty()) {
      query.setQueryResultStar(true);
    }
    
    aggHandler.build();
    
    // handle the SELECT * case
    query.getProjectVars();
  }
}

代码示例来源:origin: org.apache.jena/jena-querybuilder

/**
 * Return the projected var expression list.
 * 
 * @return The projected var expression list.
 */
public VarExprList getProject() {
  return query.getProject();
}

代码示例来源:origin: org.apache.jena/jena-querybuilder

@Override
  public void build() {
    if (query.getProject().getVars().isEmpty()) {
      query.setQueryResultStar(true);
    }
    
    aggHandler.build();
    
    // handle the SELECT * case
    query.getProjectVars();
  }
}

代码示例来源:origin: apache/jena

@Override
public void build() {
  for (Map.Entry<Var,Expr> entry : query.getProject().getExprs().entrySet())
  {
    if (aggMap.containsKey(entry.getKey()))
    {
      entry.setValue( aggMap.get(entry.getKey()));
    }
  }
}

代码示例来源:origin: org.aksw.rdfunit/rdfunit-model

private Optional<ResultAnnotation> getPathAnnotation() {
  if (query.getResultVars().contains("path")) {
    List<Var> vars = query.getProjectVars();
    VarExprList vel = query.getProject();
    return Optional.of(
      createVariableAnnotation(SHACL.resultPath, "path"));
  } else {
    if (shape.getPath().isPresent()) {
      return Optional.of(
        createValueAnnotation(SHACL.resultPath, shape.getPath().get().getPathAsRdf()));
    }
  }
  return Optional.empty();
}

代码示例来源:origin: org.apache.jena/jena-querybuilder

@Override
public void build() {
  for (Map.Entry<Var,Expr> entry : query.getProject().getExprs().entrySet())
  {
    if (aggMap.containsKey(entry.getKey()))
    {
      entry.setValue( aggMap.get(entry.getKey()));
    }
  }
}

代码示例来源:origin: apache/jena

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

代码示例来源:origin: apache/jena

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

代码示例来源:origin: apache/jena

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

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

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

代码示例来源:origin: TopQuadrant/shacl

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

代码示例来源: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: SmartDataAnalytics/jena-sparql-api

public static Query wrapAsSubQuery(Query query, Var v) {
  Element esq = new ElementSubQuery(query);
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(v);
  result.setQueryPattern(esq);
  return result;
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

public static Query createSubQuery(Query query, Var var) {
  Element esq = new ElementSubQuery(query);
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(var);
  result.setQueryPattern(esq);
  return result;
}

代码示例来源:origin: apache/jena

@Override
public void visitSelectResultForm(Query query) {
  newQuery.setQuerySelectType();
  newQuery.setDistinct(query.isDistinct());
  VarExprList x = query.getProject();
  for (Var v : x.getVars()) {
    Expr expr = x.getExpr(v);
    if (expr == null)
      newQuery.addResultVar(v);
    else
      newQuery.addResultVar(v, expr);
  }
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
public void visitSelectResultForm(Query query) {
  newQuery.setQuerySelectType() ;
  newQuery.setDistinct(query.isDistinct()) ;
  VarExprList x = query.getProject() ;
  for (Var v : x.getVars()) {
    Expr expr = x.getExpr(v) ;
    if ( expr == null )
      newQuery.addResultVar(v) ;
    else
      newQuery.addResultVar(v, expr) ;
  }
}

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

public static Query createQueryCount(Var countVar, Element e, Long limit) {
  if(limit != null) {
    e = limitElement(e, limit);
  }
  Var tmpVar = Var.alloc(countVar.getName() + "_tmp_");
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(countVar, new ExprAggregator(tmpVar, new AggCount()));
  result.setQueryPattern(e);
  return result;
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

public static Query createQueryCount(Var countVar, Element e, Long limit) {
  if(limit != null) {
    e = limitElement(e, limit);
  }
  Var tmpVar = Var.alloc(countVar.getName() + "_tmp_");
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(countVar, new ExprAggregator(tmpVar, new AggCount()));
  result.setQueryPattern(e);
  return result;
}

代码示例来源: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() ;
}

相关文章