本文整理汇总了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
}
}
示例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);
}
}
}
}
}
示例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");
}
示例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;
}
}
}
示例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);
}
}
}
示例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));
}
示例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();
}
示例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);
}