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


Java Node.getEntities方法代码示例

本文整理汇总了Java中org.semanticweb.owlapi.reasoner.Node.getEntities方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getEntities方法的具体用法?Java Node.getEntities怎么用?Java Node.getEntities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.semanticweb.owlapi.reasoner.Node的用法示例。


在下文中一共展示了Node.getEntities方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLowestCommonSubsumersCommand

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public void getLowestCommonSubsumersCommand() throws IOException, OWLOntologyCreationException, OWLOntologyStorageException, UnknownOWLClassException {
	if (isHelp()) {
		info("Returns LCSs using sim2");
		return;
	}
	headerOWL();
	OwlSim sos = getOWLSim();

	Set<OWLObject> objs = this.resolveEntityList();
	if (objs.size() == 2) {
		Iterator<OWLObject> oit = objs.iterator();
		OWLClass a = (OWLClass) oit.next();
		OWLClass b = (OWLClass) oit.next();
		Set<Node<OWLClass>> lcsNodes = sos.getNamedCommonSubsumers(a, b);
		for (Node<OWLClass> n : lcsNodes) {
			for (OWLClass c : n.getEntities()) {
				output(c);
			}
		}
	}
	else {
		// TODO - throw
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:OWLHandler.java

示例2: precomputeAttributeElementCount

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public void precomputeAttributeElementCount() {
	if (attributeElementCount != null)
		return;
	attributeElementCount = new HashMap<OWLClass, Integer>();
	for (OWLEntity e : this.getAllElements()) {
		LOG.info("Adding 1 to all attributes of "+e);
		for (OWLClass dc : getAttributesForElement(e)) {
			for (Node<OWLClass> n : this.getNamedReflexiveSubsumers(dc)) {
				for (OWLClass c : n.getEntities()) {
					if (!attributeElementCount.containsKey(c))
						attributeElementCount.put(c, 1);
					else
						attributeElementCount.put(c, attributeElementCount.get(c)+1);
				}
			}

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

示例3: precomputeAttributeElementCount

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
/**
 * Mapping between an attribute (e.g. phenotype class) and the number of
 * instances it classifies
 */
protected void precomputeAttributeElementCount() {
	if (attributeElementCount != null) return;
	attributeElementCount = new HashMap<OWLClass, Integer>();
	// some high level attributes will classify all or most of the ABox;
	// this way may be faster...
	for (OWLNamedIndividual e : this.getAllElements()) {
		LOG.info("Incrementing count all attributes of " + e);
		LOG.info(" DIRECT ATTS: " + getAttributesForElement(e).size());
		for (Node<OWLClass> n : this.getInferredAttributes(e)) {
			for (OWLClass c : n.getEntities()) {
				if (!attributeElementCount.containsKey(c))
					attributeElementCount.put(c, 1);
				else
					attributeElementCount.put(c, attributeElementCount.get(c) + 1);
			}
		}
	}
	LOG.info("Finished precomputing attribute element count");
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:SimpleOwlSim.java

示例4: addNode

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public void addNode(Node<T> node) {
    for (T element : node.getEntities()) {
        map.put(element, node);
        if (element.isTopEntity()) {
            topNode = node;
        }
        else if (element.isBottomEntity()) {
            bottomNode = node;
        }
    }
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:12,代码来源:StructuralReasoner2.java

示例5: removeNode

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public void removeNode(T containing) {
    Node<T> node = map.remove(containing);
    if (node != null) {
        for (T object : node.getEntities()) {
            map.remove(object);
        }
    }
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:9,代码来源:StructuralReasoner2.java

示例6: getIndexedClass

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
private OWLClass getIndexedClass(Node<OWLClass> n) throws UnknownOWLClassException {
	if (representativeClassMap == null)
		representativeClassMap = new HashMap<Node<OWLClass>, OWLClass>();
	else if (representativeClassMap.containsKey(n))
		return representativeClassMap.get(n);
	for (OWLClass c : n.getEntities()) {
		if (classIndex.containsKey(c)) {
			representativeClassMap.put(n,c);
			return c;				
		}
	}
	throw new UnknownOWLClassException(getDeterministicRepresentative(n));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:14,代码来源:FastOwlSim.java

示例7: run

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public void run(Wolpertinger wolpertinger, Configuration configuration, StatusOutput status, PrintWriter output) {
          OWLClass owlClass = wolpertinger.getClass(conceptName);
	Node<OWLClass> equivalentConcepts = wolpertinger.getEquivalentClasses(owlClass);
	for (OWLClass cl : equivalentConcepts.getEntities()) {
		output.println(cl);
	}					
	output.flush();
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:9,代码来源:WolpertingerCli.java

示例8: performConsistencyChecks

import org.semanticweb.owlapi.reasoner.Node; //导入方法依赖的package包/类
public ConsistencyReport performConsistencyChecks(){

		if(graph == null){
			return new ConsistencyReport("The ontology is not set.");
		}

		OWLOntology ont = graph.getSourceOntology();
		reasoner = getReasoner(ont);
		long t1 = System.currentTimeMillis();

		logInfo("Consistency check started............");
		boolean consistent = reasoner.isConsistent();

		logInfo("Is the ontology consistent ....................." + consistent + ", " + (System.currentTimeMillis()-t1)/100);

		List<String> errors = new ArrayList<String>();
		Set<OWLEntity> unsatisfiable = new HashSet<OWLEntity>();
		if(!consistent){
			errors.add("The ontology '" + graph.getOntologyId() + " ' is not consistent");
		}

		// We can easily get a list of unsatisfiable classes.  (A class is unsatisfiable if it
		// can't possibly have any instances).  Note that the getunsatisfiableClasses method
		// is really just a convenience method for obtaining the classes that are equivalent
		// to owl:Nothing.
		OWLClass nothing = graph.getDataFactory().getOWLNothing();
		Node<OWLClass> unsatisfiableClasses = reasoner.getUnsatisfiableClasses();
		if (unsatisfiableClasses.getSize() > 0) {
			for(OWLClass cls : unsatisfiableClasses.getEntities()) {
				logInfo("unsat: "+cls.getIRI());
				if (cls.equals(nothing)) {
					// nothing to see here, move along
					continue;
				}
				StringBuilder sb = new StringBuilder();
				sb.append("Unsatisfiable: ").append(graph.getIdentifier(cls));
				String lbl = graph.getLabel(cls);
				if (lbl != null) {
					sb.append(" '").append(lbl).append("'");
				}
				errors.add(sb.toString());
				unsatisfiable.add(cls);
			}
		}


		return new ConsistencyReport(errors, unsatisfiable);

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


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