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

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

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

OWL.and介绍

[英]Return a class expression that is a logical and between a set of properties (objets/datas) and classes.
[中]返回一个类表达式,该表达式是一组属性(对象/数据)和类之间的逻辑and。

代码示例

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

private static Set<OWLClassAxiom> fixEquivalentAxioms(final OWLClass classToFix, final Set<OWLEquivalentClassesAxiom> axioms)
  {
    final Set<OWLClassAxiom> fixes = new HashSet<>();
    for (final OWLEquivalentClassesAxiom axiom : axioms)
    {
      final Set<OWLClassExpression> descs = axiom.classExpressions().collect(Collectors.toSet());
      descs.remove(classToFix);

      if (descs.size() == 1)
        fixes.add(OWL.subClassOf(classToFix, descs.iterator().next()));
      else
      {
        fixes.add(OWL.equivalentClasses(descs));
        fixes.add(OWL.subClassOf(classToFix, OWL.and(descs)));
      }
    }
    return fixes;
  }
}

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

result.add(OWL.subClassOf(Class(IRIUtils.clazz(iface)), and(objectMethods, dataMethods, classes)));
return result;

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

result.add(OWL.subClassOf(Class(IRIUtils.clazz(iface)), and(objectMethods, dataMethods, classes)));
return result;

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

result.add(OWL.subClassOf(Class(IRIUtils.clazz(iface)), and(objectMethods, dataMethods, classes)));
return result;

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

/**
 * @param property is the property that support the given range. In fact can be all 'simple' DataProperty you may want.
 * @param range like [1..3] or more complex if you want.
 * @param literal to check, 2 is include [1..3], 4 isn't include in [1..3].
 * @return true if the literal is in the range.
 * @since 2.6.1
 */
default public boolean isLiteralIncludeInRange(final OWLDataProperty property, final OWLDataRange range, final OWLLiteral literal)
{
  return getReasoner().isSatisfiable(//
      OWL.and(// You must be of all the following class
          OWL.some(property, OWL.oneOf(literal)), // The class of the 'literal'
          OWL.some(property, range), // The class of the range.
          OWL.max(property, 1))// But you can have the property only once.
  );
}

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

/**
 * @param property is the property that support the given range. In fact can be all 'simple' DataProperty you may want.
 * @param range like [1..3] or more complex if you want.
 * @param literal to check, 2 is include [1..3], 4 isn't include in [1..3].
 * @return true if the literal is in the range.
 * @since 2.6.1
 */
default public boolean isLiteralIncludeInRange(final OWLDataProperty property, final OWLDataRange range, final OWLLiteral literal)
{
  return getReasoner().isSatisfiable(//
      OWL.and(// You must be of all the following class
          OWL.some(property, OWL.oneOf(literal)), // The class of the 'literal'
          OWL.some(property, range), // The class of the range.
          OWL.max(property, 1))// But you can have the property only once.
  );
}

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

/**
 * @param property is the property that support the given range. In fact can be all 'simple' DataProperty you may want.
 * @param range like [1..3] or more complex if you want.
 * @param literal to check, 2 is include [1..3], 4 isn't include in [1..3].
 * @return true if the literal is in the range.
 * @since 2.6.1
 */
default public boolean isLiteralIncludeInRange(final OWLDataProperty property, final OWLDataRange range, final OWLLiteral literal)
{
  return getReasoner().isSatisfiable(//
      OWL.and(// You must be of all the following class
          OWL.some(property, OWL.oneOf(literal)), // The class of the 'literal'
          OWL.some(property, range), // The class of the range.
          OWL.max(property, 1))// But you can have the property only once.
  );
}

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

/**
 * Test that entities appearing in declarations only can still be used in clashExplanation requests (in uninteresting ways).
 */
@Test
public void declarationOnlyIrrelevantEntity() throws Exception
{
  final OWLAxiom[] axioms = { OWL.subClassOf(_B, _A), OWL.declaration(_p) };
  setupGenerators(Stream.of(axioms));
  testExplanations(OWL.subClassOf(OWL.and(_B, OWL.some(_p, OWL.Thing)), _A), 0, new OWLAxiom[] { axioms[0] });
}

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

@Test
public void nestedUnionTest()
{
  final OWLAxiom[] axioms = { equivalentClasses(_A, and(_B, or(_C, _D))), equivalentClasses(_E, and(_B, _C)) };
  extractModules(axioms);
  testModule(_A, _A, _B, _C, _D, _E);
  testModule(_B, _B);
  testModule(_C, _C);
  testModule(_D, _D);
  testModule(_E, _A, _B, _C, _D, _E);
}

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

/**
 * Test for #447
 */
@Test
public void testGetUnsatClasses()
{
  createReasoner(OWL.disjointClasses(_A, _B), OWL.equivalentClasses(_C, OWL.and(_A, _B)));
  assertStreamAsSetEquals(Stream.of(_C, OWL.Nothing), _reasoner.getUnsatisfiableClasses().entities());
  assertStreamAsSetEquals(Stream.of(_C, OWL.Nothing), _reasoner.getEquivalentClasses(_C).entities());
}

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

@Test
public void userDefinedDatatype2() throws Exception
{
  final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.subClassOf(_A, OWL.and(OWL.max(dp, 1), OWL.some(dp, OWL.restrict(XSD.INTEGER, OWL.minExclusive(10))))), OWL.equivalentClasses(_B, OWL.and(OWL.min(dp, 1), OWL.all(dp, OWL.restrict(XSD.INTEGER, OWL.minExclusive(5))))) };
  setupGenerators(Stream.of(axioms));
  testExplanations(OWL.classAssertion(_a, _B), 0, axioms);
}

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

@Test
public void intersectionTest()
{
  final OWLAxiom[] axioms = { equivalentClasses(_A, and(_B, _C)) };
  extractModules(axioms);
  testModule(_A, _A, _B, _C);
  testModule(_B, _B);
  testModule(_C, _C);
}

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

@Test
public void testEquivalentWithManyDescriptions() throws OWLException
{
  addAxiom(OWL.subClassOf(_cls[0], _P0SomeC1));
  final OWLClassExpression exactly = OWL.exactly(_pro[1], 2, _cls[2]);
  final OWLAxiom badAxiom = OWL.equivalentClasses(CollectionUtil.asSet(_cls[0], _cls[3], _cls[4], exactly));
  addAxiom(badAxiom);
  final Set<OWLClassExpression> restOf = CollectionUtil.asSet(_cls[3], _cls[4], exactly);
  final OWLAxiom fixedAxiom1 = OWL.equivalentClasses(restOf);
  final OWLAxiom fixedAxiom2 = OWL.subClassOf(_cls[0], OWL.and(restOf));
  final List<Lint> lints = _pattern.match(_ontology);
  assertEquals(1, lints.size());
  final LintFixer fixer = lints.get(0).getLintFixer();
  final Set<? extends OWLAxiom> axiomsToRemove = fixer.getAxiomsToRemove();
  final Set<? extends OWLAxiom> axiomsToAdd = fixer.getAxiomsToAdd();
  assertEquals(1, axiomsToRemove.size());
  assertTrue(axiomsToRemove.contains(badAxiom));
  assertEquals(2, axiomsToAdd.size());
  assertTrue(axiomsToAdd.contains(fixedAxiom1));
  assertTrue(axiomsToAdd.contains(fixedAxiom2));
}

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

@Test
public void testNested1()
{
  _pattern.setMaxAllowed(2);
  final OWLClassExpression union = OWL.or(_cls[1], _cls[2], _cls[3]);
  final OWLClassExpression all = OWL.all(_pro[0], union);
  final OWLClassExpression and = OWL.and(all, _cls[4]);
  final OWLAxiom axiom = OWL.equivalentClasses(and, _cls[0]);
  assertNotNull(_pattern.match(_ontology, axiom));
}

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

@Test
public void userDefinedDatatype1() throws Exception
{
  final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), OWL.equivalentClasses(_B, OWL.and(_A, OWL.some(dp, OWL.restrict(XSD.INTEGER, OWL.maxExclusive(10))))) };
  setupGenerators(Stream.of(axioms));
  testExplanations(OWL.classAssertion(_a, _B), 0, axioms);
}

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

@Test
public void userDefinedDatatype3() throws Exception
{
  final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), OWL.equivalentClasses(_B, OWL.and(_A, OWL.some(dp, _dt))), OWL.datatypeDefinition(_dt, OWL.restrict(XSD.INTEGER, OWL.maxExclusive(10))) };
  setupGenerators(Stream.of(axioms));
  testExplanations(OWL.classAssertion(_a, _B), 0, axioms);
}

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

owl.addAxiom(OWL.equivalentClasses(ClsD, OWL.and(ClsC, ClsA)));
owl.addAxiom(OWL.equivalentClasses(ClsE, OWL.and(ClsC, ClsB)));

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

@Test
public void indirectModuleTest()
{
  final OWLAxiom[] axioms = { subClassOf(_A, and(_B, _C, some(_p, _C))), subClassOf(_B, or(all(_p, not(_C)), _D)), subClassOf(_D, _E) };
  final OWLAxiom[] additions = { subClassOf(_A, not(_E)) };
  final OWLAxiom[] deletions = {};
  updateTest(axioms, additions, deletions);
}

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

@Test
public void testStage1SimpleCycle() throws OWLException
{
  addAxiom(OWL.subClassOf(_cls[0], OWL.some(_pro[0], _cls[1])));
  addAxiom(OWL.subClassOf(_cls[1], OWL.and(OWL.some(_pro[1], _cls[1]), OWL.some(_pro[1], _cls[2]))));
  addAxiom(OWL.subClassOf(_cls[2], OWL.some(_pro[1], _cls[3])));
  addAxiom(OWL.subClassOf(_cls[3], OWL.some(_pro[1], _cls[0])));
  addAxiom(OWL.subClassOf(OWL.some(_pro[2], _cls[1]), _cls[3]));
  final int EXPECTED_SIZE = 1;
  _pattern.setMaxTreeSize(EXPECTED_SIZE);
  final List<Lint> lints = _pattern.match(_ontology);
  assertEquals(0, lints.size());
  assertFalse(_pattern.isFixable());
}

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

@Test
  public void testNested()
  {
    _pattern.setMaxAllowed(2);

    final OWLClassExpression exactCard = OWL.exactly(_pro[0], 3, _cls[0]);
    final OWLClassExpression and = OWL.or(_cls[1], exactCard);
    OWLAxiom axiom = OWL.subClassOf(and, _cls[2]);
    assertNotNull(_pattern.match(_ontology, axiom));

    final OWLClassExpression minCard = OWL.min(_pro[0], 3, _cls[0]);
    final OWLClassExpression union = OWL.or(_cls[1], minCard);
    axiom = OWL.subClassOf(union, _cls[2]);
    assertNotNull(_pattern.match(_ontology, axiom));

    final OWLClassExpression maxCard1 = OWL.max(_pro[0], 3, _cls[1]);
    final OWLClassExpression and2 = OWL.and(_cls[2], maxCard1);
    axiom = OWL.subClassOf(and2, _cls[3]);
    assertNotNull(_pattern.match(_ontology, axiom));

    final OWLClassExpression maxCard2 = OWL.max(_pro[0], 2, _cls[2]);
    axiom = OWL.subClassOf(_cls[4], maxCard2);
    assertNull(_pattern.match(_ontology, axiom));
  }
}

相关文章