@Override public Model getDeductionsModel() { return inner.getDeductionsModel(); }
RDFDataMgr.write(System.out, model.getDeductionsModel(), RDFLanguages.NT); System.out.println("* Write the model"); RDFDataMgr.write(System.out, model, RDFLanguages.NT); System.out.println("* Write the deductions model again"); RDFDataMgr.write(System.out, model.getDeductionsModel(), RDFLanguages.NT);
/** * Problems with getDeductionsModel not rerunning prepare at OntModel level */ public void testOntModelGetDeductions() { List<Rule> rules = Rule.parseRules( "(?x rdfs:subClassOf ?y) (?i rdf:type ?x) -> (?i rdf:type ?y)." ); GenericRuleReasoner reasoner = new GenericRuleReasoner(rules); OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_MEM); spec.setReasoner(reasoner); OntModel om = ModelFactory.createOntologyModel(spec); OntClass A = om.createClass(PrintUtil.egNS + "A"); OntClass B = om.createClass(PrintUtil.egNS + "B"); OntResource i = om.createOntResource(PrintUtil.egNS + "i"); A.addSuperClass(B); i.addRDFType(A); Model deductions = om.getDeductionsModel(); i.removeRDFType(A); deductions = om.getDeductionsModel(); assertFalse("Deductions model updating correctly", deductions.contains(i, RDF.type, B)); }
/** * Problems with getDeductionsModel not rerunning prepare at OntModel level */ public void testOntModelGetDeductions() { List<Rule> rules = Rule.parseRules( "(?x rdfs:subClassOf ?y) (?i rdf:type ?x) -> (?i rdf:type ?y)." ); GenericRuleReasoner reasoner = new GenericRuleReasoner(rules); OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_MEM); spec.setReasoner(reasoner); OntModel om = ModelFactory.createOntologyModel(spec); OntClass A = om.createClass(PrintUtil.egNS + "A"); OntClass B = om.createClass(PrintUtil.egNS + "B"); OntResource i = om.createOntResource(PrintUtil.egNS + "i"); A.addSuperClass(B); i.addRDFType(A); Model deductions = om.getDeductionsModel(); i.removeRDFType(A); deductions = om.getDeductionsModel(); assertFalse("Deductions model updating correctly", deductions.contains(i, RDF.type, B)); }
/** Getting the deductions model of an OntModel * see also {@link TestBugs#testOntModelGetDeductions()} * <p>ijd: Feb 6th, 2008 - this test has been disabled for * the time being, since it is not correct as written. However, * I'm not removing or changing it just yet, since it is showing up * an infelicity in the rule engine that Dave will investigate * at some future date.</p> * */ public void xxtestGetDeductionsModel0() { OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM_MICRO_RULE_INF ); OntClass a = m.createClass( NS + "A" ); OntClass b = m.createClass( NS + "B" ); OntClass c = m.createClass( NS + "C" ); b.addSubClass( c ); // we see the entailments only in the deductions model Model dm = m.getDeductionsModel(); assertTrue( dm.contains( OWL.Nothing, RDFS.subClassOf, a ) ); assertTrue( dm.contains( OWL.Nothing, RDFS.subClassOf, c ) ); a.addSubClass( b ); assertTrue( a.hasSubClass( c )); dm = m.getDeductionsModel(); assertFalse( dm.contains( OWL.Nothing, RDFS.subClassOf, a ) ); assertTrue( dm.contains( OWL.Nothing, RDFS.subClassOf, c ) ); }
/** Getting the deductions model of an OntModel * see also {@link TestBugs#testOntModelGetDeductions()} * <p>ijd: Feb 6th, 2008 - this test has been disabled for * the time being, since it is not correct as written. However, * I'm not removing or changing it just yet, since it is showing up * an infelicity in the rule engine that Dave will investigate * at some future date.</p> * */ public void xxtestGetDeductionsModel0() { OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM_MICRO_RULE_INF ); OntClass a = m.createClass( NS + "A" ); OntClass b = m.createClass( NS + "B" ); OntClass c = m.createClass( NS + "C" ); b.addSubClass( c ); // we see the entailments only in the deductions model Model dm = m.getDeductionsModel(); assertTrue( dm.contains( OWL.Nothing, RDFS.subClassOf, a ) ); assertTrue( dm.contains( OWL.Nothing, RDFS.subClassOf, c ) ); a.addSubClass( b ); assertTrue( a.hasSubClass( c )); dm = m.getDeductionsModel(); assertFalse( dm.contains( OWL.Nothing, RDFS.subClassOf, a ) ); assertTrue( dm.contains( OWL.Nothing, RDFS.subClassOf, c ) ); }