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

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

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

OWL.Class介绍

暂无

代码示例

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

/**
 * Test that named classes as super in subClass axioms are handled correctly.
 */
@Test
public void objectSuperCls()
{
  assertLocal(subClassOf(Class("A"), Class("B")), Class("A"));
  assertNonLocal(subClassOf(Class("A"), Class("B")), Class("B"));
}

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

/**
 * Test that named classes as super in subClass axioms are handled correctly.
 */
@Test
public void objectSuperCls()
{
  assertNonLocal(subClassOf(Class("A"), Class("B")), Class("A"));
  assertLocal(subClassOf(Class("A"), Class("B")), Class("B"));
}

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

/**
 * Test that complemented super descriptions in subclass axioms are handled correctly. (Known to fail in r100 and earlier)
 */
@Test
public void objectComplementSuperCls()
{
  assertLocal(subClassOf(Class("A"), not(Nothing)), Class("A"));
  assertLocal(subClassOf(Class("A"), not(Class("B"))), Class("A"));
  assertNonLocal(subClassOf(Class("A"), not(Class("B"))), Class("A"), Class("B"));
}

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

/**
 * Test that complemented sub class descriptions are handled correctly.
 */
@Test
public void objectComplementSubCls()
{
  assertLocal(subClassOf(not(Thing), Class("A")), Class("A"));
  assertNonLocal(subClassOf(not(Class("B")), Class("A")), Class("A"));
  assertNonLocal(subClassOf(not(Class("B")), Class("A")), Class("A"), Class("B"));
}

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

/**
 * Test that complemented sub class descriptions are handled correctly.
 */
@Test
public void objectComplementSubCls()
{
  assertLocal(subClassOf(not(Thing), Class("A")), Class("A"));
  assertLocal(subClassOf(not(Class("B")), Class("A")), Class("A"));
  assertNonLocal(subClassOf(not(Class("B")), Class("A")), Class("A"), Class("B"));
}

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

/**
   * Test that universal object restriction subclasses are handled correctly
   */
  @Test
  public void objectUniversalSubCls()
  {
    assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"));
    assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), Class("B"));
    assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
  }
}

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

/**
   * Test that universal object restriction subclasses are handled correctly
   */
  @Test
  public void objectUniversalSubCls()
  {
    assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"));
    assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), Class("B"));
    assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
  }
}

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

/**
 * Test that filler classes used in existentials as superclass are handled correctly.
 */
@Test
public void objectExistentialFillerSuperCls()
{
  assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("B"))), Class("A"));
  assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("B"))), Class("A"), ObjectProperty("p"));
}

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

/**
 * Test that in all circumstances where the role of an object existential is not in a signature, the axiom is non-local (Known to fail prior to r99)
 */
@Test
public void objectExistentialSuperClsProp()
{
  assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Thing)), Class("A"));
  assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Nothing)), Class("A"));
  assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("B"))), Class("A"));
  assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("A"))), Class("A"));
}

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

@SuppressWarnings("unchecked")
private void createGraph(final int n)
{
  _graph = new ReachabilityGraph<>();
  _entities = new OWLEntity[n];
  _nodes = new EntityNode[n];
  for (int i = 0; i < n; i++)
  {
    _entities[i] = OWL.Class("entity" + i);
    _nodes[i] = _graph.createEntityNode(_entities[i]);
  }
}

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

@SuppressWarnings("unchecked")
private void createGraph(final int n)
{
  _graph = new ReachabilityGraph<>();
  _nodes = new EntityNode[n];
  for (int i = 0; i < n; i++)
    _nodes[i] = _graph.createEntityNode(OWL.Class("entity" + i));
}

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

@Ignore
@Test
public void testSetTheory() // This test doesn't work, the url isn't available.
{
  final String ns = "http://www.integratedmodelling.org/ks/tarassandbox/set-theory.owl#";
  final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "set-theory.owl");
  final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
  reasoner.getKB().classify();
  assertStreamAsSetEquals(Stream.of(OWL.Class(ns + "SetOfXSets"), OWL.Class(ns + "XSet"), OWL.Class(ns + "XThing")), reasoner.getSubClasses(OWL.Class(ns + "XSetTheoryClass"), true).entities());
}

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

/**
 * Test that object property domain axioms are handled correctly
 */
@Test
public void objectDomain()
{
  assertLocal(domain(ObjectProperty("p"), Class("D")));
  assertLocal(domain(ObjectProperty("p"), Class("D")), Class("D"));
  assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"));
  assertLocal(domain(ObjectProperty("p"), Thing), ObjectProperty("p"));
  assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"), Class("D"));
}

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

@Test
public void testQualifiedCardinality1()
{
  final String ns = "http://www.example.org/test#";
  final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "qcr.owl");
  final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
  final OWLClass sub = Class(ns + "sub");
  final OWLClass sup = Class(ns + "sup");
  assertTrue(reasoner.isConsistent());
  assertTrue(reasoner.isEntailed(subClassOf(sub, sup)));
  assertTrue(reasoner.getSubClasses(sup, false).entities().filter(x -> x.equals(sub)).findAny().isPresent());
  assertTrue(reasoner.getSuperClasses(sub, false).entities().filter(x -> x.equals(sup)).findAny().isPresent());
}

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

@Test
public void koalaHardWorkingDomain() throws Exception
{
  final String ns = "http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#";
  final OWLOntology ontology = _manager.loadOntologyFromOntologyDocument(ClassLoader.getSystemResourceAsStream("test/data/modularity/koala.owl"));
  final OWLClass animal = OWL.Class(ns + "Animal");
  final OWLClass person = OWL.Class(ns + "Person");
  final OWLDataProperty hardWorking = OWL.DataProperty(ns + "isHardWorking");
  setupGenerators(ontology.axioms());
  testExplanations(OWL.domain(hardWorking, animal), 0, new OWLAxiom[] { OWL.subClassOf(person, animal), OWL.domain(hardWorking, person) });
}

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

@Test
  public void testComplementRemoval()
  {
    final String ns = "http://test#";

    final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), MiscTests._base + "ticket539.ofn");

    final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createNonBufferingReasoner(ont);

    assertFalse(reasoner.isConsistent());

    ont.removeAxiom(OWL.subClassOf(OWL.Class(ns + "a_GROUP"), OWL.Class(ns + "a_TEMPORALTHING")));
    assertFalse(reasoner.isConsistent());

    ont.removeAxiom(OWL.subClassOf(OWL.Class(ns + "a_INDIVIDUAL"), OWL.not(OWL.Class(ns + "a_SETORCOLLECTION"))));
    assertFalse(reasoner.isConsistent());
  }
}

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

@Test
public void testPunningSingletonOneOf()
{
  final OWLClass A = OWL.Class("A");
  final OWLIndividual a = OWL.Individual("A");
  final Set<OWLAxiom> axioms = new HashSet<>();
  axioms.add(OWL.equivalentClasses(A, OWL.oneOf(a)));
  final OWLOntology ontology = OWL.Ontology(axioms);
  final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology);
  final PelletExplanation explain = new PelletExplanation(reasoner);
  assertEquals(axioms, explain.getEntailmentExplanation(OWL.classAssertion(a, A)));
}

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

@Test
public void testPunningOneOf()
{
  final OWLClass A = OWL.Class("A");
  final OWLIndividual a = OWL.Individual("A");
  final OWLIndividual b = OWL.Individual("b");
  final Set<OWLAxiom> axioms = new HashSet<>();
  axioms.add(OWL.equivalentClasses(A, OWL.oneOf(a, b)));
  final OWLOntology ontology = OWL.Ontology(axioms);
  final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology);
  final PelletExplanation explain = new PelletExplanation(reasoner);
  assertEquals(axioms, explain.getEntailmentExplanation(OWL.classAssertion(a, A)));
}

相关文章