@Override public QueryAtom next(final ResultBinding binding) { return _sortedAtoms.get(_index++).apply(binding); }
private List<QueryAtom> _findAtoms(final Collection<ATermAppl> stopList, final QueryPredicate predicate, final ATermAppl... args) { final List<QueryAtom> list = new ArrayList<>(); for (final QueryAtom atom : _allAtoms) if (predicate.equals(atom.getPredicate())) { int i = 0; boolean add = true; for (final ATermAppl arg : atom.getArguments()) { final ATermAppl argValue = args[i++]; if (argValue != null && argValue != arg || stopList.contains(arg)) { add = false; break; } } if (add) list.add(atom); } return list; }
public NotKnownQueryAtom(final List<QueryAtom> atoms) { this._atoms = Collections.unmodifiableList(atoms); _isGround = true; _args = new ArrayList<>(); for (final QueryAtom atom : atoms) { _args.addAll(atom.getArguments()); if (_isGround && !atom.isGround()) _isGround = false; } }
if (!atom.isGround()) for (final ATermAppl a : atom.getArguments()) if (ATermUtils.isVar(a)) if (newBoundVars.add(a)) if (atom.getPredicate().equals(QueryPredicate.NotKnown)) for (int j = 0; j < atoms.size(); j++) if (i == j || nextAtom.getPredicate().equals(QueryPredicate.NotKnown)) continue; if (nextAtom.getArguments().contains(a))
final QueryAtom atom2 = atom.apply(binding); if (atom2.getPredicate().equals(QueryPredicate.NotKnown) && !atom2.isGround()) for (int j = 0; j < _atoms.size(); j++) if (SetUtils.intersects(nextAtom.getArguments(), atom2.getArguments()))
private void exec(final QueryAtom current, final ResultBinding binding) final List<ATermAppl> arguments = current.getArguments(); switch (current.getPredicate()) final CoreNewImpl core = (CoreNewImpl) current.apply(binding); newQuery.add(atom.apply(binding)); newQuery.add(atom.apply(binding)); for (final ATermAppl var : newQuery.getUndistVars()) break; default: throw new UnsupportedQueryException("Unknown atom type '" + current.getPredicate() + "'.");
@Override public List<ATermAppl> getArguments() { return _atom.getArguments(); }
if (current.isGround() && !current.getPredicate().equals(QueryPredicate.UndistVarCore))
@Override public QueryPredicate getPredicate() { return _atom.getPredicate(); }
@Override public boolean isGround() { return _atom.isGround(); }
if (!atom.isGround()) for (final ATermAppl a : atom.getArguments()) if (ATermUtils.isVar(a)) if (newBoundVars.add(a)) if (atom.getPredicate().equals(QueryPredicate.NotKnown)) for (int j = 0; j < atoms.size(); j++) if (i == j || nextAtom.getPredicate().equals(QueryPredicate.NotKnown)) continue; if (nextAtom.getArguments().contains(a))
final QueryAtom atom2 = atom.apply(binding); if (atom2.getPredicate().equals(QueryPredicate.NotKnown) && !atom2.isGround()) for (int j = 0; j < _atoms.size(); j++) if (SetUtils.intersects(nextAtom.getArguments(), atom2.getArguments()))
private void exec(final QueryAtom current, final ResultBinding binding) final List<ATermAppl> arguments = current.getArguments(); switch (current.getPredicate()) final CoreNewImpl core = (CoreNewImpl) current.apply(binding); newQuery.add(atom.apply(binding)); newQuery.add(atom.apply(binding)); for (final ATermAppl var : newQuery.getUndistVars()) break; default: throw new UnsupportedQueryException("Unknown atom type '" + current.getPredicate() + "'.");
@Override public List<ATermAppl> getArguments() { return _atom.getArguments(); }
if (current.isGround() && !current.getPredicate().equals(QueryPredicate.UndistVarCore))
@Override public QueryPredicate getPredicate() { return _atom.getPredicate(); }
@Override public boolean isGround() { return _atom.isGround(); }
private List<QueryAtom> _findAtoms(final Collection<ATermAppl> stopList, final QueryPredicate predicate, final ATermAppl... args) { final List<QueryAtom> list = new ArrayList<>(); for (final QueryAtom atom : _allAtoms) if (predicate.equals(atom.getPredicate())) { int i = 0; boolean add = true; for (final ATermAppl arg : atom.getArguments()) { final ATermAppl argValue = args[i++]; if (argValue != null && argValue != arg || stopList.contains(arg)) { add = false; break; } } if (add) list.add(atom); } return list; }
if (!atom.isGround()) for (final ATermAppl a : atom.getArguments()) if (ATermUtils.isVar(a)) if (newBoundVars.add(a)) if (atom.getPredicate().equals(QueryPredicate.NotKnown)) for (int j = 0; j < atoms.size(); j++) if (i == j || nextAtom.getPredicate().equals(QueryPredicate.NotKnown)) continue; if (nextAtom.getArguments().contains(a))
public NotKnownQueryAtom(final List<QueryAtom> atoms) { this._atoms = Collections.unmodifiableList(atoms); _isGround = true; _args = new ArrayList<>(); for (final QueryAtom atom : atoms) { _args.addAll(atom.getArguments()); if (_isGround && !atom.isGround()) _isGround = false; } }