public boolean assertAtom(RuleAtom atom, VariableBinding binding, DependencySet ds, boolean negated,ABox abox, CompletionStrategy strategy) { asserted = true; this.binding = binding; this.ds = ds; this.negated = negated; this.strategy = strategy; this.abox = abox; atom.accept( this ); return asserted; }
public ATermAppl translate(RuleAtom ruleAtom) { term = null; ruleAtom.accept( this ); return term; }
public boolean assertAtom(RuleAtom atom, VariableBinding binding, DependencySet ds, boolean negated,ABox abox, CompletionStrategy strategy) { asserted = true; this.binding = binding; this.ds = ds; this.negated = negated; this.strategy = strategy; this.abox = abox; atom.accept( this ); return asserted; }
/** * May return true if atom is something that * will be added to the ABox during completion. */ public boolean isSafe(RuleAtom atom) { atom.accept(this); return result; }
public ATermAppl translate(RuleAtom ruleAtom) { term = null; ruleAtom.accept( this ); return term; }
public String explainNotUsable(RuleAtom atom) { notUsableMessage = null; atom.accept(this); return notUsableMessage; } }
private AlphaNode create(RuleAtom atom) { result = null; atom.accept(this); if (result == null) { throw new UnsupportedOperationException("Not supported " + atom); } return result; }
private ProductionNode create(RuleAtom atom) { node = null; atom.accept(this); if (node == null) { throw new UnsupportedOperationException("Not supported " + atom); } return node; }
/** * Translates a rule atom into a rete triple. Returns null if the atom can't * be translated. */ public TermTuple translateAtom(RuleAtom atom, DependencySet ds) { AtomTranslator translator = new AtomTranslator(ds); atom.accept(translator); return translator.getResult(); }
public DependencySet isAtomTrue(RuleAtom atom, VariableBinding binding) { HeadAtomVisitor visitor = new HeadAtomVisitor(); atom.accept( visitor ); BindingTester tester = visitor.getTester(); return tester == null ? null : tester.check( binding ); } }
public DependencySet isAtomTrue(RuleAtom atom, VariableBinding binding) { HeadAtomVisitor visitor = new HeadAtomVisitor(); atom.accept( visitor ); BindingTester tester = visitor.getTester(); return tester == null ? null : tester.check( binding ); } }
public Collection<BindingHelper> getHelpers(Rule rule) { Collection<BindingHelper> helpers = new ArrayList<BindingHelper>(); BodyAtomVisitor bodyVisitor = new BodyAtomVisitor(); for( RuleAtom atom : rule.getBody() ) { atom.accept( bodyVisitor ); if( bodyVisitor.getTester() != null ) helpers.add( new FilterHelper( bodyVisitor.getTester(), VariableUtils .getVars( atom ) ) ); } return helpers; }
Map<ATermAppl, AtomVariable> varToVar = new HashMap<ATermAppl, AtomVariable>(); for ( RuleAtom atom : rule.getBody() ) { atom.accept( filter ); if ( filter.isSafe() ) { TermTuple bodyTerm = translator.translateAtom( atom, ds );
public Collection<BindingHelper> getHelpers(Rule rule) { Collection<BindingHelper> helpers = new ArrayList<BindingHelper>(); BodyAtomVisitor bodyVisitor = new BodyAtomVisitor(); for( RuleAtom atom : rule.getBody() ) { atom.accept( bodyVisitor ); if( bodyVisitor.getTester() != null ) helpers.add( new FilterHelper( bodyVisitor.getTester(), VariableUtils .getVars( atom ) ) ); } return helpers; }
/** * Returns a string explaining why a rule cannot be used for reasoning, or * <code>null</code> if the rule can be used for reasoning * * @param rule * rule to check * @return a string explaining why a rule cannot be used for reasoning, or * <code>null</code> if the rule can be used for reasoning */ public static String explainNotUsable(Rule rule) { Set<AtomVariable> bodyVars = new HashSet<AtomVariable>(); for( RuleAtom atom : rule.getBody() ) { atom.accept( bodyFilter ); if( !bodyFilter.isUsable() ) { return bodyFilter.getMessage(); } bodyVars.addAll( VariableUtils.getVars( atom ) ); } for( RuleAtom atom : rule.getHead() ) { atom.accept( headFilter ); if( !bodyVars.containsAll( VariableUtils.getVars( atom ) ) ) { return "Head atom " + atom + " contains variables not found in body."; } if( !headFilter.isUsable() ) { return headFilter.getMessage(); } } return null; }
Set<AtomDVariable> dataVariables = new HashSet<AtomDVariable>(); for ( RuleAtom pattern : rule.getBody() ) { pattern.accept( selectiveVisitor ); instanceVariables.addAll( VariableUtils.getIVars( pattern ) ); dataVariables.addAll( VariableUtils.getDVars( pattern ) );
Set<AtomDVariable> dataVariables = new HashSet<AtomDVariable>(); for ( RuleAtom pattern : rule.getBody() ) { pattern.accept( selectiveVisitor ); instanceVariables.addAll( VariableUtils.getIVars( pattern ) ); dataVariables.addAll( VariableUtils.getDVars( pattern ) );