public boolean assertAtom(final RuleAtom atom, final VariableBinding binding, final DependencySet ds, final boolean negated, final ABox abox, final CompletionStrategy strategy) { _asserted = true; _binding = binding; _ds = ds; _negated = negated; _strategy = strategy; _abox = abox; atom.accept(this); return _asserted; }
@Override public boolean equals(final Object other) { if (other != null && getClass().equals(other.getClass())) { final RuleAtom atom = (RuleAtom) other; return getPredicate().equals(atom.getPredicate()) && getAllArguments().equals(atom.getAllArguments()); } return false; }
@Override public boolean matches(final RuleAtom atom) { return (atom instanceof ClassAtom) && atom.getPredicate().equals(_predicate) && argMatches((ClassAtom) atom); }
private static NodeProvider createNodeProvider(final AtomVariable arg, final List<RuleAtom> processed, final boolean lastWME) { for (int index = 0, n = processed.size(); index < n; index++) { final RuleAtom sharedAtom = processed.get(index); final int indexArg = sharedAtom.getAllArguments().indexOf(arg); if (indexArg != -1) if (lastWME && index == n - 1) return new WMENodeProvider(indexArg); else return new TokenNodeProvider(index, indexArg); } return null; }
@Override public boolean matches(final RuleAtom atom) { return (atom instanceof ClassAtom) && atom.getPredicate().equals(_predicate) && argMatches((ClassAtom) atom); }
private static NodeProvider createNodeProvider(final AtomVariable arg, final List<RuleAtom> processed, final boolean lastWME) { for (int index = 0, n = processed.size(); index < n; index++) { final RuleAtom sharedAtom = processed.get(index); final int indexArg = sharedAtom.getAllArguments().indexOf(arg); if (indexArg != -1) if (lastWME && index == n - 1) return new WMENodeProvider(indexArg); else return new TokenNodeProvider(index, indexArg); } return null; }
/** * @param atom * @return maybe true if _atom is something that will be added to the ABox during completion. */ public boolean isSafe(final RuleAtom atom) { atom.accept(this); return result; }
@Override @SuppressWarnings("rawtypes") public boolean matches(final RuleAtom atom) { return (atom instanceof IndividualPropertyAtom || atom instanceof DatavaluedPropertyAtom) && atom.getPredicate().equals(_role.getName()) && ((BinaryAtom) atom).getArgument1() instanceof AtomVariable && ((BinaryAtom) atom).getArgument2() instanceof AtomVariable; }
private RuleAtom pickNextAtom(final List<RuleAtom> atoms, final Set<AtomVariable> bound) { int index = 0; if (bound.isEmpty()) for (int i = 0; i < atoms.size(); i++) { final RuleAtom atom = atoms.get(i); if (_safetyChecker.isSafe(atom)) return atoms.remove(i); } else for (int i = 0; i < atoms.size(); i++) { final RuleAtom atom = atoms.get(i); if (SetUtils.intersects(bound, atom.getAllArguments())) { index = i; if (_safetyChecker.isSafe(atom)) break; } } return atoms.remove(index); }
@Override public boolean equals(final Object other) { if (other != null && getClass().equals(other.getClass())) { final RuleAtom atom = (RuleAtom) other; return getPredicate().equals(atom.getPredicate()) && getAllArguments().equals(atom.getAllArguments()); } return false; }
public ATermAppl translate(final RuleAtom ruleAtom) { _term = null; ruleAtom.accept(this); return _term; }
@Override @SuppressWarnings("rawtypes") public boolean matches(final RuleAtom atom) { return (atom instanceof IndividualPropertyAtom || atom instanceof DatavaluedPropertyAtom) && atom.getPredicate().equals(_role.getName()) && ((BinaryAtom) atom).getArgument1() instanceof AtomVariable && ((BinaryAtom) atom).getArgument2() instanceof AtomVariable; }
private RuleAtom pickNextAtom(final List<RuleAtom> atoms, final Set<AtomVariable> bound) { int index = 0; if (bound.isEmpty()) for (int i = 0; i < atoms.size(); i++) { final RuleAtom atom = atoms.get(i); if (_safetyChecker.isSafe(atom)) return atoms.remove(i); } else for (int i = 0; i < atoms.size(); i++) { final RuleAtom atom = atoms.get(i); if (SetUtils.intersects(bound, atom.getAllArguments())) { index = i; if (_safetyChecker.isSafe(atom)) break; } } return atoms.remove(index); }
public ATermAppl translate(final RuleAtom ruleAtom) { _term = null; ruleAtom.accept(this); return _term; }
@Override public boolean matches(final RuleAtom atom) { return ((atom instanceof IndividualPropertyAtom) || (atom instanceof DatavaluedPropertyAtom)) && atom.getPredicate().equals(_role.getName()) && ((BinaryAtom<?, ?, ?>) atom).getArgument1() instanceof AtomVariable && ((BinaryAtom<?, ?, ?>) atom).getArgument2().equals(((BinaryAtom<?, ?, ?>) atom).getArgument1()); }
/** * Static convenience function to return the instance variables used in the given atom. * * @param atom * @return return the instance variables used in the given atom. */ public static Collection<AtomIVariable> getIVars(final RuleAtom atom) { final VisitingICollector collector = new VisitingICollector(); for (final AtomObject obj : atom.getAllArguments()) obj.accept(collector); return collector.getVariables(); }
public String explainNotUsable(final RuleAtom atom) { _notUsableMessage = null; atom.accept(this); return _notUsableMessage; } }
@Override public boolean matches(final RuleAtom atom) { return ((atom instanceof IndividualPropertyAtom) || (atom instanceof DatavaluedPropertyAtom)) && atom.getPredicate().equals(_role.getName()) && ((BinaryAtom<?, ?, ?>) atom).getArgument1() instanceof AtomVariable && ((BinaryAtom<?, ?, ?>) atom).getArgument2().equals(((BinaryAtom<?, ?, ?>) atom).getArgument1()); }
/** * Static convenience function to return the variables used in the given atom. * * @param atom * @return the variables used in the given atom. */ public static Collection<AtomVariable> getVars(final RuleAtom atom) { final VisitingCollector collector = new VisitingCollector(); for (final AtomObject obj : atom.getAllArguments()) obj.accept(collector); return collector.getVariables(); }
/** * @param atom * @return maybe true if _atom is something that will be added to the ABox during completion. */ public boolean isSafe(final RuleAtom atom) { atom.accept(this); return result; }