/** * Attach the reasoner to a set of RDF data to process. * The reasoner may already have been bound to specific rules or ontology * axioms (encoded in RDF) through earlier bindRuleset calls. * * @param data the RDF data to be processed, some reasoners may restrict * the range of RDF which is legal here (e.g. syntactic restrictions in OWL). * @return an inference graph through which the data+reasoner can be queried. * @throws ReasonerException if the data is ill-formed according to the * constraints imposed by this reasoner. */ @Override public InfGraph bind( Graph data ) throws ReasonerException { Graph schemaArg = schemaGraph == null ? getPreload() : (FBRuleInfGraph) schemaGraph; FBRuleInfGraph graph = new FBRuleInfGraph( this, rules, schemaArg ); graph.setDerivationLogging( recordDerivations ); graph.setTraceOn( traceOn ); graph.rebind( data ); return graph; }
/** * Attach the reasoner to a set of RDF data to process. * The reasoner may already have been bound to specific rules or ontology * axioms (encoded in RDF) through earlier bindRuleset calls. * * @param data the RDF data to be processed, some reasoners may restrict * the range of RDF which is legal here (e.g. syntactic restrictions in OWL). * @return an inference graph through which the data+reasoner can be queried. * @throws ReasonerException if the data is ill-formed according to the * constraints imposed by this reasoner. */ @Override public InfGraph bind( Graph data ) throws ReasonerException { Graph schemaArg = schemaGraph == null ? getPreload() : (FBRuleInfGraph) schemaGraph; FBRuleInfGraph graph = new FBRuleInfGraph( this, rules, schemaArg ); graph.setDerivationLogging( recordDerivations ); graph.setTraceOn( traceOn ); graph.rebind( data ); return graph; }
/** * 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; }
/** * Attach the reasoner to a set of RDF data to process. * The reasoner may already have been bound to specific rules or ontology * axioms (encoded in RDF) through earlier bindRuleset calls. * * @param data the RDF data to be processed, some reasoners may restrict * the range of RDF which is legal here (e.g. syntactic restrictions in OWL). * @return an inference graph through which the data+reasoner can be queried. * @throws ReasonerException if the data is ill-formed according to the * constraints imposed by this reasoner. */ @Override public InfGraph bind(Graph data) throws ReasonerException { checkArgGraph(data); FBRuleInfGraph graph = null; InfGraph schemaArg = schemaGraph == null ? getPreload() : (FBRuleInfGraph)schemaGraph; List<Rule> baseRules = ((FBRuleInfGraph)schemaArg).getRules(); graph = new FBRuleInfGraph(this, baseRules, schemaArg); graph.addPreprocessingHook(new OWLRuleTranslationHook()); graph.setDerivationLogging(recordDerivations); graph.setTraceOn(traceOn); graph.rebind(data); graph.setDatatypeRangeValidation(true); return graph; }
/** * Attach the reasoner to a set of RDF data to process. * The reasoner may already have been bound to specific rules or ontology * axioms (encoded in RDF) through earlier bindRuleset calls. * * @param data the RDF data to be processed, some reasoners may restrict * the range of RDF which is legal here (e.g. syntactic restrictions in OWL). * @return an inference graph through which the data+reasoner can be queried. * @throws ReasonerException if the data is ill-formed according to the * constraints imposed by this reasoner. */ @Override public InfGraph bind(Graph data) throws ReasonerException { checkArgGraph(data); FBRuleInfGraph graph = null; InfGraph schemaArg = schemaGraph == null ? getPreload() : (FBRuleInfGraph)schemaGraph; List<Rule> baseRules = ((FBRuleInfGraph)schemaArg).getRules(); graph = new FBRuleInfGraph(this, baseRules, schemaArg); graph.addPreprocessingHook(new OWLRuleTranslationHook()); graph.setDerivationLogging(recordDerivations); graph.setTraceOn(traceOn); graph.rebind(data); graph.setDatatypeRangeValidation(true); return graph; }
"[r2: (?p rdf:type s) -> [r2b: (?x ?p ?x) <- (?x rdf:type t)]]"; FBRuleInfGraph infgraph = (FBRuleInfGraph) createInfGraph(rules, data); infgraph.setDerivationLogging(true); infgraph.prepare(); assertTrue("Forward rule count", infgraph.getNRulesFired() == 3);
"[r2: (?p rdf:type s) -> [r2b: (?x ?p ?x) <- (?x rdf:type t)]]"; FBRuleInfGraph infgraph = (FBRuleInfGraph) createInfGraph(rules, data); infgraph.setDerivationLogging(true); infgraph.prepare(); assertTrue("Forward rule count", infgraph.getNRulesFired() == 3);