openllet.owlapi.OWL.differentFrom()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中openllet.owlapi.OWL.differentFrom()方法的一些代码示例,展示了OWL.differentFrom()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OWL.differentFrom()方法的具体详情如下:
包路径:openllet.owlapi.OWL
类名称:OWL
方法名:differentFrom

OWL.differentFrom介绍

暂无

代码示例

代码示例来源:origin: Galigator/openllet

@Test
  public void differentFromAndFunctionality() throws Exception
  {
    assumeTrue(!_classify);

    final OWLAxiom[] axioms = { OWL.functional(_p), OWL.propertyAssertion(_a, _p, _b), OWL.propertyAssertion(_a, _p, _c), OWL.propertyAssertion(_a, _p, _d), OWL.differentFrom(_b, _c), OWL.differentFrom(_c, _d) };

    setupGenerators(Stream.of(axioms));

    testInconsistencyExplanations(0, new OWLAxiom[] { axioms[0], axioms[1], axioms[2], axioms[4] }, new OWLAxiom[] { axioms[0], axioms[2], axioms[3], axioms[5] });
  }
}

代码示例来源:origin: Galigator/openllet

@Test
public void testNone() throws OWLException
{
  addAxiom(OWL.differentFrom(_ind[0], _ind[1]));
  addAxiom(OWL.differentFrom(_ind[2], _ind[3]));
  _pattern.setMaxAllowed(3);
  final List<Lint> lints = _pattern.match(_ontology);
  assertEquals(0, lints.size());
  assertFalse(_pattern.isFixable());
}

代码示例来源:origin: Galigator/openllet

private static OpenlletReasoner setupReasonerIndividualNodeSetPolicy(final IndividualNodeSetPolicy p)
{
  final OWLAxiom[] axioms = { OWL.classAssertion(_a, _C), OWL.classAssertion(_b, _C), OWL.classAssertion(_c, _C), OWL.sameAs(_a, _b), OWL.differentFrom(_b, _c), OWL.differentFrom(_a, _c) };
  final OWLOntology ont = OWL.Ontology(axioms);
  final OWLReasonerConfiguration config = new SimpleConfiguration(new NullReasonerProgressMonitor(), FreshEntityPolicy.ALLOW, Long.MAX_VALUE, p);
  final OpenlletReasoner pellet = OpenlletReasonerFactory.getInstance().createReasoner(ont, config);
  return pellet;
}

代码示例来源:origin: Galigator/openllet

@Override
@Before
public void setUp() throws OWLOntologyCreationException
{
  super.setUp();
  _axioms = new OWLAxiom[] { OWL.subClassOf(_cls[0], OWL.or(_cls[1], _cls[2], _cls[3])), OWL.equivalentClasses(_cls[0], _cls[1]), OWL.differentFrom(_ind[2], _ind[3]) };
}

代码示例来源:origin: Galigator/openllet

@Test
  public void testOne() throws OWLException
  {
    addAxiom(OWL.differentFrom(CollectionUtil.asSet(_ind[0], _ind[1], _ind[2])));

    _pattern.setMaxAllowed(3);
    List<Lint> lints = _pattern.match(_ontology);
    assertEquals(0, lints.size());

    addAxiom(OWL.differentFrom(_ind[3], _ind[4]));
    lints = _pattern.match(_ontology);
    assertEquals(1, lints.size());
    final Lint lint = lints.get(0);
    assertNull(lint.getLintFixer());
    assertEquals(6 + 2, lint.getSeverity().doubleValue(), DOUBLE_DELTA);
    assertSame(_ontology, lint.getParticipatingOntology());
  }
}

代码示例来源:origin: com.github.galigator.openllet/openllet-owlapi

@Test
public void testRegexRestriction() throws OWLOntologyCreationException
{
  try (final OWLManagerGroup group = new OWLManagerGroup())
  {
    final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.inc.regex.restriction"), 1.0);
    final OWLHelper owl = new OWLGenericTools(group, ontId, true);
    final OWLNamedIndividual x1 = i.apply("I1");
    final OWLNamedIndividual x2 = i.apply("I2");
    owl.addAxiom(OWL.equivalentClasses(ClsA, OWL.some(propB, OWL.restrict(XSD.STRING, OWL.facetRestriction(OWLFacet.PATTERN, OWL.constant("A.A"))))));
    owl.addAxiom(OWL.propertyAssertion(x1, propB, OWL.constant("AAA")));
    owl.addAxiom(OWL.propertyAssertion(x2, propB, OWL.constant("BBB")));
    owl.addAxiom(OWL.differentFrom(x1, x2));
    final OWLReasoner r = owl.getReasoner();
    assertTrue(r.isEntailed(OWL.classAssertion(x1, ClsA)));
    assertFalse(r.isEntailed(OWL.classAssertion(x2, ClsA)));
  }
}

代码示例来源:origin: Galigator/openllet

@Test
public void testRegexRestriction() throws OWLOntologyCreationException
{
  try (final OWLManagerGroup group = new OWLManagerGroup())
  {
    final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.inc.regex.restriction"), 1.0);
    final OWLHelper owl = new OWLGenericTools(group, ontId, true);
    final OWLNamedIndividual x1 = i.apply("I1");
    final OWLNamedIndividual x2 = i.apply("I2");
    owl.addAxiom(OWL.equivalentClasses(ClsA, OWL.some(propB, OWL.restrict(XSD.STRING, OWL.facetRestriction(OWLFacet.PATTERN, OWL.constant("A.A"))))));
    owl.addAxiom(OWL.propertyAssertion(x1, propB, OWL.constant("AAA")));
    owl.addAxiom(OWL.propertyAssertion(x2, propB, OWL.constant("BBB")));
    owl.addAxiom(OWL.differentFrom(x1, x2));
    final OWLReasoner r = owl.getReasoner();
    assertTrue(r.isEntailed(OWL.classAssertion(x1, ClsA)));
    assertFalse(r.isEntailed(OWL.classAssertion(x2, ClsA)));
  }
}

代码示例来源:origin: com.github.galigator.openllet/openllet-owlapi

@Test
public void testMaxLengthRestriction() throws OWLOntologyCreationException
{
  try (final OWLManagerGroup group = new OWLManagerGroup())
  {
    final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.inc.maxLength.restriction"), 1.0);
    final OWLHelper owl = new OWLGenericTools(group, ontId, true);
    final OWLNamedIndividual x0 = i.apply("I0");
    final OWLNamedIndividual x1 = i.apply("I1");
    final OWLNamedIndividual x2 = i.apply("I2");
    owl.addAxiom(OWL.equivalentClasses(ClsA, OWL.some(propB, OWL.restrict(XSD.STRING, OWL.facetRestriction(OWLFacet.MAX_LENGTH, OWL.constant(3L))))));
    owl.addAxiom(OWL.propertyAssertion(x0, propB, OWL.constant("")));
    owl.addAxiom(OWL.propertyAssertion(x1, propB, OWL.constant("AA")));
    owl.addAxiom(OWL.propertyAssertion(x2, propB, OWL.constant("AAAAA")));
    owl.addAxiom(OWL.differentFrom(SetUtils.create(x0, x1, x2)));
    final OWLReasoner r = owl.getReasoner();
    assertTrue(r.isEntailed(OWL.classAssertion(x0, ClsA)));
    assertTrue(r.isEntailed(OWL.classAssertion(x1, ClsA)));
    assertFalse(r.isEntailed(OWL.classAssertion(x2, ClsA)));
  }
}

代码示例来源:origin: Galigator/openllet

@Test
public void testMaxLengthRestriction() throws OWLOntologyCreationException
{
  try (final OWLManagerGroup group = new OWLManagerGroup())
  {
    final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.inc.maxLength.restriction"), 1.0);
    final OWLHelper owl = new OWLGenericTools(group, ontId, true);
    final OWLNamedIndividual x0 = i.apply("I0");
    final OWLNamedIndividual x1 = i.apply("I1");
    final OWLNamedIndividual x2 = i.apply("I2");
    owl.addAxiom(OWL.equivalentClasses(ClsA, OWL.some(propB, OWL.restrict(XSD.STRING, OWL.facetRestriction(OWLFacet.MAX_LENGTH, OWL.constant(3L))))));
    owl.addAxiom(OWL.propertyAssertion(x0, propB, OWL.constant("")));
    owl.addAxiom(OWL.propertyAssertion(x1, propB, OWL.constant("AA")));
    owl.addAxiom(OWL.propertyAssertion(x2, propB, OWL.constant("AAAAA")));
    owl.addAxiom(OWL.differentFrom(SetUtils.create(x0, x1, x2)));
    final OWLReasoner r = owl.getReasoner();
    assertTrue(r.isEntailed(OWL.classAssertion(x0, ClsA)));
    assertTrue(r.isEntailed(OWL.classAssertion(x1, ClsA)));
    assertFalse(r.isEntailed(OWL.classAssertion(x2, ClsA)));
  }
}

代码示例来源:origin: Galigator/openllet

owl.addAxiom(OWL.propertyAssertion(x4, propB, OWL.constant("AAAAAAAAA")));
owl.addAxiom(OWL.differentFrom(SetUtils.create(x0, x1, x2, x3, x4)));

代码示例来源:origin: com.github.galigator.openllet/openllet-owlapi

owl.addAxiom(OWL.propertyAssertion(x4, propB, OWL.constant("AAAAAAAAA")));
owl.addAxiom(OWL.differentFrom(SetUtils.create(x0, x1, x2, x3, x4)));

代码示例来源:origin: Galigator/openllet

assertTrue(reasoner.isEntailed(differentFrom(ind1, ind3)));
assertTrue(reasoner.isEntailed(differentFrom(ind1, ind4)));
assertTrue(reasoner.isEntailed(differentFrom(ind5, ind6)));
assertTrue(reasoner.isEntailed(propertyAssertion(ind1, p, ind1)));
assertTrue(reasoner.isEntailed(classAssertion(ind1, test2)));

代码示例来源:origin: Galigator/openllet

assertTrue(reasoner.isEntailed(propertyAssertion(grandfather, hasChild, father)));
assertTrue(reasoner.isEntailed(propertyAssertion(grandfather, hasSon, father)));
assertTrue(reasoner.isEntailed(differentFrom(grandfather, grandmother)));
assertTrue(reasoner.isEntailed(differentFrom(grandfather, father)));
assertTrue(reasoner.isEntailed(differentFrom(grandfather, mother)));
assertTrue(reasoner.isEntailed(differentFrom(grandfather, son)));
assertTrue(reasoner.isEntailed(differentFrom(grandfather, daughter)));
assertFalse(reasoner.isEntailed(propertyAssertion(daughter, hasBrother, son)));
assertTrue(reasoner.isEntailed(differentFrom(personX, personY)));
assertTrue(reasoner.isEntailed(differentFrom(personX, personZ)));
assertTrue(reasoner.isEntailed(differentFrom(personY, personZ)));

相关文章