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

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

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

OWL.DataProperty介绍

暂无

代码示例

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

private static OWLEntity createEntity(final String type, final String entityIRI)
{
  if (CLASS_KEYWORD.equals(type))
    return OWL.Class(entityIRI);
  else
    if (DATA_TYPE_KEYWORD.equals(type))
      return OWL.Datatype(entityIRI);
    else
      if (INDIVIDUAL_KEYWORD.equals(type))
        return OWL.Individual(entityIRI);
      else
        if (DATA_PROPERTY_KEYWORD.equals(type))
          return OWL.DataProperty(entityIRI);
        else
          if (OBJECT_PROPERTY_KEYWORD.equals(type))
            return OWL.ObjectProperty(entityIRI);
  throw new IllegalArgumentException("Unrecognized type of OWLEntity in module " + type);
}

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

private static OWLEntity createEntity(final String type, final String entityIRI)
{
  if (CLASS_KEYWORD.equals(type))
    return OWL.Class(entityIRI);
  else
    if (DATA_TYPE_KEYWORD.equals(type))
      return OWL.Datatype(entityIRI);
    else
      if (INDIVIDUAL_KEYWORD.equals(type))
        return OWL.Individual(entityIRI);
      else
        if (DATA_PROPERTY_KEYWORD.equals(type))
          return OWL.DataProperty(entityIRI);
        else
          if (OBJECT_PROPERTY_KEYWORD.equals(type))
            return OWL.ObjectProperty(entityIRI);
  throw new IllegalArgumentException("Unrecognized type of OWLEntity in module " + type);
}

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

final OWLDataProperty foafName = OWL.DataProperty("http://xmlns.com/foaf/0.1/name");

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

final OWLDataProperty foafName = OWL.DataProperty("http://xmlns.com/foaf/0.1/name");

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

else
  if (ontology.containsDataPropertyInSignature(iri, Imports.EXCLUDED))
    entity = OWL.DataProperty(iri);
  else
    if (ontology.containsIndividualInSignature(iri, Imports.EXCLUDED))

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

else
  if (ontology.containsDataPropertyInSignature(iri, Imports.EXCLUDED))
    entity = OWL.DataProperty(iri);
  else
    if (ontology.containsIndividualInSignature(iri, Imports.EXCLUDED))

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

else
  if (ontology.containsDataPropertyInSignature(iri, Imports.EXCLUDED))
    entity = OWL.DataProperty(iri);
  else
    if (ontology.containsIndividualInSignature(iri, Imports.EXCLUDED))

代码示例来源: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 ruleBuiltinTest3() throws Exception
{
  final SWRLVariable y = SWRL.variable(ontologyURI + "year");
  final SWRLVariable m = SWRL.variable(ontologyURI + "month");
  final SWRLVariable d = SWRL.variable(ontologyURI + "day");
  final OWLDataProperty year = OWL.DataProperty(ontologyURI + "year");
  final OWLDataProperty month = OWL.DataProperty(ontologyURI + "month");
  final OWLDataProperty day = OWL.DataProperty(ontologyURI + "day");
  final OWLAxiom[] axioms = { //
      OWL.propertyAssertion(_a, dp, //
          OWL.constant("2009-01-02", XSD.DATE)), //
      SWRL.rule(//
          SWRL.antecedent(SWRL.propertyAtom(dp, _x, _dx), //
              SWRL.builtIn(SWRLBuiltInsVocabulary.DATE, _dx, y, m, d)), //
          SWRL.consequent(SWRL.propertyAtom(year, _x, y), //
              SWRL.propertyAtom(month, _x, m), //
              SWRL.propertyAtom(day, _x, d)//
          )//
      ) //
  };
  setupGenerators(Stream.of(axioms));
  testExplanations(OWL.propertyAssertion(_a, year, OWL.constant(2009)), 1, new OWLAxiom[] { axioms[0], axioms[1] });
}

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

@Test
public void testAxiomConverterRules4()
{
  final KnowledgeBase kb = new KnowledgeBaseImpl();
  final AxiomConverter converter = new AxiomConverter(kb, OWL._manager.getOWLDataFactory());
  final ATermAppl r = ATermUtils.makeTermAppl("r");
  final ATermAppl s = ATermUtils.makeTermAppl("s");
  final ATermAppl x = ATermUtils.makeVar("x");
  final ATermAppl y = ATermUtils.makeVar("y");
  kb.addDatatypeProperty(r);
  kb.addDatatypeProperty(s);
  final ATermAppl[] head = new ATermAppl[] { ATermUtils.makePropAtom(r, x, y) };
  final ATermAppl[] body = new ATermAppl[] { ATermUtils.makePropAtom(s, x, y) };
  final ATermAppl rule = ATermUtils.makeRule(head, body);
  final OWLAxiom actual = converter.convert(rule);
  final Set<SWRLAtom> antecedent = new HashSet<>();
  final Set<SWRLAtom> consequent = new HashSet<>();
  antecedent.add(propertyAtom(DataProperty("s"), variable("x"), variable("y")));
  consequent.add(propertyAtom(DataProperty("r"), variable("x"), variable("y")));
  final OWLAxiom expected = rule(antecedent, consequent);
  assertEquals(expected, actual);
}

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

final OpenlletReasoner reasoner = buffering ? OpenlletReasonerFactory.getInstance().createReasoner(ont) : OpenlletReasonerFactory.getInstance().createNonBufferingReasoner(ont);
final OWLDataProperty pInt = DataProperty(ns + "pInt");
final OWLDataProperty pDouble = DataProperty(ns + "pDouble");
final OWLDataProperty pBoolean = DataProperty(ns + "pBoolean");

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

@Before
public void createEntities()
{
  _A = OWL.Class(ontologyURI + "A");
  _B = OWL.Class(ontologyURI + "B");
  _C = OWL.Class(ontologyURI + "C");
  _D = OWL.Class(ontologyURI + "D");
  _E = OWL.Class(ontologyURI + "E");
  _F = OWL.Class(ontologyURI + "F");
  _p = OWL.ObjectProperty(ontologyURI + "p");
  _q = OWL.ObjectProperty(ontologyURI + "q");
  _r = OWL.ObjectProperty(ontologyURI + "r");
  dp = OWL.DataProperty(ontologyURI + "dp");
  dq = OWL.DataProperty(ontologyURI + "dq");
  dr = OWL.DataProperty(ontologyURI + "dr");
  _a = OWL.Individual(ontologyURI + "a");
  _b = OWL.Individual(ontologyURI + "b");
  _c = OWL.Individual(ontologyURI + "c");
  _d = OWL.Individual(ontologyURI + "d");
  _dt = OWL.Datatype(ontologyURI + "dt");
  _anon1 = OWL.AnonymousIndividual("anon1");
  _x = SWRL.variable(ontologyURI + "x");
  _y = SWRL.variable(ontologyURI + "y");
  _dx = SWRL.variable(ontologyURI + "dx");
}

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

@Test
public void testAddAndRemove() throws OWLOntologyCreationException
{
  try (final OWLManagerGroup group = new OWLManagerGroup())
  {
    final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.add.remove"), 1.0);
    final OWLHelper owl = new OWLGenericTools(group, ontId, true);
    owl.addAxiom(OWL.declaration(OWL.DataProperty(NS + "propA")));
    owl.addAxiom(OWL.declaration(OWL.Class(NS + "clsA")));
    owl.addAxiom(OWL.equivalentClasses(OWL.Class(NS + "clsA"), //
        OWL.value(OWL.DataProperty(NS + "propA"), OWL.constant(12))//
    ));
    assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
    final OWLNamedIndividual x1 = OWL.Individual(NS + "I1");
    owl.addAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
    assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 1);
    owl.removeAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
    assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
  } // The test is just about not crash.
}

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

@Test
public void testAddAndRemove() throws OWLOntologyCreationException
{
  try (final OWLManagerGroup group = new OWLManagerGroup())
  {
    final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.add.remove"), 1.0);
    final OWLHelper owl = new OWLGenericTools(group, ontId, true);
    owl.addAxiom(OWL.declaration(OWL.DataProperty(NS + "propA")));
    owl.addAxiom(OWL.declaration(OWL.Class(NS + "clsA")));
    owl.addAxiom(OWL.equivalentClasses(OWL.Class(NS + "clsA"), //
        OWL.value(OWL.DataProperty(NS + "propA"), OWL.constant(12))//
    ));
    assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
    final OWLNamedIndividual x1 = OWL.Individual(NS + "I1");
    owl.addAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
    assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 1);
    owl.removeAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
    assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
  } // The test is just about not crash.
}

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

final OWLHelper owl = new OWLGenericTools(group, ontId, true);
final OWLDataProperty property = OWL.DataProperty(NS + "property");
final OWLNamedIndividual individual = OWL.Individual(NS + "individual");
final OWLClass clazz = OWL.Class(NS + "clazz");

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

final OWLHelper owl = new OWLGenericTools(group, ontId, true);
final OWLDataProperty property = OWL.DataProperty(NS + "property");
final OWLNamedIndividual individual = OWL.Individual(NS + "individual");
final OWLClass clazz = OWL.Class(NS + "clazz");

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

final OWLHelper owl = new OWLGenericTools(group, ontId, true);
final OWLDataProperty dpA = OWL.DataProperty(NS + "dpA");
final OWLDataProperty dpB = OWL.DataProperty(NS + "dpB");
final OWLNamedIndividual a = OWL.Individual(NS + "A");
final OWLNamedIndividual b = OWL.Individual(NS + "B");

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

final OWLHelper owl = new OWLGenericTools(group, ontId, true);
final OWLDataProperty dpA = OWL.DataProperty(NS + "dpA");
final OWLDataProperty dpB = OWL.DataProperty(NS + "dpB");
final OWLNamedIndividual a = OWL.Individual(NS + "A");
final OWLNamedIndividual b = OWL.Individual(NS + "B");

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

final OWLHelper owl = new OWLGenericTools(group, ontId, true);
final OWLDataProperty dpA = OWL.DataProperty(NS + "dpA");
final OWLDataProperty dpB = OWL.DataProperty(NS + "dpB");
final OWLNamedIndividual a = OWL.Individual(NS + "A");
final OWLNamedIndividual b = OWL.Individual(NS + "B");

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

final OWLHelper owl = new OWLGenericTools(group, ontId, true);
final OWLDataProperty dpA = OWL.DataProperty(NS + "dpA");
final OWLDataProperty dpB = OWL.DataProperty(NS + "dpB");
final OWLNamedIndividual a = OWL.Individual(NS + "A");
final OWLNamedIndividual b = OWL.Individual(NS + "B");

相关文章