本文整理了Java中openllet.owlapi.OWL.oneOf()
方法的一些代码示例,展示了OWL.oneOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OWL.oneOf()
方法的具体详情如下:
包路径:openllet.owlapi.OWL
类名称:OWL
方法名:oneOf
暂无
代码示例来源: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 testOneOf()
{
final OWLClassExpression oneOf = OWL.oneOf(_ind);
final OWLAxiom axiom = OWL.equivalentClasses(CollectionUtil.<OWLClassExpression> asSet(_P0AllC0, oneOf));
assertNull(_pattern.match(_ontology, axiom));
}
代码示例来源:origin: Galigator/openllet
@Test
public void testOneOf() throws OWLException
{
addAxiom(OWL.subClassOf(_cls[0], _P0AllC0));
final OWLClassExpression oneOf = OWL.oneOf(_ind);
addAxiom(OWL.equivalentClasses(CollectionUtil.asSet(_cls[0], _cls[1], oneOf)));
final List<Lint> lints = _pattern.match(_ontology);
assertEquals(0, lints.size());
}
代码示例来源: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)));
}
代码示例来源:origin: Galigator/openllet
@Test
public void datatypeEnumeration() throws Exception
{
final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, dp, OWL.constant(1)), OWL.propertyAssertion(_a, dp, OWL.constant(2)), OWL.equivalentClasses(_A, OWL.some(dp, _dt)), OWL.datatypeDefinition(_dt, OWL.oneOf(OWL.constant(1), OWL.constant(2), OWL.constant(3))) };
setupGenerators(Stream.of(axioms));
testExplanations(OWL.classAssertion(_a, _A), 0, new OWLAxiom[] { axioms[0], axioms[2], axioms[3] }, new OWLAxiom[] { axioms[1], axioms[2], axioms[3] });
}
代码示例来源:origin: Galigator/openllet
@Test
public void testSameAs3()
{
final String ns = "urn:test:";
final IRI ontIRI = IRI.create(_base + "test.owl");
final OWLNamedIndividual i1 = Individual(ns + "i1");
final OWLNamedIndividual i2 = Individual(ns + "i2");
final OWLNamedIndividual i3 = Individual(ns + "i3");
final OWLClass c = Class(ns + "c");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(equivalentClasses(c, oneOf(i1, i2)));
axioms.add(classAssertion(i3, c));
final OWLOntology ont = OWL.Ontology(axioms, ontIRI);
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
assertTrue(!reasoner.isEntailed(sameAs(i1, i2)));
assertTrue(!reasoner.isEntailed(sameAs(i1, i3)));
assertStreamAsSetEquals(Stream.of(i1), reasoner.getSameIndividuals(i1).entities());
assertTrue(!reasoner.isEntailed(sameAs(i2, i1)));
assertTrue(!reasoner.isEntailed(sameAs(i2, i3)));
assertStreamAsSetEquals(Stream.of(i2), reasoner.getSameIndividuals(i2).entities());
assertTrue(!reasoner.isEntailed(sameAs(i3, i1)));
assertTrue(!reasoner.isEntailed(sameAs(i3, i2)));
assertStreamAsSetEquals(Stream.of(i3), reasoner.getSameIndividuals(i3).entities());
}
代码示例来源:origin: Galigator/openllet
@Test
public void removeTypeFromMergedNode()
{
createReasoner(OWL.classAssertion(_a, OWL.oneOf(_b, _c)), OWL.classAssertion(_a, _A), OWL.classAssertion(_b, _B), OWL.classAssertion(_c, _C), OWL.classAssertion(_a, _D));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, _A)));
assertFalse(_reasoner.isEntailed(classAssertion(_a, _B)));
assertFalse(_reasoner.isEntailed(classAssertion(_a, _C)));
assertTrue(_reasoner.isEntailed(classAssertion(_a, _D)));
final boolean changeApplied = processRemove(OWL.classAssertion(_a, _D));
assertTrue(changeApplied);
assertTrue(_reasoner.isEntailed(classAssertion(_a, _A)));
assertFalse(_reasoner.isEntailed(classAssertion(_a, _B)));
assertFalse(_reasoner.isEntailed(classAssertion(_a, _C)));
assertFalse(_reasoner.isEntailed(classAssertion(_a, _D)));
}
内容来源于网络,如有侵权,请联系作者删除!