本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLDisjointClassesAxiom方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLDisjointClassesAxiom方法的具體用法?Java OWLDataFactory.getOWLDisjointClassesAxiom怎麽用?Java OWLDataFactory.getOWLDisjointClassesAxiom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLDataFactory
的用法示例。
在下文中一共展示了OWLDataFactory.getOWLDisjointClassesAxiom方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDisjoint
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* @param f
* @param siblings
* @param inTaxon
* @return axiom
*/
protected OWLAxiom createDisjoint(OWLDataFactory f, Set<OWLClass> siblings, OWLObjectProperty inTaxon) {
Set<OWLClassExpression> expressions = new HashSet<OWLClassExpression>();
for (OWLClass cls : siblings) {
expressions.add(f.getOWLObjectSomeValuesFrom(inTaxon, cls));
}
return f.getOWLDisjointClassesAxiom(expressions);
}
示例2: testUnsatisfiabilityDueToConflictingAxioms1
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Smth like:
* A subClassOf B
* A subClassOf C
* C disjoint with B
* ...
*/
public void testUnsatisfiabilityDueToConflictingAxioms1() {
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLClassExpression classA = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
OWLClassExpression classB = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "B")));
OWLClassExpression classC = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "C")));
OWLNamedIndividual indiv = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indiv);
OWLSubClassOfAxiom axmAsubB = factory.getOWLSubClassOfAxiom(classA, classB);
OWLSubClassOfAxiom axmAsubC = factory.getOWLSubClassOfAxiom(classA, classC);
OWLDisjointClassesAxiom axmBdisC = factory.getOWLDisjointClassesAxiom(classB, classC);
try {
OWLOntology ontology = manager.createOntology();
manager.addAxiom(ontology, fact1);
manager.addAxiom(ontology, axmAsubB);
manager.addAxiom(ontology, axmAsubC);
manager.addAxiom(ontology, axmBdisC);
Wolpertinger wolpertinger = new Wolpertinger(ontology);
assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
fail();
}
}
示例3: createSimpleGraphColoring
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private OWLOntology createSimpleGraphColoring() {
OWLOntology ontoColoring = null;
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLObjectPropertyExpression edgeProp = factory.getOWLObjectProperty(IRI.create(String.format("%s#%s", PREFIX, "edge")));
OWLClassExpression classNode = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Node")));
OWLClassExpression classBlue = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Blue")));
OWLClassExpression classRed = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Red")));
OWLClassExpression classGreen = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Green")));
OWLNamedIndividual indNode1 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node1")));
OWLNamedIndividual indNode2 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node2")));
OWLNamedIndividual indNode3 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node3")));
OWLNamedIndividual indNode4 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node4")));
// now the facts
// nodes
OWLIndividualAxiom axmNodeInst4 =factory.getOWLClassAssertionAxiom(classNode, indNode4);
OWLIndividualAxiom axmNodeInst3 =factory.getOWLClassAssertionAxiom(classNode, indNode3);
OWLIndividualAxiom axmNodeInst2 =factory.getOWLClassAssertionAxiom(classNode, indNode2);
OWLIndividualAxiom axmNodeInst1 =factory.getOWLClassAssertionAxiom(classNode, indNode1);
// 1
// | \
// | 3 - 4
// | /
// 2
//
OWLIndividualAxiom axmEdge12 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode1, indNode2);
OWLIndividualAxiom axmEdge13 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode1, indNode3);
OWLIndividualAxiom axmEdge23 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode2, indNode3);
OWLIndividualAxiom axmEdge34 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode3, indNode4);
// symmetry of edge property
OWLObjectPropertyAxiom axmEdgeSym = factory.getOWLSymmetricObjectPropertyAxiom(edgeProp);
// axioms
OWLObjectUnionOf exprColorUnion = factory.getOWLObjectUnionOf(classBlue, classRed, classGreen);
OWLSubClassOfAxiom axmNodeColorings = factory.getOWLSubClassOfAxiom(classNode, exprColorUnion);
// coloring constraints
OWLSubClassOfAxiom axmRedConstraint = factory.getOWLSubClassOfAxiom(classRed, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classGreen, classBlue)));
OWLSubClassOfAxiom axmBlueConstraint = factory.getOWLSubClassOfAxiom(classBlue, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classGreen, classRed)));
OWLSubClassOfAxiom axmGreenConstraint = factory.getOWLSubClassOfAxiom(classGreen, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classRed, classBlue)));
OWLDisjointClassesAxiom axmDisColors = factory.getOWLDisjointClassesAxiom(classRed, classBlue, classGreen);
try {
ontoColoring = manager.createOntology();
manager.addAxiom(ontoColoring, axmNodeInst1);
manager.addAxiom(ontoColoring, axmNodeInst2);
manager.addAxiom(ontoColoring, axmNodeInst3);
manager.addAxiom(ontoColoring, axmNodeInst4);
manager.addAxiom(ontoColoring, axmEdge12);
manager.addAxiom(ontoColoring, axmEdge13);
manager.addAxiom(ontoColoring, axmEdge23);
manager.addAxiom(ontoColoring, axmEdge34);
manager.addAxiom(ontoColoring, axmEdgeSym);
manager.addAxiom(ontoColoring, axmNodeColorings);
manager.addAxiom(ontoColoring, axmRedConstraint);
manager.addAxiom(ontoColoring, axmBlueConstraint);
manager.addAxiom(ontoColoring, axmGreenConstraint);
manager.addAxiom(ontoColoring, axmDisColors);
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
}
return ontoColoring;
}