本文整理汇总了Java中org.semanticweb.owlapi.reasoner.OWLReasoner.isSatisfiable方法的典型用法代码示例。如果您正苦于以下问题:Java OWLReasoner.isSatisfiable方法的具体用法?Java OWLReasoner.isSatisfiable怎么用?Java OWLReasoner.isSatisfiable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.reasoner.OWLReasoner
的用法示例。
在下文中一共展示了OWLReasoner.isSatisfiable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printHierarchy
import org.semanticweb.owlapi.reasoner.OWLReasoner; //导入方法依赖的package包/类
/**
* Print the class hierarchy from this class down, assuming this class is at
* the given level. Makes no attempt to deal sensibly with multiple
* inheritance.
*/
private void printHierarchy(OWLReasoner reasoner,
OWLClass clazz, int level) throws OWLException {
/*
* Only print satisfiable classes -- otherwise we end up with bottom
* everywhere
*/
if (reasoner.isSatisfiable(clazz)) {
for (int i = 0; i < level * INDENT; i++) {
out.print(" ");
}
out.println(labelFor(clazz));
/* Find the children and recurse */
for (OWLClass child : reasoner.getSubClasses(clazz, true)
.getFlattened()) {
if (!child.equals(clazz)) {
printHierarchy(reasoner, child, level + 1);
}
}
}
}
示例2: pickRandomOpenChild
import org.semanticweb.owlapi.reasoner.OWLReasoner; //导入方法依赖的package包/类
private Node<ConceptTypeNode> pickRandomOpenChild(Node<ConceptTypeNode> node, OWLReasoner reasoner) {
List<Node<ConceptTypeNode>> children = node.getChildren();
Node<ConceptTypeNode> rndChild = null;
int index = 0;
while(!children.isEmpty() && rndChild == null) {
Node<ConceptTypeNode> child = children.get( index = m_rnd.nextInt( children.size() ) );
switch (child.getObject().getStatus()) {
case OPEN:
//Great. We found it.
rndChild = child;
break;
case CLOSED:
//Some previously closed node (we may even remove it)
//children.remove( index );
break;
case UNKNOWN:
//Need to check SAT to find out if its open or closed
//TODO May use cache or class hierarchy here
long ts = System.currentTimeMillis();
if (reasoner.isSatisfiable( child.getObject().getConceptType().getConjunctiveExpr() )) {
child.getObject().setStatus( STATUS.OPEN );
rndChild = child;
s_sat++;
} else {
//Prune
children.remove( index );
//If the other child is still UNKNOWN, mark it as open
//this may save a SAT check later
if (children.size() == 1) {
child = children.get( 0 );
if (child.getObject().getStatus().equals( STATUS.UNKNOWN )) {
child.getObject().setStatus( STATUS.OPEN );
}
} else {
throw new RuntimeException("Invalid tree!");
}
s_unsat++;
}
m_sat += (System.currentTimeMillis() - ts);
}
}
return rndChild;
}
示例3: generate
import org.semanticweb.owlapi.reasoner.OWLReasoner; //导入方法依赖的package包/类
private boolean generate( Set<ConceptType> conceptTypes,
List<OWLClass> atoms,
OWLReasoner reasoner,
int conceptTypeNumber,
ConceptType partialConceptType,
int atomIndex,
boolean satNeeded) {
OWLObjectIntersectionOf exprCopy = partialConceptType.getConjunctiveExpr();
if ((m_limit >= 0 && conceptTypes.size() >= conceptTypeNumber)) return true;
if (!satNeeded || reasoner.isSatisfiable( exprCopy )) {
if (atomIndex < atoms.size()) {
if (m_rnd.nextBoolean()) {
boolean posSAT = positiveBranch(conceptTypes, atoms, reasoner, conceptTypeNumber, partialConceptType, atomIndex, true);
negativeBranch(conceptTypes, atoms, reasoner, conceptTypeNumber, partialConceptType, atomIndex, posSAT);
} else {
boolean negSAT = negativeBranch(conceptTypes, atoms, reasoner, conceptTypeNumber, partialConceptType, atomIndex, true);
positiveBranch(conceptTypes, atoms, reasoner, conceptTypeNumber, partialConceptType, atomIndex, negSAT);
}
} else {
conceptTypes.add( partialConceptType.clone() );
}
return true;
} else {
return false;
}
}