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

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

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

QueryImpl.getDistVarsForType介绍

暂无

代码示例

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

/**
 * {@inheritDoc} TODO
 */
@Override
public ATermAppl rollUpTo(final ATermAppl var, final Collection<ATermAppl> stopList, final boolean stopOnConstants)
{
  if (getDistVarsForType(VarType.LITERAL).contains(var) && !getDistVarsForType(VarType.INDIVIDUAL).contains(var) && !_individualsAndLiterals.contains(var))
    throw new InternalReasonerException("Trying to roll up to the variable '" + var + "' which is not distinguished and _individual.");
  ATermList classParts = ATermUtils.EMPTY_LIST;
  final Set<ATermAppl> visited = new HashSet<>();
  if (stopOnConstants)
    visited.addAll(getConstants());
  final Collection<QueryAtom> inEdges = findAtoms(QueryPredicate.PropertyValue, null, null, var);
  for (final QueryAtom a : inEdges)
    classParts = classParts.append(rollEdgeIn(QueryPredicate.PropertyValue, a, visited, stopList));
  final Collection<QueryAtom> outEdges = findAtoms(QueryPredicate.PropertyValue, var, null, null);
  for (final QueryAtom a : outEdges)
    classParts = classParts.append(rollEdgeOut(QueryPredicate.PropertyValue, a, visited, stopList));
  classParts = classParts.concat(getClasses(var));
  return ATermUtils.makeAnd(classParts);
}

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

/**
 * {@inheritDoc}
 */
@Override
public Query apply(final ResultBinding binding)
{
  final List<QueryAtom> atoms = new ArrayList<>();
  for (final QueryAtom atom : getAtoms())
    atoms.add(atom.apply(binding));
  final QueryImpl query = new QueryImpl(this);
  query._resultVars.addAll(_resultVars);
  query._resultVars.removeAll(binding.getAllVariables());
  for (final VarType type : VarType.values())
    for (final ATermAppl atom : getDistVarsForType(type))
      if (!binding.isBound(atom))
        query.addDistVar(atom, type);
  for (final QueryAtom atom : atoms)
    query.add(atom);
  return query;
}

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

/**
 * {@inheritDoc} TODO
 */
@Override
public ATermAppl rollUpTo(final ATermAppl var, final Collection<ATermAppl> stopList, final boolean stopOnConstants)
{
  if (getDistVarsForType(VarType.LITERAL).contains(var) && !getDistVarsForType(VarType.INDIVIDUAL).contains(var) && !_individualsAndLiterals.contains(var))
    throw new InternalReasonerException("Trying to roll up to the variable '" + var + "' which is not distinguished and _individual.");
  ATermList classParts = ATermUtils.EMPTY_LIST;
  final Set<ATermAppl> visited = new HashSet<>();
  if (stopOnConstants)
    visited.addAll(getConstants());
  final Collection<QueryAtom> inEdges = findAtoms(QueryPredicate.PropertyValue, null, null, var);
  for (final QueryAtom a : inEdges)
    classParts = classParts.append(rollEdgeIn(QueryPredicate.PropertyValue, a, visited, stopList));
  final Collection<QueryAtom> outEdges = findAtoms(QueryPredicate.PropertyValue, var, null, null);
  for (final QueryAtom a : outEdges)
    classParts = classParts.append(rollEdgeOut(QueryPredicate.PropertyValue, a, visited, stopList));
  classParts = classParts.concat(getClasses(var));
  return ATermUtils.makeAnd(classParts);
}

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

/**
 * {@inheritDoc} TODO
 */
@Override
public ATermAppl rollUpTo(final ATermAppl var, final Collection<ATermAppl> stopList, final boolean stopOnConstants)
{
  if (getDistVarsForType(VarType.LITERAL).contains(var) && !getDistVarsForType(VarType.INDIVIDUAL).contains(var) && !_individualsAndLiterals.contains(var))
    throw new InternalReasonerException("Trying to roll up to the variable '" + var + "' which is not distinguished and _individual.");
  ATermList classParts = ATermUtils.EMPTY_LIST;
  final Set<ATermAppl> visited = new HashSet<>();
  if (stopOnConstants)
    visited.addAll(getConstants());
  final Collection<QueryAtom> inEdges = findAtoms(QueryPredicate.PropertyValue, null, null, var);
  for (final QueryAtom a : inEdges)
    classParts = classParts.append(rollEdgeIn(QueryPredicate.PropertyValue, a, visited, stopList));
  final Collection<QueryAtom> outEdges = findAtoms(QueryPredicate.PropertyValue, var, null, null);
  for (final QueryAtom a : outEdges)
    classParts = classParts.append(rollEdgeOut(QueryPredicate.PropertyValue, a, visited, stopList));
  classParts = classParts.concat(getClasses(var));
  return ATermUtils.makeAnd(classParts);
}

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

/**
 * {@inheritDoc}
 */
@Override
public Query apply(final ResultBinding binding)
{
  final List<QueryAtom> atoms = new ArrayList<>();
  for (final QueryAtom atom : getAtoms())
    atoms.add(atom.apply(binding));
  final QueryImpl query = new QueryImpl(this);
  query._resultVars.addAll(_resultVars);
  query._resultVars.removeAll(binding.getAllVariables());
  for (final VarType type : VarType.values())
    for (final ATermAppl atom : getDistVarsForType(type))
      if (!binding.isBound(atom))
        query.addDistVar(atom, type);
  for (final QueryAtom atom : atoms)
    query.add(atom);
  return query;
}

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

/**
 * {@inheritDoc}
 */
@Override
public Query apply(final ResultBinding binding)
{
  final List<QueryAtom> atoms = new ArrayList<>();
  for (final QueryAtom atom : getAtoms())
    atoms.add(atom.apply(binding));
  final QueryImpl query = new QueryImpl(this);
  query._resultVars.addAll(_resultVars);
  query._resultVars.removeAll(binding.getAllVariables());
  for (final VarType type : VarType.values())
    for (final ATermAppl atom : getDistVarsForType(type))
      if (!binding.isBound(atom))
        query.addDistVar(atom, type);
  for (final QueryAtom atom : atoms)
    query.add(atom);
  return query;
}

相关文章