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

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

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

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

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

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: apache/jena

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

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

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

代码示例来源: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

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: SmartDataAnalytics/jena-sparql-api

public static Query asQuery(Op op, Dialect dialect)
{
  Query query = QueryFactory.make() ;
  Converter v = new Converter(query, dialect) ;
  //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: apache/jena

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

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

/**
 *
 *
 * @param pattern
 *            a pattern of a where-clause
 * @param resultVar
 *            an optional result variable (used for describe queries)
 * @return
 */
public static Query elementToQuery(Element pattern, String resultVar) {
  if (pattern == null)
    return null;
  Query query = new Query();
  query.setQueryPattern(pattern);
  query.setQuerySelectType();
  if (resultVar == null) {
    query.setQueryResultStar(true);
  }
  query.setResultVars();
  if (resultVar != null) {
    query.getResultVars().add(resultVar);
  }
  return query;
}

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

@Override
public QueryExecution createQueryExecution(Query query) {
  // Copied from internals of jena's QueryExecutionFactory.create(query, dataset);
  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 = QueryEngineRegistry.get().find(query, dsg, context);
  if ( f == null )
  {
    Log.warn(QueryExecutionFactory.class, "Failed to find a QueryEngineFactory for query: "+query) ;
    return null ;
  }
  //dataset.begin(ReadWrite.WRITE);
  return new QueryExecutionBase(query, dataset, context, f) ;
}

代码示例来源:origin: com.github.galigator.openllet/openllet-jena

sparql.setResultVars();

代码示例来源:origin: Galigator/openllet

sparql.setResultVars();

代码示例来源:origin: Galigator/openllet

sparql.setResultVars();

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

processQueryPattern(op, assignments) ;
  query.setQueryResultStar(true) ;
  query.setResultVars(); 
  return query ;
  query.setLimit(level.opSlice.getLength()) ;
query.setResultVars() ;
return query ;

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

Query q = new Query();
q.setQuerySelectType();
q.setResultVars();
for(String v : query.getResultVars()) {
  q.addResultVar(v);

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

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

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

query.setResultVars();

相关文章