本文整理汇总了Java中org.semanticweb.owlapi.reasoner.Node.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Node.contains方法的具体用法?Java Node.contains怎么用?Java Node.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.reasoner.Node
的用法示例。
在下文中一共展示了Node.contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObjectPropertyValues
import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual ind, OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet();
Node<OWLObjectPropertyExpression> inverses = getInverseObjectProperties(pe);
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLObjectPropertyAssertionAxiom axiom : ontology.getObjectPropertyAssertionAxioms(ind)) {
if (!axiom.getObject().isAnonymous()) {
if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
}
}
}
// Inverse of pe
if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) {
OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified();
if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
}
}
}
}
}
// Could do other stuff like inspecting owl:hasValue restrictions
return result;
}
示例2: filterEnrichmentResults
import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public List<EnrichmentResult> filterEnrichmentResults(List<EnrichmentResult> resultsIn) {
// assume sorted by p-value
LOG.info("Sorting: "+resultsIn.size()+" results");
List<EnrichmentResult> resultsOut = new ArrayList<EnrichmentResult>();
// map from all sample set classes to all better enriched classes
Map<OWLClass,Set<OWLClass>> betters = new HashMap<OWLClass,Set<OWLClass>>();
for (int i=0; i<resultsIn.size(); i++) {
EnrichmentResult r = resultsIn.get(i);
OWLClass sc = r.sampleSetClass;
OWLClass ec = r.enrichedClass;
//LOG.info(" R: "+r);
if (!betters.containsKey(sc)) {
betters.put(sc, new HashSet<OWLClass>());
}
boolean isRedundant = false;
// everything that came before will have a higher score;
// for the given sample class, find the enriched classes
// that are better; if any of these is more specific than the
// current ec under consideration, skip it
for (OWLClass bc : betters.get(sc)) {
for (Node<OWLClass> bca : getNamedSubsumers(bc)) {
//LOG.info("T: "+bca+" of "+bc+" SC="+sc);
if (bca.contains(ec)) {
isRedundant = true;
LOG.info(" Redundant: "+sc+" "+ec+" with:"+bc);
break;
}
}
if (isRedundant)
break;
}
if (!isRedundant) {
resultsOut.add(r);
}
betters.get(sc).add(ec);
}
return resultsOut;
}