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


Java OWLEquivalentClassesAxiom.getClassExpressions方法代码示例

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


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

示例1: buildSimpleDefMap

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
private void buildSimpleDefMap() {
	simpleDefMap = new HashMap<OWLClass,Set<OWLClassExpression>>();
	OWLOntology o = getGraph().getSourceOntology();
	for (OWLClass c : o.getClassesInSignature()) {
		for (OWLEquivalentClassesAxiom eca : o.getEquivalentClassesAxioms(c)) {
			Set<OWLClassExpression> elts = new HashSet<OWLClassExpression>();
			for (OWLClassExpression x : eca.getClassExpressions()) {
				// assume one logical definitionper class - otherwise choose arbitrary
				if (x instanceof OWLObjectIntersectionOf) {
					if (getReachableOWLClasses(x, elts) && elts.size() > 0) {
						//LOG.info(c+" def= "+elts);
						simpleDefMap.put(c, elts);						
					}
				}
			}
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:CompositionalClassPredictor.java

示例2: reverseOWLObjectUnionOfs

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
/**
 * Reverse all {@code OWLObjectUnionOf}s, that are operands in 
 * an {@code OWLEquivalentClassesAxiom}, into individual {@code OWLSubClassOfAxiom}s, where 
 * the classes part of the {@code OWLObjectUnionOf} become subclasses, and 
 * the original first operand of the {@code OWLEquivalentClassesAxiom} superclass. 
 * <p>
 * Note that such {@code OWLEquivalentClassesAxiom}s are not removed from the ontology, 
 * only {@code OWLSubClassOfAxiom}s are added. The axioms containing 
 * {@code OWLObjectUnionOf}s will be removed by calling {@link #removeOWLObjectUnionOfs()}, 
 * in order to give a chance to {@link #convertEquivalentClassesToSuperClasses()} 
 * to do its job before.
 * 
 * @see #performDefaultModifications()
 * @see #removeOWLObjectUnionOfs()
 * @see #convertEquivalentClassesToSuperClasses()
 */
private void reverseOWLObjectUnionOfs() {
    log.info("Reversing OWLObjectUnionOfs into OWLSubClassOfAxioms");
    for (OWLOntology ont : this.getOwlGraphWrapper().getAllOntologies()) {
        for (OWLClass cls : ont.getClassesInSignature()) {
            for (OWLEquivalentClassesAxiom eca : ont.getEquivalentClassesAxioms(cls)) {
                for (OWLClassExpression ce : eca.getClassExpressions()) {
                    if (ce instanceof OWLObjectUnionOf) {
                        for (OWLObject child : ((OWLObjectUnionOf)ce).getOperands()) {
                            //we reverse only named classes
                            if (child instanceof OWLClass) {
                                this.getOwlGraphWrapper().getManager().addAxiom(ont, 
                                        ont.getOWLOntologyManager().getOWLDataFactory().
                                            getOWLSubClassOfAxiom((OWLClass) child, cls));
                            }
                        }
                    }
                }
            }
        }
    }
    this.triggerWrapperUpdate();
    log.info("OWLObjectUnionOf reversion done.");
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:40,代码来源:OWLGraphManipulator.java

示例3: visit

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
@Override
public void visit(OWLEquivalentClassesAxiom axiom) {
	Set<OWLClassExpression> newExpressions = new HashSet<OWLClassExpression>();
	boolean changed = false;
	for (OWLClassExpression ce : axiom.getClassExpressions()) {
		HandlerResult result = ce.accept(handler);
		if (result != null) {
			if (result.remove) {
				// skip handling and immediately remove and return
				remove(ontology, axiom);
				return;
			}
			changed = true;
			newExpressions.add(result.modified);
		}
		else {
			newExpressions.add(ce);
		}
	}
	if (changed) {
		remove(ontology, axiom);
		OWLEquivalentClassesAxiom newAxiom = factory.getOWLEquivalentClassesAxiom(newExpressions, axiom.getAnnotations());
		add(ontology, newAxiom);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:26,代码来源:CardinalityContraintsTools.java

示例4: cacheReverseUnionMap

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
private void cacheReverseUnionMap() {
	synchronized (edgeCacheMutex) {
	    extraSubClassOfEdges = new HashMap<OWLObject, Set<OWLGraphEdge>>();
           if (!config.isGraphReasonedAndRelaxed) {
	        for (OWLOntology o : getAllOntologies()) {
	            for (OWLClass cls : o.getClassesInSignature()) {
	                for (OWLEquivalentClassesAxiom eca : o.getEquivalentClassesAxioms(cls)) {
	                    for (OWLClassExpression ce : eca.getClassExpressions()) {
	                        if (ce instanceof OWLObjectUnionOf) {
	                            for (OWLObject child : ((OWLObjectUnionOf)ce).getOperands()) {
	                                if (!extraSubClassOfEdges.containsKey(child)) {
	                                    extraSubClassOfEdges.put(child, new OWLGraphEdgeSet());
	                                }
	                                extraSubClassOfEdges.get(child).add(
	                                        createSubClassOfEdge(child,cls,o,eca));
	                            }
	                        }
	                    }
	                }
	            }
	        }
	    }
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:OWLGraphWrapperEdges.java

示例5: getChildren

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
public Collection<OWLClass> getChildren(OWLClass parent) {
    Collection<OWLClass> result = new HashSet<OWLClass>();
    for (OWLOntology ont : getRootOntology().getImportsClosure()) {
        for (OWLAxiom ax : ont.getReferencingAxioms(parent)) {
            if (ax instanceof OWLSubClassOfAxiom) {
                OWLSubClassOfAxiom sca = (OWLSubClassOfAxiom) ax;
                if (!sca.getSubClass().isAnonymous()) {
                    Set<OWLClassExpression> conjuncts = sca.getSuperClass().asConjunctSet();
                    if (conjuncts.contains(parent)) {
                        result.add(sca.getSubClass().asOWLClass());
                    }
                }
            }
            else if (ax instanceof OWLEquivalentClassesAxiom) {
                OWLEquivalentClassesAxiom eca = (OWLEquivalentClassesAxiom) ax;
                for (OWLClassExpression ce : eca.getClassExpressions()) {
                    if (ce.containsConjunct(parent)) {
                        for (OWLClassExpression sub : eca.getClassExpressions()) {
                            if (!sub.isAnonymous() && !sub.equals(ce)) {
                                result.add(sub.asOWLClass());
                            }
                        }
                    }
                }
            }
        }
    }
    return result;
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:30,代码来源:StructuralReasoner2.java

示例6: tr

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
public OWLAxiom tr(OWLEquivalentClassesAxiom ax) {
	Set<OWLClassExpression> xs = new HashSet<OWLClassExpression>();
	for (OWLClassExpression x : ax.getClassExpressions()) {
		OWLClassExpression tx = trx(x, true);
		if (tx == null)
			return null;
		xs.add(tx);
	}
	return fac.getOWLEquivalentClassesAxiom(xs);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:11,代码来源:SpeciesMergeUtil.java

示例7: tr

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
public Set<OWLOntologyChange> tr(OWLAxiom inAxiom, Mapping m) {
	Set<OWLOntologyChange> chgs = new HashSet<OWLOntologyChange>();
	boolean isModified = false;
	OWLAxiom newAxiom = null;
	if (inAxiom instanceof OWLEquivalentClassesAxiom) {
		OWLEquivalentClassesAxiom aa = (OWLEquivalentClassesAxiom)inAxiom;
		Set<OWLClassExpression> xs = new HashSet<OWLClassExpression>();
		for (OWLClassExpression x : aa.getClassExpressions()) {
			OWLClassExpression x2 = replace(x, m);
			if (x2 == null) {
				xs.add(x);
			}
			else {
				isModified = true;
				xs.add(x2);
				LOG.info("  TR : "+x+ " ---> "+x2);
			}
		}
		if (isModified) {
			newAxiom = getOWLDataFactory().getOWLEquivalentClassesAxiom(xs);
		}
	}
	if (isModified) {
		if (m.isReplace) {
			chgs.add(new RemoveAxiom(ontology, inAxiom));
		}
		chgs.add(new AddAxiom(ontology, newAxiom));
	}
	return chgs;
	
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:32,代码来源:TemplatedTransformer.java

示例8: check

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
@Override
public Collection<CheckWarning> check(OWLGraphWrapper graph, Collection<OWLObject> allOwlObjects) {
	OWLOntology ontology = graph.getSourceOntology();
	List<CheckWarning> violations = new ArrayList<CheckWarning>();
	for(OWLClass cls : ontology.getClassesInSignature()) {
		Set<OWLEquivalentClassesAxiom> equivalentClassesAxioms = ontology.getEquivalentClassesAxioms(cls);
		if (equivalentClassesAxioms != null && !equivalentClassesAxioms.isEmpty()) {
			for (OWLEquivalentClassesAxiom owlEquivalentClassesAxiom : equivalentClassesAxioms) {
				for (OWLClassExpression ex : owlEquivalentClassesAxiom.getClassExpressions()) {
					if (ex instanceof OWLClass)
						continue;
					Set<OWLClass> classesInSignature = ex.getClassesInSignature();
					if (classesInSignature != null && classesInSignature.contains(cls)) {
						String id = graph.getIdentifier(cls);
						String message = "Class "+id+" has a self reference in its logical definition: "+owlEquivalentClassesAxiom;
						CheckWarning warning = new CheckWarning("Self_Reference_In_Definition", message , isFatal(), cls.getIRI());
						violations.add(warning);
					}
				}
			}
		}
	}
	if (!violations.isEmpty()) {
		return violations;
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:28,代码来源:SelfReferenceInDefinition.java

示例9: visit

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
@Override
public Set<ComplexIntegerAxiom> visit(OWLEquivalentClassesAxiom axiom) throws TranslationException {
	Objects.requireNonNull(axiom);
	Set<OWLClassExpression> classExpressionSet = axiom.getClassExpressions();
	Set<IntegerClassExpression> classIdSet = new HashSet<>();
	classExpressionSet.forEach(classExpression -> classIdSet.add(translateClassExpression(classExpression)));
	ComplexIntegerAxiom ret = getAxiomFactory().createEquivalentClassesAxiom(classIdSet,
			translateAnnotations(axiom.getAnnotations()));
	return Collections.singleton(ret);
}
 
开发者ID:julianmendez,项目名称:jcel,代码行数:11,代码来源:AxiomTranslator.java

示例10: visit

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
@Override
public OWLAxiom visit(OWLEquivalentClassesAxiom axiom) {
    Set<OWLClassExpression> ops = new HashSet<>();
    for (OWLClassExpression op : axiom.getClassExpressions()) {
        ops.add(op.accept(this));
    }
    return dataFactory.getOWLEquivalentClassesAxiom(ops);
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:9,代码来源:NNF.java

示例11: visit

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
@Override
public Set<OWLClassExpression> visit(OWLEquivalentClassesAxiom axiom) {
    Set<OWLClassExpression> result = new HashSet<>();
    for (OWLClassExpression ce : axiom.getClassExpressions()) {
        result.addAll(ce.accept(this));
    }
    return result;
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:9,代码来源:OWLClassExpressionCollector.java

示例12: visit

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
@Override
public void visit(@Nonnull OWLEquivalentClassesAxiom axiom) {
    for (OWLClassExpression desc : axiom.getClassExpressions()) {
        desc.accept(this);
    }
    processAxiomAnnotations(axiom);
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:8,代码来源:AbstractEntityRegistrationManager.java

示例13: visit

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
public void visit(OWLEquivalentClassesAxiom axiom) {
	java.util.Set<OWLClassExpression> descrs = axiom.getClassExpressions();
	OWLClass left = null;
	OWLClassExpression right = null;
	if (descrs.size() != 2) {
		// LOG.log(Level.SEVERE, "Unsupported equAxiom - not 2 sides");
		unusedAxiom(axiom);
		return;
	}
	for (OWLClassExpression d : descrs) {
		if ((d instanceof OWLClass) && (left == null)) {
			left = (OWLClass) d;
		} else {
			right = d;
		}
	}
	if (left == null) {
		// LOG.log(Level.SEVERE,
		// "Unsupported equAxiom - at least one side has to be class");
		unusedAxiom(axiom);
		return;
	}
	List<OWLClassExpression> list;
	try {
		list = getListOfConjunctions(right);
		// TODO does it make sense to break down equivalence axiom like this ???
		// Probably not:
		if (list.size() != 1) {
			// LOG.severe("Unsupported equAxiom - union of some things");
			unusedAxiom(axiom);
		}
	} catch (UnusedClassExpressionException e) {
		unusedAxiom(axiom);
	}
}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:36,代码来源:CEXOWL2ELProfile.java

示例14: makeDevelopmentMorphologyLinks

import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; //导入方法依赖的package包/类
/**
 * In MP we have
 *  + abn. tooth. morphology
 *    + abn. tooth. dev.
 *  
 *  Transform:
 *  
 *  'X devel' (P) = _ and R some U ==> add:
 *    quality and inh some P SubClassOf morphology and inh some E
 *  
 */
protected void makeDevelopmentMorphologyLinks() {
	// TODO - use OPPL for this
	/*
	String oppl =
		"SELECT ?P EquivalentTo "+RESULTS_IN_MORPHOGENESIS_OF+" SOME ?U "+
		"BEGIN ADD ('inheres in' some ?P) SubClassOf (morphology and 'inheres in' some ?U)";
	 */
	LOG.info("making dev-morph links");
	OWLObjectProperty rimo = this.getOWLObjectPropertyViaOBOSuffix(RESULTS_IN_MORPHOGENESIS_OF);
	OWLObjectProperty rido = this.getOWLObjectPropertyViaOBOSuffix(RESULTS_IN_DEVELOPMENT_OF);
	OWLObjectProperty inheresIn = this.getOWLObjectPropertyViaOBOSuffix(INHERES_IN);
	OWLClass morphologyCls = this.getOWLClassViaOBOSuffix("PATO_0000051");
	Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
	for (OWLEquivalentClassesAxiom eca : outputOntology.getAxioms(AxiomType.EQUIVALENT_CLASSES)) {
		Set<OWLObjectProperty> opSig = eca.getObjectPropertiesInSignature();
		if (opSig.contains(rimo) || opSig.contains(rido)) {
			LOG.info("   ECA:"+eca);
			OWLClass goProcCls = null;
			OWLClassExpression goProcExpr = null;
			for (OWLClassExpression x : eca.getClassExpressions()) {
				if (x.isAnonymous()) {
					goProcExpr = x;
				}
				else {
					goProcCls = (OWLClass) x;
				}
			}
			if (goProcCls != null && goProcExpr != null) {
				if (goProcExpr instanceof OWLObjectIntersectionOf) {
					for (OWLClassExpression d : ((OWLObjectIntersectionOf)goProcExpr).getOperands() ) {
						if (d instanceof OWLObjectSomeValuesFrom) {
							OWLClassExpression anatCls = ((OWLObjectSomeValuesFrom)d).getFiller();
							OWLObjectSomeValuesFrom lhs = getOWLDataFactory().getOWLObjectSomeValuesFrom(inheresIn, goProcCls);
							OWLObjectSomeValuesFrom inhExpr = getOWLDataFactory().getOWLObjectSomeValuesFrom(inheresIn, anatCls);
							OWLObjectIntersectionOf rhs = getOWLDataFactory().getOWLObjectIntersectionOf(morphologyCls, inhExpr);
							newAxioms.add(getOWLDataFactory().getOWLSubClassOfAxiom(lhs,rhs));
						}
					}
				}
			}
		}
	}
	addAxiomsToOutput(newAxioms, false);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:56,代码来源:PhenoSimHQEPreProcessor.java


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