Пример #1
0
  @Test
  public void testForAllTermTwoSuccNoGovTerm()
      throws ENodeMergeException, ParseException, EReasonerException, EInconsistencyException {
    final IIndividualABoxNode<String, String, String, String> node = _abox.createIndividualNode();
    _abox.getAssertedRBox().addRole("r", RoleType.OBJECT_PROPERTY);
    final IIndividualABoxNode<String, String, String, String> node2 = _abox.createIndividualNode();
    final IIndividualABoxNode<String, String, String, String> node3 = _abox.createIndividualNode();
    node.getRABox().getAssertedSuccessors().put("r", node2);
    node.getRABox().getAssertedSuccessors().put("r", node3);

    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(node2.getNodeID(), _parser.parse("A")));
    assertFalse(result.getDependencyMap().hasGoverningTerm(node3.getNodeID(), _parser.parse("A")));
  }
Пример #2
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")));
  }