本文整理了Java中openllet.owlapi.OWL.declaration()
方法的一些代码示例,展示了OWL.declaration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OWL.declaration()
方法的具体详情如下:
包路径:openllet.owlapi.OWL
类名称:OWL
方法名:declaration
暂无
代码示例来源:origin: Galigator/openllet
for (final OWLEntity e : notReferenced)
if (_entityAxioms.get(e) != null)
axioms.add(OWL.declaration(e));
代码示例来源:origin: Galigator/openllet
for (final OWLEntity e : notReferenced)
if (_entityAxioms.get(e) != null)
axioms.add(OWL.declaration(e));
代码示例来源:origin: Galigator/openllet
/**
* Test that adding and removing axioms together cancels out. This matches behavior from Protege of creating a new class, Class_1, then renaming with a
* useful name. Known to fail in r136.
*
* @throws OWLException
*/
@Test
public void addAndRename()
{
final OWLAxiom[] axioms = { subClassOf(_A, Thing), subClassOf(_B, Thing) };
final OWLAxiom[] additions = { declaration(_C), subClassOf(_C, _A), declaration(_D), subClassOf(_D, _A) };
final OWLAxiom[] deletions = { declaration(_C), subClassOf(_C, _A) };
updateTest(axioms, additions, deletions);
}
代码示例来源:origin: Galigator/openllet
final AddAxiom classAxiom = new AddAxiom(ontology, OWL.declaration(owlClass));
changes.add(classAxiom);
代码示例来源:origin: Galigator/openllet
final AddAxiom classAxiom = new AddAxiom(ontology, OWL.declaration(owlClass));
changes.add(classAxiom);
代码示例来源:origin: Galigator/openllet
private void modularityTest(final OWLOntology ontology, final Set<OWLEntity> signature, final ModuleType moduleType)
{
final Set<OWLAxiom> computed = ModularityUtils.extractModule(ontology, signature, moduleType);
final OntologySegmenter segmenter = new SyntacticLocalityModuleExtractor(_manager, ontology, moduleType);
final Set<OWLAxiom> expected = segmenter.extract(signature);
// prune declarations to avoid mismatches related to declarations
for (final OWLEntity entity : signature)
{
final OWLDeclarationAxiom declaration = OWL.declaration(entity);
computed.remove(declaration);
computed.remove(declaration);
}
for (final Iterator<OWLAxiom> i = expected.iterator(); i.hasNext();)
{
final OWLAxiom axiom = i.next();
if (axiom.getAxiomType() == AxiomType.SAME_INDIVIDUAL || axiom.getAxiomType() == AxiomType.DIFFERENT_INDIVIDUALS)
i.remove();
}
TestUtils.assertToStringEquals("Modules diff for " + signature, expected.toArray(new OWLAxiom[0]), computed.toArray(new OWLAxiom[0]));
}
代码示例来源:origin: Galigator/openllet
/**
* Test that entities appearing in declarations only can still be used in clashExplanation requests.
*/
@Test
public void declarationOnlyEntity() throws Exception
{
final OWLAxiom[] axioms = { OWL.equivalentClasses(_A, OWL.Thing), OWL.declaration(_B) };
setupGenerators(Stream.of(axioms));
testExplanations(OWL.subClassOf(_B, _A), 0, new OWLAxiom[] { axioms[0] });
}
代码示例来源:origin: Galigator/openllet
/**
* Test that adding a non-local axiom is handled correctly.
*
* @throws OWLException
*/
@Test
public void addNonLocal()
{
final OWLAxiom[] axioms = { declaration(_A) };
final OWLAxiom[] additions = { equivalentClasses(_B, all(_p, _B)) };
final OWLAxiom[] deletions = {};
updateTest(axioms, additions, deletions);
}
代码示例来源: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
/**
* A _data property range axiom should be removable without causing a full KB reload
*/
@Test
public void removeDataPropertyRangeAxiom()
{
createReasoner(declaration(_dp), declaration(_C), range(_dp, XSD.INTEGER), propertyAssertion(_a, _dp, constant("foo")));
assertFalse(_reasoner.isConsistent());
final boolean changeApplied = processRemove(range(_dp, XSD.INTEGER));
assertTrue("Unable to remove _data property range axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
}
代码示例来源:origin: Galigator/openllet
/**
* An object property domain axiom should be removable without causing a full KB reload even if it is a class expression
*/
@Test
public void removeObjectPropertyDomainAxiomExpression()
{
createReasoner(declaration(_p), declaration(_C), declaration(_D), domain(_p, or(_C, _D)), propertyAssertion(_a, _p, _b));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, or(_C, _D))));
final boolean changeApplied = processRemove(domain(_p, or(_C, _D)));
assertTrue("Unable to remove object property domain axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
assertFalse(_reasoner.isEntailed(classAssertion(_a, or(_C, _D))));
}
代码示例来源:origin: Galigator/openllet
/**
* An object property range axiom should be removable without causing a full KB reload even if it is a class expression
*/
@Test
public void removeObjectPropertyRangeAxiomExpression()
{
createReasoner(declaration(_p), declaration(_C), declaration(_D), range(_p, or(_C, _D)), propertyAssertion(_a, _p, _b));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_b, or(_C, _D))));
final boolean changeApplied = processRemove(range(_p, or(_C, _D)));
assertTrue("Unable to remove object property range axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
assertFalse(_reasoner.isEntailed(classAssertion(_b, or(_C, _D))));
}
代码示例来源:origin: Galigator/openllet
/**
* A _data property domain axiom should be removable without causing a full KB reload even if it is a class expression
*/
@Test
public void removeDataPropertyDomainAxiomExpression()
{
createReasoner(declaration(_dp), declaration(_C), declaration(_D), domain(_dp, or(_C, _D)), propertyAssertion(_a, _dp, _lit));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, or(_C, _D))));
final boolean changeApplied = processRemove(domain(_dp, or(_C, _D)));
assertTrue("Unable to remove _data property domain axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
assertFalse(_reasoner.isEntailed(classAssertion(_a, or(_C, _D))));
}
代码示例来源:origin: Galigator/openllet
/**
* A _data property domain axiom should be removable without causing a full KB reload
*/
@Test
public void removeDataPropertyDomainAxiom()
{
createReasoner(declaration(_dp), declaration(_C), domain(_dp, _C), propertyAssertion(_a, _dp, _lit));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, _C)));
final boolean changeApplied = processRemove(domain(_dp, _C));
assertTrue("Unable to remove _data property domain axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
assertFalse(_reasoner.isEntailed(classAssertion(_a, _C)));
}
代码示例来源:origin: Galigator/openllet
/**
* An object property domain axiom should be removable without causing a full KB reload
*/
@Test
public void removeObjectPropertyDomainAxiom()
{
createReasoner(declaration(_p), declaration(_C), domain(_p, _C), propertyAssertion(_a, _p, _b));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, _C)));
final boolean changeApplied = processRemove(domain(_p, _C));
assertTrue("Unable to remove object property domain axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
assertFalse(_reasoner.isEntailed(classAssertion(_a, _C)));
}
代码示例来源:origin: Galigator/openllet
/**
* An object property range axiom should be removable without causing a full KB reload
*/
@Test
public void removeObjectPropertyRangeAxiom()
{
createReasoner(declaration(_p), declaration(_C), range(_p, _C), propertyAssertion(_a, _p, _b));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_b, _C)));
final boolean changeApplied = processRemove(range(_p, _C));
assertTrue("Unable to remove object property range axiom", changeApplied);
assertTrue(_reasoner.isConsistent());
assertFalse(_reasoner.isEntailed(classAssertion(_b, _C)));
}
代码示例来源:origin: Galigator/openllet
@Test
/**
* Test for the enhancement required in #252
*/
public void testBooleanDatatypeConstructors()
{
final OWLDatatype nni = XSD.NON_NEGATIVE_INTEGER;
final OWLDatatype npi = XSD.NON_POSITIVE_INTEGER;
final OWLDatatype ni = XSD.NEGATIVE_INTEGER;
final OWLDatatype pi = XSD.POSITIVE_INTEGER;
final OWLDatatype f = XSD.FLOAT;
final OWLDatatype i = XSD.INTEGER;
createReasoner(OWL.declaration(nni), OWL.declaration(npi), OWL.declaration(ni), OWL.declaration(pi), OWL.declaration(f), OWL.declaration(_dq), OWL.range(_dp, OWL.dataAnd(pi, ni)));
assertTrue(_reasoner.isSatisfiable(OWL.some(_dq, pi)));
assertTrue(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataNot(pi))));
assertFalse(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataAnd(pi, ni))));
assertFalse(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataAnd(f, OWL.dataOr(pi, ni)))));
assertTrue(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataAnd(npi, ni))));
assertTrue(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataAnd(nni, pi))));
assertTrue(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataOr(nni, npi))));
assertTrue(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataAnd(nni, npi))));
assertFalse(_reasoner.isSatisfiable(OWL.some(_dq, OWL.dataAnd(pi, OWL.restrict(i, OWL.maxExclusive(0))))));
assertFalse(_reasoner.isSatisfiable(OWL.some(_dp, XSD.ANY_TYPE)));
}
代码示例来源:origin: Galigator/openllet
@Test
public void removeAndAddObjectPropertyDomainAxiom()
{
createReasoner(declaration(_p), declaration(_C), domain(_p, _C), propertyAssertion(_a, _p, _b));
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, _C)));
final boolean removeApplied = processRemove(domain(_p, _C));
assertTrue("Unable to remove object property domain axiom", removeApplied);
final boolean addApplied = processAdd(domain(_p, _C));
assertTrue("Unable to add object property domain axiom", addApplied);
assertTrue(_reasoner.isConsistent());
assertTrue(_reasoner.isEntailed(classAssertion(_a, _C)));
}
}
代码示例来源: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
@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.
}
内容来源于网络,如有侵权,请联系作者删除!