NIHVIVO-2369 - disable subProperty and equivalentProperty reasoning for SDB mode

This commit is contained in:
stellamit 2011-05-13 20:14:08 +00:00
parent 0dd317972e
commit 7cc000e674
2 changed files with 31 additions and 16 deletions

View file

@ -102,9 +102,12 @@ public class SimpleReasoner extends StatementListener {
if (stmt.getPredicate().equals(RDF.type)) { if (stmt.getPredicate().equals(RDF.type)) {
addedABoxTypeAssertion(stmt, inferenceModel); addedABoxTypeAssertion(stmt, inferenceModel);
setMostSpecificTypes(stmt.getSubject(), inferenceModel); setMostSpecificTypes(stmt.getSubject(), inferenceModel);
} else { }
/* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011
else {
addedABoxAssertion(stmt,inferenceModel); addedABoxAssertion(stmt,inferenceModel);
} }
*/
} catch (Exception e) { } catch (Exception e) {
// don't stop the edit if there's an exception // don't stop the edit if there's an exception
log.error("Exception while adding inferences: ", e); log.error("Exception while adding inferences: ", e);
@ -123,9 +126,12 @@ public class SimpleReasoner extends StatementListener {
if (stmt.getPredicate().equals(RDF.type)) { if (stmt.getPredicate().equals(RDF.type)) {
removedABoxTypeAssertion(stmt, inferenceModel); removedABoxTypeAssertion(stmt, inferenceModel);
setMostSpecificTypes(stmt.getSubject(), inferenceModel); setMostSpecificTypes(stmt.getSubject(), inferenceModel);
} else { }
/* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011
else {
removedABoxAssertion(stmt, inferenceModel); removedABoxAssertion(stmt, inferenceModel);
} }
*/
} catch (Exception e) { } catch (Exception e) {
// don't stop the edit if there's an exception // don't stop the edit if there's an exception
log.error("Exception while retracting inferences: ", e); log.error("Exception while retracting inferences: ", e);
@ -164,7 +170,9 @@ public class SimpleReasoner extends StatementListener {
addedSubClass(subject,object,inferenceModel); addedSubClass(subject,object,inferenceModel);
addedSubClass(object,subject,inferenceModel); addedSubClass(object,subject,inferenceModel);
} }
} else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) { }
/* uncomment this to enable sub property/equivalent property inferencing. sjm222 5/13/2011
else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) {
OntProperty subject = tboxModel.getOntProperty((stmt.getSubject()).getURI()); OntProperty subject = tboxModel.getOntProperty((stmt.getSubject()).getURI());
OntProperty object = tboxModel.getOntProperty(((Resource)stmt.getObject()).getURI()); OntProperty object = tboxModel.getOntProperty(((Resource)stmt.getObject()).getURI());
@ -175,7 +183,9 @@ public class SimpleReasoner extends StatementListener {
addedSubProperty(subject,object,inferenceModel); addedSubProperty(subject,object,inferenceModel);
addedSubProperty(object,subject,inferenceModel); addedSubProperty(object,subject,inferenceModel);
} }
} }
*/
} catch (Exception e) { } catch (Exception e) {
// don't stop the edit if there's an exception // don't stop the edit if there's an exception
log.error("Exception while adding inference(s): ", e); log.error("Exception while adding inference(s): ", e);
@ -210,7 +220,9 @@ public class SimpleReasoner extends StatementListener {
removedSubClass(subject,object,inferenceModel); removedSubClass(subject,object,inferenceModel);
removedSubClass(object,subject,inferenceModel); removedSubClass(object,subject,inferenceModel);
} }
} else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) { }
/* uncomment this to enable sub property / equivalent property inferencing. sjm222 5/13/2011.
else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) {
OntProperty subject = tboxModel.getOntProperty((stmt.getSubject()).getURI()); OntProperty subject = tboxModel.getOntProperty((stmt.getSubject()).getURI());
OntProperty object = tboxModel.getOntProperty(((Resource)stmt.getObject()).getURI()); OntProperty object = tboxModel.getOntProperty(((Resource)stmt.getObject()).getURI());
@ -222,6 +234,7 @@ public class SimpleReasoner extends StatementListener {
removedSubProperty(object,subject); removedSubProperty(object,subject);
} }
} }
*/
} catch (Exception e) { } catch (Exception e) {
// don't stop the edit if there's an exception // don't stop the edit if there's an exception
log.error("Exception while removing inference(s): ", e); log.error("Exception while removing inference(s): ", e);

View file

@ -554,7 +554,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
/* /*
* tests rdfs:subPropertyOf materialization for object properties. * tests rdfs:subPropertyOf materialization for object properties.
*/ */
@Test // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void addABoxAssertion1(){ public void addABoxAssertion1(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
@ -597,7 +597,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
* Test that when a statement is asserted, that it not * Test that when a statement is asserted, that it not
* added to the inference graph. * added to the inference graph.
*/ */
@Test // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void addABoxAssertion2(){ public void addABoxAssertion2(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
@ -639,7 +639,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
/* /*
* Test inference based on property equivalence * Test inference based on property equivalence
*/ */
@Test // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void addABoxAssertion4(){ public void addABoxAssertion4(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
@ -694,7 +694,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
* property so no inference should be materialized. * property so no inference should be materialized.
*/ */
@Test // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void addABoxAssertion5(){ public void addABoxAssertion5(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
@ -737,7 +737,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
/* /*
* Test inference based on property equivalence * Test inference based on property equivalence
*/ */
@Test // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void addABoxAssertion6() { public void addABoxAssertion6() {
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
@ -794,7 +794,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
* rdfs:subPropetyOf statement, this test serves * rdfs:subPropetyOf statement, this test serves
* as a test of equivalentProperty assertions also. * as a test of equivalentProperty assertions also.
*/ */
@Test // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void addTBoxSubPropertyAssertion1(){ public void addTBoxSubPropertyAssertion1(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
@ -850,7 +850,6 @@ public class SimpleReasonerTest extends AbstractTestClass {
} }
@Test
/* /*
* Test the removal of a subPropertyOf statement from * Test the removal of a subPropertyOf statement from
* the TBox. The instance data that is the basis * the TBox. The instance data that is the basis
@ -864,6 +863,7 @@ public class SimpleReasonerTest extends AbstractTestClass {
* as a test of equivalentProperty assertions also. * as a test of equivalentProperty assertions also.
* *
*/ */
// @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011
public void removeTBoxSubPropertyAssertion1(){ public void removeTBoxSubPropertyAssertion1(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
// the ABox reasoner listeners with the ABox and TBox // the ABox reasoner listeners with the ABox and TBox
@ -955,11 +955,12 @@ public class SimpleReasonerTest extends AbstractTestClass {
} }
@Test
/* /*
* Test computation of mostSpecificType annotations in response * Test computation of mostSpecificType annotations in response
* to an added/removed ABox type assertion. * to an added/removed ABox type assertion.
*/ */
@Test
public void mstTest1(){ public void mstTest1(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
// the ABox reasoner listeners with the ABox and TBox // the ABox reasoner listeners with the ABox and TBox
@ -1025,11 +1026,12 @@ public class SimpleReasonerTest extends AbstractTestClass {
Assert.assertFalse(aBox.contains(ind_x, mostSpecificType, ResourceFactory.createTypedLiteral(classD.getURI(), XSDDatatype.XSDanyURI))); Assert.assertFalse(aBox.contains(ind_x, mostSpecificType, ResourceFactory.createTypedLiteral(classD.getURI(), XSDDatatype.XSDanyURI)));
} }
@Test
/* /*
* Test computation of mostSpecificType annotations in response * Test computation of mostSpecificType annotations in response
* to an added ABox type assertion. * to an added ABox type assertion.
*/ */
@Test
public void mstTest2(){ public void mstTest2(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
// the ABox reasoner listeners with the ABox and TBox // the ABox reasoner listeners with the ABox and TBox
@ -1074,11 +1076,11 @@ public class SimpleReasonerTest extends AbstractTestClass {
Assert.assertTrue(aBox.contains(ind_x, mostSpecificType, ResourceFactory.createTypedLiteral(classC.getURI(), XSDDatatype.XSDanyURI))); Assert.assertTrue(aBox.contains(ind_x, mostSpecificType, ResourceFactory.createTypedLiteral(classC.getURI(), XSDDatatype.XSDanyURI)));
} }
@Test
/* /*
* Test computation of mostSpecificType annotations in response * Test computation of mostSpecificType annotations in response
* to an added/removed TBox assertions. * to an added/removed TBox assertions.
*/ */
@Test
public void mstTest3(){ public void mstTest3(){
// Create TBox, ABox and Inference models and register // Create TBox, ABox and Inference models and register
// the ABox reasoner listeners with the ABox and TBox // the ABox reasoner listeners with the ABox and TBox