Example #1
0
  @Test
  public void testFunctionalSomeTermNoGovTerm()
      throws ENodeMergeException, ParseException, EReasonerException, EInconsistencyException {
    final IIndividualABoxNode<String, String, String, String> node = _abox.createIndividualNode();
    _abox.getAssertedRBox().addRole("r", RoleType.OBJECT_PROPERTY);
    _abox.getAssertedRBox().setRoleProperty("r", RoleProperty.FUNCTIONAL);

    node.addClassTerm(_parser.parse("(some r A)"));

    assertFalse(_abox.getDependencyMap().hasGoverningTerm(node, _parser.parse("(some r A)")));
    _reasoner.getReasonerOptions().setSemanticBranching(false);
    final Collection<? extends IReasonerResult<String, String, String, String>> results =
        _reasoner.checkConsistency(_abox, false);
    assertEquals(1, results.size());

    for (IReasonerResult<String, String, String, String> result : results) {
      final IABox<String, String, String, String> abox = result.getABox();
      final IABoxNode<String, String, String, String> node2 = abox.getNode(node.getNodeID());
      assertEquals(1, node2.getRABox().getSuccessorNodes().size());
      final IABoxNode<String, String, String, String> succ =
          node2.getRABox().getSuccessorNodes().iterator().next();
      assertFalse(abox.getDependencyMap().hasGoverningTerm(succ, _parser.parse("A")));
      assertFalse(abox.getDependencyMap().hasGoverningTerm(node2, _parser.parse("(some r A)")));
    }
  }
Example #2
0
 @Test
 public void testIntersectionGovTermMove()
     throws ENodeMergeException, ParseException, EReasonerException, EInconsistencyException {
   final IIndividualABoxNode<String, String, String, String> node = _abox.createIndividualNode();
   node.addClassTerm(_parser.parse("(and A B)"));
   _abox.getDependencyMap().addGoverningTerm(node, _parser.parse("(and A B)"));
   final Collection<? extends IReasonerResult<String, String, String, String>> results =
       _reasoner.checkConsistency(_abox);
   assertEquals(1, results.size());
   final IABox<String, String, String, String> result = results.iterator().next().getABox();
   assertTrue(result.getDependencyMap().hasGoverningTerm(node, _parser.parse("A")));
   assertTrue(result.getDependencyMap().hasGoverningTerm(node, _parser.parse("B")));
   assertFalse(result.getDependencyMap().hasGoverningTerm(node, _parser.parse("(and A B)")));
 }
Example #3
0
  @Test
  public void testForAllTermNoSuccNoGovTerm()
      throws ENodeMergeException, ParseException, EReasonerException, EInconsistencyException {
    final IIndividualABoxNode<String, String, String, String> node = _abox.createIndividualNode();
    _abox.getAssertedRBox().addRole("r", RoleType.OBJECT_PROPERTY);

    node.addClassTerm(_parser.parse("(only r A)"));
    assertFalse(_abox.getDependencyMap().hasGoverningTerm(node, _parser.parse("(only r A)")));
    final Collection<? extends IReasonerResult<String, String, String, String>> results =
        _reasoner.checkConsistency(_abox, false);
    assertEquals(1, results.size());

    final IABox<String, String, String, String> result = results.iterator().next().getABox();
    assertFalse(
        result.getDependencyMap().hasGoverningTerm(node.getNodeID(), _parser.parse("(only r A)")));
  }
Example #4
0
  @Test
  public void testUnionGovTermIntroductionWasGovTerm()
      throws ENodeMergeException, ParseException, EReasonerException, EInconsistencyException {
    final IIndividualABoxNode<String, String, String, String> node = _abox.createIndividualNode();
    node.addClassTerm(_parser.parse("(or A B)"));

    _reasoner.getReasonerOptions().setSemanticBranching(false);
    final Collection<? extends IReasonerResult<String, String, String, String>> results =
        _reasoner.checkConsistency(_abox, false);
    assertEquals(2, results.size());

    for (IReasonerResult<String, String, String, String> result : results) {
      final IABox<String, String, String, String> abox = result.getABox();
      assertTrue(
          abox.getDependencyMap().hasGoverningTerm(node, _parser.parse("A"))
              ^ abox.getDependencyMap().hasGoverningTerm(node, _parser.parse("B")));
      assertFalse(abox.getDependencyMap().hasGoverningTerm(node, _parser.parse("(or A B)")));
    }
  }
Example #5
0
  @Test
  public void testComplexTermPropagation1()
      throws ENodeMergeException, ParseException, EReasonerException, EInconsistencyException {
    final IIndividualABoxNode<String, String, String, String> node = _abox.createIndividualNode();
    _abox.getAssertedRBox().addRole("r", RoleType.OBJECT_PROPERTY);
    _abox.getAssertedRBox().setRoleProperty("r", RoleProperty.FUNCTIONAL);
    final IIndividualABoxNode<String, String, String, String> node2 = _abox.createIndividualNode();
    node.getRABox().getAssertedSuccessors().put("r", node2);

    node.addClassTerm(_parser.parse("(only r (some r (some r A)))"));
    _abox.getDependencyMap().addGoverningTerm(node, _parser.parse("(only r (some r (some r A)))"));
    assertTrue(
        _abox
            .getDependencyMap()
            .hasGoverningTerm(node, _parser.parse("(only r (some r (some r A)))")));

    final Collection<? extends IReasonerResult<String, String, String, String>> results =
        _reasoner.checkConsistency(_abox, false);
    assertEquals(1, results.size());

    final IABox<String, String, String, String> result = results.iterator().next().getABox();
    final IABoxNode<String, String, String, String> n = result.getNode(node.getNodeID());
    assertFalse(
        result
            .getDependencyMap()
            .hasGoverningTerm(n, _parser.parse("(only r (some r (some r A)))")));
    assertFalse(
        result.getDependencyMap().hasGoverningTerm(n, _parser.parse("(some r (some r A))")));
    assertEquals(1, n.getRABox().getSuccessorNodes().size());
    final IABoxNode<String, String, String, String> n2 =
        n.getRABox().getSuccessorNodes().iterator().next();
    assertFalse(result.getDependencyMap().hasGoverningTerm(n2, _parser.parse("(some r A)")));
    assertEquals(1, n2.getRABox().getSuccessorNodes().size());
    final IABoxNode<String, String, String, String> n3 =
        n2.getRABox().getSuccessorNodes().iterator().next();
    assertFalse(result.getDependencyMap().hasGoverningTerm(n3, _parser.parse("(some r A)")));
    assertEquals(1, n3.getRABox().getSuccessorNodes().size());
    final IABoxNode<String, String, String, String> n4 =
        n3.getRABox().getSuccessorNodes().iterator().next();
    assertTrue(result.getDependencyMap().hasGoverningTerm(n4, _parser.parse("A")));
  }