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

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

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

OWL.max介绍

暂无

代码示例

代码示例来源: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
public void objectMaxSubCls()
{
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"), ObjectProperty("p"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"), ObjectProperty("p"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"), Class("B"));
}

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

@Test
public void objectMaxSubCls()
{
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"), ObjectProperty("p"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"), ObjectProperty("p"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
  assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"), Class("B"));
}

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

@Test
public void testNone()
{
  _pattern.setMaxAllowed(3);
  final OWLClassExpression maxCard = OWL.max(_pro[0], 2);
  final OWLAxiom axiom = OWL.subClassOf(_cls[0], maxCard);
  assertNull(_pattern.match(_ontology, axiom));
  assertFalse(_pattern.isFixable());
}

代码示例来源: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 testStage1ZeroCard() throws OWLException
{
  addAxiom(OWL.subClassOf(_cls[0], OWL.or(OWL.min(_pro[0], 0, _cls[1]), OWL.min(_pro[0], 0, _cls[2]))));
  addAxiom(OWL.subClassOf(_cls[1], OWL.max(_pro[0], 0, _cls[0])));
  addAxiom(OWL.subClassOf(_cls[1], OWL.max(_pro[0], 0, _cls[3])));
  addAxiom(OWL.subClassOf(_cls[2], OWL.exactly(_pro[0], 0, _cls[3])));
  addAxiom(OWL.subClassOf(_cls[2], OWL.exactly(_pro[0], 0, _cls[4])));
  addAxiom(OWL.subClassOf(_cls[3], OWL.exactly(_pro[0], 0, _cls[0])));
  addAxiom(OWL.subClassOf(_cls[4], OWL.exactly(_pro[0], 0, _cls[0])));
  final int EXPECTED_SIZE = 0;
  _pattern.setMaxTreeSize(EXPECTED_SIZE);
  final List<Lint> lints = _pattern.match(_ontology);
  assertEquals(0, lints.size());
}

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

@Test
public void testOneMax()
{
  _pattern.setMaxAllowed(2);
  final OWLClassExpression maxCard = OWL.max(_pro[0], 3);
  final OWLAxiom axiom = OWL.disjointClasses(_cls[0], maxCard);
  final Lint lint = _pattern.match(_ontology, axiom);
  assertNotNull(lint);
  assertSame(_pattern, lint.getPattern());
  assertEquals(1, lint.getParticipatingAxioms().size());
  assertNull(lint.getLintFixer());
  assertEquals(3.0, lint.getSeverity().doubleValue(), DOUBLE_DELTA);
  assertSame(_ontology, lint.getParticipatingOntology());
}

代码示例来源: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));
  }
}

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

@Test
public void testInvalidTransitivity()
{
  final String ns = "http://www.example.org/test#";
  final OWLClass C = Class(ns + "C");
  final OWLObjectProperty p1 = ObjectProperty(ns + "p1");
  final OWLObjectProperty p2 = ObjectProperty(ns + "p2");
  final OWLIndividual x = Individual(ns + "x");
  final OWLIndividual y = Individual(ns + "y");
  final OWLIndividual z = Individual(ns + "z");
  final OWLOntology ont = OWL.Ontology(transitive(p1), classAssertion(x, all(p1, C)), propertyAssertion(x, p1, y), propertyAssertion(y, p1, z));
  OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
  assertTrue(reasoner.isEntailed(classAssertion(y, C)));
  assertTrue(reasoner.isEntailed(classAssertion(z, C)));
  final OWLAxiom[] axioms = new OWLAxiom[] { functional(p1), inverseFunctional(p1), irreflexive(p1), asymmetric(p1), disjointProperties(p1, p2), subClassOf(C, min(p1, 2)), classAssertion(x, max(p1, 3)), disjointClasses(C, min(p1, 2)) };
  for (final OWLAxiom axiom : axioms)
  {
    ont.add(axiom);
    reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
    assertTrue(axiom.toString(), reasoner.isEntailed(classAssertion(y, C)));
    assertFalse(axiom.toString(), reasoner.isEntailed(classAssertion(z, C)));
    ont.remove(axiom);
  }
}

相关文章