/** * This method is invoked when the builtin is called in a rule body. * @param args the array of argument values for the builtin, this is an array * of Nodes, some of which may be Node_RuleVariables. * @param length the length of the argument list, may be less than the length of the args array * for some rule engines * @param context an execution context giving access to other relevant data */ @Override public void headAction(Node[] args, int length, RuleContext context) { InfGraph infgraph = context.getGraph(); if (infgraph instanceof FBRuleInfGraph) { ((FBRuleInfGraph)infgraph).setTabled(Node.ANY); } else if (infgraph instanceof LPBackwardRuleInfGraph) { ((LPBackwardRuleInfGraph)infgraph).setTabled(Node.ANY); } else { // Quietly ignore as an irrelevant directive // Could log or throw exception but currently I want to be able to use // the same rule base from different contexts which do and do not need // to know about this. } } }
/** * This method is invoked when the builtin is called in a rule body. * @param args the array of argument values for the builtin, this is an array * of Nodes, some of which may be Node_RuleVariables. * @param length the length of the argument list, may be less than the length of the args array * for some rule engines * @param context an execution context giving access to other relevant data */ @Override public void headAction(Node[] args, int length, RuleContext context) { InfGraph infgraph = context.getGraph(); if (infgraph instanceof FBRuleInfGraph) { ((FBRuleInfGraph)infgraph).setTabled(Node.ANY); } else if (infgraph instanceof LPBackwardRuleInfGraph) { ((LPBackwardRuleInfGraph)infgraph).setTabled(Node.ANY); } else { // Quietly ignore as an irrelevant directive // Could log or throw exception but currently I want to be able to use // the same rule base from different contexts which do and do not need // to know about this. } } }
/** * This method is invoked when the builtin is called in a rule body. * @param args the array of argument values for the builtin, this is an array * of Nodes, some of which may be Node_RuleVariables. * @param length the length of the argument list, may be less than the length of the args array * for some rule engines * @param context an execution context giving access to other relevant data */ @Override public void headAction(Node[] args, int length, RuleContext context) { InfGraph infgraph = context.getGraph(); if (infgraph instanceof FBRuleInfGraph) { for (int i = 0; i < length; i++) { ((FBRuleInfGraph)infgraph).setTabled(args[i]); } } else if (infgraph instanceof LPBackwardRuleInfGraph) { for (int i = 0; i < length; i++) { ((LPBackwardRuleInfGraph)infgraph).setTabled(args[i]); } } else { // Quietly ignore as an irrelevant directive // Could log or throw exception but currently I want to be able to use // the same rule base from different contexts which do and do not need // to know about this. } }
/** * This method is invoked when the builtin is called in a rule body. * @param args the array of argument values for the builtin, this is an array * of Nodes, some of which may be Node_RuleVariables. * @param length the length of the argument list, may be less than the length of the args array * for some rule engines * @param context an execution context giving access to other relevant data */ @Override public void headAction(Node[] args, int length, RuleContext context) { InfGraph infgraph = context.getGraph(); if (infgraph instanceof FBRuleInfGraph) { for (int i = 0; i < length; i++) { ((FBRuleInfGraph)infgraph).setTabled(args[i]); } } else if (infgraph instanceof LPBackwardRuleInfGraph) { for (int i = 0; i < length; i++) { ((LPBackwardRuleInfGraph)infgraph).setTabled(args[i]); } } else { // Quietly ignore as an irrelevant directive // Could log or throw exception but currently I want to be able to use // the same rule base from different contexts which do and do not need // to know about this. } }
/** * Return an inference graph working over the given rule set and raw data. * Can be overridden by subclasses of this test class. * @param rules the rule set to use * @param data the graph of triples to process * @param tabled an array of predicates that should be tabled */ public InfGraph makeInfGraph(List<Rule> rules, Graph data, Node[] tabled) { FBRuleReasoner reasoner = new FBRuleReasoner(rules); FBRuleInfGraph infgraph = (FBRuleInfGraph) reasoner.bind(data); for ( Node aTabled : tabled ) { infgraph.setTabled( aTabled ); } return infgraph; }
/** * Return an inference graph working over the given rule set and raw data. * Can be overridden by subclasses of this test class. * @param rules the rule set to use * @param data the graph of triples to process * @param tabled an array of predicates that should be tabled */ public InfGraph makeInfGraph(List<Rule> rules, Graph data, Node[] tabled) { FBRuleReasoner reasoner = new FBRuleReasoner(rules); FBRuleInfGraph infgraph = (FBRuleInfGraph) reasoner.bind(data); for ( Node aTabled : tabled ) { infgraph.setTabled( aTabled ); } return infgraph; }
/** * Return an inference graph working over the given rule set and raw data. * Can be overridden by subclasses of this test class. * @param rules the rule set to use * @param data the graph of triples to process * @param tabled an array of predicates that should be tabled */ public static InfGraph makeInfGraph(List<Rule> rules, Graph data, Node[] tabled) { FBRuleReasoner reasoner = new FBRuleReasoner(rules); FBRuleInfGraph infgraph = (FBRuleInfGraph) reasoner.bind(data); for ( Node aTabled : tabled ) { infgraph.setTabled( aTabled ); } // infgraph.setTraceOn(true); infgraph.setDerivationLogging(true); return infgraph; }
/** * Return an inference graph working over the given rule set and raw data. * Can be overridden by subclasses of this test class. * @param rules the rule set to use * @param data the graph of triples to process * @param tabled an array of predicates that should be tabled */ public static InfGraph makeInfGraph(List<Rule> rules, Graph data, Node[] tabled) { FBRuleReasoner reasoner = new FBRuleReasoner(rules); FBRuleInfGraph infgraph = (FBRuleInfGraph) reasoner.bind(data); for ( Node aTabled : tabled ) { infgraph.setTabled( aTabled ); } // infgraph.setTraceOn(true); infgraph.setDerivationLogging(true); return infgraph; }