openllet.query.sparqldl.model.Query.getResultVars()方法的使用及代码示例

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

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

Query.getResultVars介绍

[英]Return all the variables that will be in the results. For SPARQL, these are the variables in the SELECT clause.
[中]返回结果中的所有变量。对于SPARQL,这些是SELECT子句中的变量。

代码示例

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

private ResultBinding process(final ResultBinding binding)
  {
    if (_parameters == null)
      return binding;

    final int numOfVars = _query.getResultVars().size();

    // Add the _query _parameters to the binding if the variable is in the
    // _query projection
    for (final Entry<ATermAppl, ATermAppl> entry : _parameters.entrySet())
    {
      final ATermAppl var = entry.getKey();
      final ATermAppl value = entry.getValue();

      if (numOfVars == 0 || _query.getResultVars().contains(var))
        binding.setValue(var, value);
    }

    return binding;
  }
}

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

private ResultBinding process(final ResultBinding binding)
  {
    if (_parameters == null)
      return binding;

    final int numOfVars = _query.getResultVars().size();

    // Add the _query _parameters to the binding if the variable is in the
    // _query projection
    for (final Entry<ATermAppl, ATermAppl> entry : _parameters.entrySet())
    {
      final ATermAppl var = entry.getKey();
      final ATermAppl value = entry.getValue();

      if (numOfVars == 0 || _query.getResultVars().contains(var))
        binding.setValue(var, value);
    }

    return binding;
  }
}

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

public QueryResultImpl(final Query query)
{
  _query = query;
  _parameters = query.getQueryParameters();
  _resultVars = new ArrayList<>(query.getResultVars());
  if (query.isDistinct())
    _bindings = new HashSet<>();
  else
    _bindings = new ArrayList<>();
}

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

private ResultBinding process(final ResultBinding binding)
  {
    if (_parameters == null)
      return binding;

    final int numOfVars = _query.getResultVars().size();

    // Add the _query _parameters to the binding if the variable is in the
    // _query projection
    for (final Entry<ATermAppl, ATermAppl> entry : _parameters.entrySet())
    {
      final ATermAppl var = entry.getKey();
      final ATermAppl value = entry.getValue();

      if (numOfVars == 0 || _query.getResultVars().contains(var))
        binding.setValue(var, value);
    }

    return binding;
  }
}

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

public QueryResultImpl(final Query query)
{
  _query = query;
  _parameters = query.getQueryParameters();
  _resultVars = new ArrayList<>(query.getResultVars());
  if (query.isDistinct())
    _bindings = new HashSet<>();
  else
    _bindings = new ArrayList<>();
}

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

public QueryResultImpl(final Query query)
{
  _query = query;
  _parameters = query.getQueryParameters();
  _resultVars = new ArrayList<>(query.getResultVars());
  if (query.isDistinct())
    _bindings = new HashSet<>();
  else
    _bindings = new ArrayList<>();
}

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

results.add(execSingleQuery(q));
r = new MultiQueryResults(query.getResultVars(), results);

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

results.add(execSingleQuery(q));
r = new MultiQueryResults(query.getResultVars(), results);

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

results.add(execSingleQuery(q));
r = new MultiQueryResults(query.getResultVars(), results);

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

protected void testQuery(final Query query, final ATermAppl[]... values)
{
  final List<ATermAppl> resultVars = query.getResultVars();
  final Map<List<ATermAppl>, Integer> answers = new HashMap<>();
  for (final ATermAppl[] value : values)
  {
    final List<ATermAppl> answer = Arrays.asList(value);
    final Integer count = answers.get(answer);
    if (count == null)
      answers.put(answer, 1);
    else
      answers.put(answer, count + 1);
  }
  final QueryResult result = QueryEngine.exec(query);
  for (final ResultBinding binding : result)
  {
    final List<ATermAppl> list = new ArrayList<>(resultVars.size());
    for (final ATermAppl var : resultVars)
      list.add(binding.getValue(var));
    final Integer count = answers.get(list);
    if (count == null)
      Assert.fail("Unexpected binding in the result: " + list);
    else
      if (count == 1)
        answers.remove(list);
      else
        answers.put(list, count - 1);
  }
  assertTrue("Unfound bindings: " + answers.keySet(), answers.isEmpty());
}

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

replaceA2 = true;
      else
        if (ATermUtils.isVar(a1) && !q.getResultVars().contains(a1))
          replaceA1 = true;
        else
          if (ATermUtils.isVar(a2) && !q.getResultVars().contains(a2))
            replaceA2 = true;
if (a1.equals(a2) && !q.getResultVars().contains(a1) && q.getAtoms().size() > 1)
  q.remove(atom);

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

final Set<ATermAppl> resultVars = new HashSet<>(query.getResultVars());

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

final Set<ATermAppl> resultVars = new HashSet<>(query.getResultVars());

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

final Set<ATermAppl> resultVars = new HashSet<>(query.getResultVars());

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

result = distCombinedQueryExec.exec(schemaQuery);
shouldHaveBinding = openllet.core.utils.SetUtils.intersects(query.getDistVarsForType(VarType.CLASS), query.getResultVars()) || openllet.core.utils.SetUtils.intersects(query.getDistVarsForType(VarType.PROPERTY), query.getResultVars());

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

result = distCombinedQueryExec.exec(schemaQuery);
shouldHaveBinding = openllet.core.utils.SetUtils.intersects(query.getDistVarsForType(VarType.CLASS), query.getResultVars()) || openllet.core.utils.SetUtils.intersects(query.getDistVarsForType(VarType.PROPERTY), query.getResultVars());

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

result = distCombinedQueryExec.exec(schemaQuery);
shouldHaveBinding = openllet.core.utils.SetUtils.intersects(query.getDistVarsForType(VarType.CLASS), query.getResultVars()) || openllet.core.utils.SetUtils.intersects(query.getDistVarsForType(VarType.PROPERTY), query.getResultVars());

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

for (final ATermAppl a : query.getResultVars())

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

for (final ATermAppl a : query.getResultVars())

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

for (final ATermAppl a : query.getResultVars())

相关文章