当前位置: 首页>>代码示例>>Java>>正文


Java Node.contains方法代码示例

本文整理汇总了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;
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:35,代码来源:StructuralReasoner2.java

示例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;

}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:AbstractOwlSim.java


注:本文中的org.semanticweb.owlapi.reasoner.Node.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。