/** * Returns true if the rule does not depend on any data, and so should * be treated as an axiom. */ public boolean isAxiom() { if (isBackward() && body.length > 0) return false; for ( ClauseEntry aBody : body ) { if ( aBody instanceof TriplePattern ) { return false; } } return true; }
/** * Returns true if the rule does not depend on any data, and so should * be treated as an axiom. */ public boolean isAxiom() { if (isBackward() && body.length > 0) return false; for ( ClauseEntry aBody : body ) { if ( aBody instanceof TriplePattern ) { return false; } } return true; }
/** * Scan the initial rule set and pick out all the backward-only rules with non-null bodies, * and transfer these rules to the backward engine. */ private static List<Rule> extractPureBackwardRules(List<Rule> rules) { List<Rule> bRules = new ArrayList<>(); for ( Rule r : rules ) { if ( r.isBackward() && r.bodyLength() > 0 ) { bRules.add( r ); } } return bRules; }
/** * Scan the initial rule set and pick out all the backward-only rules with non-null bodies, * and transfer these rules to the backward engine. */ private static List<Rule> extractPureBackwardRules(List<Rule> rules) { List<Rule> bRules = new ArrayList<>(); for ( Rule r : rules ) { if ( r.isBackward() && r.bodyLength() > 0 ) { bRules.add( r ); } } return bRules; }
/** * Check parser extension for f/b distinction. */ public void testParser() { String rf = "(?a rdf:type ?t) -> (?t rdf:type rdfs:Class)."; String rb = "(?t rdf:type rdfs:Class) <- (?a rdf:type ?t)."; assertTrue( ! Rule.parseRule(rf).isBackward() ); assertTrue( Rule.parseRule(rb).isBackward() ); }
/** * Check parser extension for f/b distinction. */ public void testParser() { String rf = "(?a rdf:type ?t) -> (?t rdf:type rdfs:Class)."; String rb = "(?t rdf:type rdfs:Class) <- (?a rdf:type ?t)."; assertTrue( ! Rule.parseRule(rf).isBackward() ); assertTrue( Rule.parseRule(rb).isBackward() ); }
if ( ignoreBrules && r.isBackward() )
if ( ignoreBrules && r.isBackward() )
if ( ignoreBrules && rule.isBackward() )
if ( ignoreBrules && rule.isBackward() )
if (r.isBackward()) { infGraph.addBRule(r.instantiate(env)); } else {
if (r.isBackward()) { infGraph.addBRule(r.instantiate(env)); } else {
if (r.isBackward()) { if (isAdd) { infGraph.addBRule(r.instantiate(env));
if (r.isBackward()) { if (isAdd) { infGraph.addBRule(r.instantiate(env));