NIHVIVO-2088 asserted types leaking into inference graph
This commit is contained in:
parent
f09ac267a2
commit
c43a677d5a
1 changed files with 36 additions and 0 deletions
|
@ -29,6 +29,42 @@ public class SimpleReasonerTest extends AbstractTestClass {
|
|||
suppressSyserr();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addType(){
|
||||
|
||||
// Test that when a new instance is asserted, its asserted type is not added to the
|
||||
// inference graph
|
||||
|
||||
// Create a Tbox with a simple class hierarchy. B is a subclass of A.
|
||||
// Pellet will compute TBox inferences
|
||||
OntModel tBox = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
|
||||
|
||||
OntClass classA = tBox.createClass("http://test.vivo/A");
|
||||
classA.setLabel("class A", "en-US");
|
||||
|
||||
OntClass classB = tBox.createClass("http://test.vivo/B");
|
||||
classB.setLabel("class B", "en-US");
|
||||
|
||||
classA.addSubClass(classB);
|
||||
|
||||
// this is the model to receive inferences
|
||||
Model inf = ModelFactory.createDefaultModel();
|
||||
|
||||
// create an Abox and register the SimpleReasoner listener with it
|
||||
OntModel aBox = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
|
||||
aBox.register(new SimpleReasoner(tBox, aBox, inf));
|
||||
|
||||
// Individual x
|
||||
Resource ind_x = aBox.createResource("http://test.vivo/x");
|
||||
|
||||
// add a statement to the ABox that individual x is of type (i.e. is an instance of) B.
|
||||
Statement xisb = ResourceFactory.createStatement(ind_x, RDF.type, classB);
|
||||
aBox.add(xisb);
|
||||
|
||||
// Verify that "x is of type B" was not inferred
|
||||
Assert.assertFalse(inf.contains(xisb));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addTypes(){
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue