本文整理汇总了Java中org.semanticweb.owlapi.model.OWLDisjointUnionAxiom.getOWLClass方法的典型用法代码示例。如果您正苦于以下问题:Java OWLDisjointUnionAxiom.getOWLClass方法的具体用法?Java OWLDisjointUnionAxiom.getOWLClass怎么用?Java OWLDisjointUnionAxiom.getOWLClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLDisjointUnionAxiom
的用法示例。
在下文中一共展示了OWLDisjointUnionAxiom.getOWLClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.semanticweb.owlapi.model.OWLDisjointUnionAxiom; //导入方法依赖的package包/类
public Boolean visit(OWLDisjointUnionAxiom axiom) {
// C = C1 or ... or Cn, for 1 <= i < j <= n: Ci and Cj -> bottom
OWLClass c=axiom.getOWLClass();
Set<OWLClassExpression> cs=new HashSet<OWLClassExpression>(axiom.getClassExpressions());
cs.add(factory.getOWLObjectComplementOf(c));
OWLClassExpression incl1=factory.getOWLObjectUnionOf(cs);
OWLClassExpression incl2=factory.getOWLObjectUnionOf(factory.getOWLObjectComplementOf(factory.getOWLObjectUnionOf(axiom.getClassExpressions())),c);
// incl1: not C or C1 or ... or Cn
// incl2: not(C1 or ... or Cn) or C
Set<OWLClassExpression> conjuncts=new HashSet<OWLClassExpression>();
conjuncts.add(incl1);
conjuncts.add(incl2);
int n=axiom.getClassExpressions().size();
OWLClassExpression[] descs=axiom.getClassExpressions().toArray(new OWLClassExpression[n]);
for (int i=0;i<n-1;i++) {
for (int j=i+1;j<n;j++) {
conjuncts.add(factory.getOWLObjectUnionOf(factory.getOWLObjectComplementOf(descs[i]),factory.getOWLObjectComplementOf(descs[j])));
}
}
OWLClassExpression entailmentDesc=factory.getOWLObjectIntersectionOf(conjuncts);
return !reasoner.isSatisfiable(factory.getOWLObjectComplementOf(entailmentDesc));
}
示例2: visit
import org.semanticweb.owlapi.model.OWLDisjointUnionAxiom; //导入方法依赖的package包/类
@Override
public void visit(OWLDisjointUnionAxiom axiom) {
OWLClass cls = axiom.getOWLClass();
sparql += expressionConverter.asGroupGraphPattern(cls, subjectVar);
List<OWLClassExpression> classExpressions = new LinkedList<>(axiom.getClassExpressions());
for(int i = 0; i < classExpressions.size(); i++){
sparql += "{";
OWLClassExpression ce = classExpressions.remove(i);
// add triple pattern for class to be
sparql += expressionConverter.asGroupGraphPattern(ce, subjectVar);
// add NOT EXISTS for classes not to be
sparql += notExists(subjectVar, classExpressions, false);
classExpressions.add(i, ce);
sparql += "}";
if(i < classExpressions.size()-1){
sparql += " UNION ";
}
}
}