/** * Return a prebuilt standard configuration for the default RDFS reasoner */ public static Reasoner getRDFSReasoner() { if (theRDFSReasoner == null) theRDFSReasoner = RDFSRuleReasonerFactory.theInstance().create(null); return theRDFSReasoner; }
/** * Prebuilt mini configuration for the default OWL reasoner. This omits bNode * introduction rules which has significant performance gain in some cases and * avoids breaking the find contract. */ public static Reasoner getOWLMiniReasoner() { if (theOWLMiniReasoner == null) theOWLMiniReasoner = OWLMiniReasonerFactory.theInstance().create(null); return theOWLMiniReasoner; }
/** * Prebuilt standard configuration for the default OWL reasoner. This configuration is * hybrid forward/backward reasoner. */ public static Reasoner getOWLReasoner() { if (theOWLReasoner == null) theOWLReasoner = OWLFBRuleReasonerFactory.theInstance().create(null); return theOWLReasoner; }
@Override public Reasoner create( Resource configuration ) { return rf.create( configuration ).bindSchema( schema ); }
/** * Return a prebuilt standard configuration for the default subclass/subproperty transitive closure reasoner. */ public static Reasoner getTransitiveReasoner() { if (theTRANSITIVEReasoner == null) theTRANSITIVEReasoner = TransitiveReasonerFactory.theInstance().create(null); return theTRANSITIVEReasoner; }
/** * Return a prebuilt standard configuration for the default RDFS reasoner */ public static Reasoner getRDFSReasoner() { if (theRDFSReasoner == null) theRDFSReasoner = RDFSRuleReasonerFactory.theInstance().create(null); return theRDFSReasoner; }
@Override public Reasoner create( Resource configuration ) { GenericRuleReasoner result = (GenericRuleReasoner) r.create( configuration ); result.addRules( rules ); return result; }
/** * Prebuilt standard configuration a micro-OWL reasoner. This just supports property axioms, * and class inheritance sufficient to power the OntAPI. */ public static Reasoner getOWLMicroReasoner() { if (theOWLMicroReasoner == null) theOWLMicroReasoner = OWLMicroReasonerFactory.theInstance().create(null); return theOWLMicroReasoner; }
/** Answer a Reasoner created according to the underlying factory, and then loaded with this Wrapper's rules (if the Reasoner is a RuleReasoner) and bound to this Wrapper's schemas (in an unspecified order). */ @Override public Reasoner create( Resource ignored ) { Reasoner result = factory.create( config ); return schemaUnion.isEmpty() ? result : result.bindSchema( schemaUnion ); }
/** Answer a Reasoner created according to the underlying factory, and then loaded with this Wrapper's rules (if the Reasoner is a RuleReasoner) and bound to this Wrapper's schemas (in an unspecified order). */ @Override public Reasoner create( Resource ignored ) { Reasoner result = factory.create( config ); return schemaUnion.isEmpty() ? result : result.bindSchema( schemaUnion ); }
/** * Return a prebuilt simplified configuration for the default RDFS reasoner */ public static Reasoner getRDFSSimpleReasoner() { if (theRDFSSimpleReasoner == null) { theRDFSSimpleReasoner = RDFSRuleReasonerFactory.theInstance().create(null); theRDFSSimpleReasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE); } return theRDFSSimpleReasoner; }
/** * Build the query tests for the given reasoner. */ private static void constructQuerytests(TestSuite suite, String manifest, ReasonerFactory rf, Resource config) throws IOException { ReasonerTester tester = new ReasonerTester(manifest); Reasoner r = rf.create(config); for ( String test : tester.listTests() ) { suite.addTest( new TestReasonerFromManifest( tester, test, r ) ); } }
private Model createForwardChainingModel() { Model baseModel = ModelFactory.createDefaultModel(); Model schemaModel = ModelFactory.createDefaultModel(); Model configurationRuleReasoner = ModelFactory.createDefaultModel(); org.apache.jena.rdf.model.Resource configuration = configurationRuleReasoner.createResource(); configuration.addProperty(ReasonerVocabulary.PROPruleMode, "forward"); configuration.addProperty(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE); Reasoner ruleReasoner = RDFSRuleReasonerFactory.theInstance().create(configuration); InfModel inf = ModelFactory.createInfModel(ruleReasoner, schemaModel, baseModel); inf.read(new ByteArrayInputStream(TURTLE_RDF.getBytes()), "", "TURTLE"); return inf; }
public void testRuleReasonerWrapper() { MockFactory mock = new MockFactory(); ReasonerFactory wrapped = wrap( mock ); assertEquals( MockFactory.capabilities, wrapped.getCapabilities() ); assertEquals( MockFactory.uri, wrapped.getURI() ); assertEquals( MockFactory.reasoner, wrapped.create( null ) ); assertEquals( Arrays.asList( new Object[] {"capabilities", "uri", "create"} ), mock.done ); }
/** * Test the capabilities description. */ public void testRDFSDescription() { ReasonerFactory rf = RDFSFBRuleReasonerFactory.theInstance(); Reasoner r = rf.create(null); assertTrue(r.supportsProperty(RDFS.subClassOf)); assertTrue(r.supportsProperty(RDFS.domain)); assertTrue( ! r.supportsProperty(OWL.allValuesFrom)); }
private void doTestRDFSSimple(String level) { Model model = ModelFactory.createDefaultModel(); String NS = "http://jena.hpl.hp.com/example#"; Property prop = model.createProperty(NS + "prop"); model.add(prop, RDF.type, RDF.Property); Reasoner reasoner = RDFSRuleReasonerFactory.theInstance().create(null); reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, level); InfModel im = ModelFactory.createInfModel(reasoner, model); assertTrue( im.contains(prop, RDFS.subPropertyOf, prop) ); }
public void testSchema() { Model schema = model( "P rdf:type owl:ObjectProperty" ); Resource root = resourceInModel( "x rdf:type ja:ReasonerFactory; x ja:schema S" ); Assembler sub = new NamedObjectAssembler( resource( "S" ), schema ); ReasonerFactory rf = (ReasonerFactory) ASSEMBLER.open( sub, root ); Reasoner r = rf.create( null ); assertIsomorphic( schema.getGraph(), ((FBRuleReasoner) r).getBoundSchema() ); }
public void testSchema() { Model schema = model( "P rdf:type owl:ObjectProperty" ); Resource root = resourceInModel( "x rdf:type ja:ReasonerFactory; x ja:schema S" ); Assembler sub = new NamedObjectAssembler( resource( "S" ), schema ); ReasonerFactory rf = (ReasonerFactory) ASSEMBLER.open( sub, root ); Reasoner r = rf.create( null ); assertIsomorphic( schema.getGraph(), ((FBRuleReasoner) r).getBoundSchema() ); }
private void doTestRDFSSimple(String level) { Model model = ModelFactory.createDefaultModel(); String NS = "http://jena.hpl.hp.com/example#"; Property prop = model.createProperty(NS + "prop"); model.add(prop, RDF.type, RDF.Property); Reasoner reasoner = RDFSRuleReasonerFactory.theInstance().create(null); reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, level); InfModel im = ModelFactory.createInfModel(reasoner, model); assertTrue( im.contains(prop, RDFS.subPropertyOf, prop) ); }
private static void testInfModel(Dataset ds0) { Txn.executeWrite(ds0, ()->{}); Model baseModel = ds0.getDefaultModel(); Model model = ModelFactory.createInfModel(RDFSRuleReasonerFactory.theInstance().create(null), baseModel); if ( model.getGraph().getTransactionHandler().transactionsSupported() ) { // InfModels do not support transactions per se - they particpate if includes in a suitabel dataset. model.begin(); long x = Iter.count(model.listStatements()); model.commit(); assertTrue(x > 10); } }