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

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

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

Query.setResultVars介绍

[英]Fix up when the query has "" (when SELECT * or DESCRIBE ) and for a construct query. This operation is idempotent.
[中]当查询包含“
”(当选择
或描述*时)和构造查询时进行修复。这个运算是幂等的。

代码示例

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

/** Perform some check on the query */ 
public void validate()
{
  // This is mostly done now as part of parsing.
  // See SyntaxVarScope and Parser.validatePasredQuery.
  setResultVars() ;
}

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

/** Return a list of the variables requested (SELECT) */
public List<Var> getProjectVars()
{ 
  // Ensure "SELECT *" processed
  setResultVars() ;
  return projectVars.getVars() ;
}

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

/** Return a list of the variables requested (SELECT) */
public List<Var> getProjectVars()
{ 
  // Ensure "SELECT *" processed
  setResultVars() ;
  return projectVars.getVars() ;
}

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

public static boolean equals(Query query1, Query query2)
{
  if ( query1 == query2 ) return true ;
  
  query1.setResultVars() ;
  query2.setResultVars() ;
  QueryCompare visitor = new QueryCompare(query1) ;
  try {
    query2.visit(visitor) ;
  } catch ( ComparisonException ex)
  {
    return false ;
  }
  return visitor.isTheSame() ;
}

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

public static boolean equals(Query query1, Query query2)
{
  if ( query1 == query2 ) return true ;
  
  query1.setResultVars() ;
  query2.setResultVars() ;
  QueryCompare visitor = new QueryCompare(query1) ;
  try {
    query2.visit(visitor) ;
  } catch ( ComparisonException ex)
  {
    return false ;
  }
  return visitor.isTheSame() ;
}

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

/** Return a list of the variables requested (SELECT) */
public List<String> getResultVars()
{ 
  // Ensure "SELECT *" processed
  setResultVars() ;
  return Var.varNames(projectVars.getVars()) ;
}

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

/** Return a list of the variables requested (SELECT) */
public List<String> getResultVars()
{ 
  // Ensure "SELECT *" processed
  setResultVars() ;
  return Var.varNames(projectVars.getVars()) ;
}

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

protected QueryEngineBase(Query query,
             DatasetGraph dataset, 
             Binding input,
             Context cxt)
{
  this(dataset, input, cxt) ;
  this.query = query ;
  query.setResultVars() ;
  // Unoptimized so far.
  setOp(createOp(query)) ;
}

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

protected QueryEngineBase(Query query,
             DatasetGraph dataset, 
             Binding input,
             Context context)
{
  this(dataset, input, context) ;
  this.query = query ;
  this.context.put(ARQConstants.sysCurrentQuery, query) ;
  // Build the Op.
  query.setResultVars() ;
  // Unoptimized so far.
  setOp(createOp(query)) ;
}

代码示例来源: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: org.apache.clerezza.ext/org.apache.jena.jena-arq

Query convert() {
  if (hasRun) {
    return this.query;
  } else {
    try {
      op.visit(this) ;
      
      Collection<Var> vars = this.projectVars;
      query.setQueryResultStar(vars.isEmpty());   // SELECT * unless we are projecting

      Iterator<Var> iter = vars.iterator();
      for (; iter.hasNext();) {
        Var var = iter.next();           
        if (this.varExpression.containsKey(var))
          query.addResultVar(var, this.varExpression.get(var));
        else
          query.addResultVar(var);
      }
      
      ElementGroup eg = this.currentGroup ;                   
      query.setQueryPattern(eg) ;
      query.setQuerySelectType() ;
      query.setResultVars() ;                     // Variables from the group.
      return query ; 
    } finally {
      this.hasRun = true;
    }
  }
}

代码示例来源: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: com.hp.hpl.jena/arq

public static Query asQuery(Op op)
{
  Query query = QueryFactory.make() ;
  
  Converter v = new Converter(query) ;
  //OpWalker.walk(op, v) ;
  op.visit(v) ;
  
  List<Var> vars = v.projectVars;
  query.setQueryResultStar(vars.isEmpty()); // SELECT * unless we are projecting
  Iterator<Var> iter = vars.iterator();
  for (; iter.hasNext();) {
    Var var = iter.next();
    if (v.varExpression.containsKey(var))
      query.addResultVar(var, v.varExpression.get(var));
    else
      query.addResultVar(var);
  }
  
  ElementGroup eg = v.currentGroup ;
  query.setQueryPattern(eg) ;
  query.setQuerySelectType() ;
  
  query.setResultVars() ; 
  return query ; 
}

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

protected Query elementToQuery(Element pattern)
{
  if ( pattern == null )
    return null ;
  Query query = new Query() ;
  query.setQueryPattern(pattern) ;
  query.setQuerySelectType() ;
  query.setQueryResultStar(true) ;
  query.setResultVars() ;
  return query ;
}

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

protected Query elementToQuery(Element pattern)
{
  if ( pattern == null )
    return null ;
  Query query = new Query() ;
  query.setQueryPattern(pattern) ;
  query.setQuerySelectType() ;
  query.setQueryResultStar(true) ;
  query.setResultVars() ;
  return query ;
}

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

protected static QueryExecution make(Query query, Dataset dataset, Context context)
{
  query.setResultVars() ;
  if ( context == null )
    context = ARQ.getContext();  // .copy done in QueryExecutionBase -> Context.setupContext. 
  DatasetGraph dsg = null ;
  if ( dataset != null )
    dsg = dataset.asDatasetGraph() ;
  QueryEngineFactory f = findFactory(query, dsg, context);
  if ( f == null )
  {
    Log.warn(QueryExecutionFactory.class, "Failed to find a QueryEngineFactory for query: "+query) ;
    return null ;
  }
  return new QueryExecutionBase(query, dataset, context, f) ;
}

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

static private QueryExecution make(Query query, Dataset dataset, Context context)
{
  query.setResultVars() ;
  if ( context == null )
    context = ARQ.getContext().copy();  // .copy probably not necessary but safe. 
  DatasetGraph dsg = null ;
  if ( dataset != null )
    dsg = dataset.asDatasetGraph() ;
  QueryEngineFactory f = findFactory(query, dsg, context);
  if ( f == null )
  {
    Log.warn(QueryExecutionFactory.class, "Failed to find a QueryEngineFactory for query: "+query) ;
    return null ;
  }
  return new QueryExecutionBase(query, dataset, context, f) ;
}

代码示例来源:origin: com.github.ansell.pellet/pellet-query

sparql.setResultVars();

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

throw new QueryExecException("Attempt to get a DESCRIBE result from a "+labelForQuery(query)+" query") ; 
query.setResultVars() ;

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

throw new QueryExecException("Attempt to get a DESCRIBE result from a "+labelForQuery(query)+" query") ; 
query.setResultVars() ;

相关文章