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


Java OWLObjectIntersectionOf.getOperandsAsList方法代码示例

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


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

示例1: handleIntersection

import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入方法依赖的package包/类
private void handleIntersection(List<CheckWarning> warnings, Set<OWLOntology> allOntologies,
		OWLEquivalentClassesAxiom axiom, OWLObjectIntersectionOf intersection, OWLPrettyPrinter pp) 
{
	for(OWLClassExpression operand : intersection.getOperandsAsList()) {
		OWLClass operandCls = null;
		if (!operand.isAnonymous()) {
			operandCls = operand.asOWLClass();
		}
		else if (operand instanceof OWLObjectSomeValuesFrom) {
			OWLObjectSomeValuesFrom ristriction = (OWLObjectSomeValuesFrom) operand;
			OWLClassExpression filler = ristriction.getFiller();
			if (!filler.isAnonymous()) {
				operandCls = filler.asOWLClass();
			}
		}
		else {
			// not translatable to OBO
			handleGeneric(warnings, allOntologies, axiom, operand, pp);
		}
		if (operandCls != null && isDangling(operandCls, allOntologies)) {
			final IRI iri = operandCls.getIRI();
			String message = "Dangling reference "+iri+" in INTERSECTION_OF axiom: "+pp.render(axiom);
			warnings.add(new CheckWarning(getID(), message , isFatal(), iri, OboFormatTag.TAG_INTERSECTION_OF.getTag()));
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:DanglingReferenceCheck.java

示例2: formatClassExpression

import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入方法依赖的package包/类
public static String formatClassExpression(OWLClassExpression ce,
        OWLOntology ont) {
    if (ce instanceof OWLClass) {
        return getLabel(ce.asOWLClass(), ont);
    } else if (ce instanceof OWLObjectIntersectionOf) {
        OWLObjectIntersectionOf oi = (OWLObjectIntersectionOf) ce;
        List<OWLClassExpression> ops = oi.getOperandsAsList();
        StringBuilder sb = new StringBuilder();
        sb.append(formatClassExpression(ops.get(0), ont));
        for (int i = 1; i < ops.size(); i++) {
            sb.append(" \u2229 ");
            sb.append(formatClassExpression(ops.get(i), ont));
        }
        return sb.toString();
    } else if (ce instanceof OWLObjectSomeValuesFrom) {
        OWLObjectSomeValuesFrom osv = (OWLObjectSomeValuesFrom) ce;
        OWLObjectPropertyExpression ope = osv.getProperty();
        String role = (!ope.isAnonymous()) ? getLabel(
                ope.asOWLObjectProperty(), ont) : ope.toString();
        return "\u2203" + role + ".("
                + formatClassExpression(osv.getFiller(), ont) + ")";
    } else {
        return ce.toString();
    }
}
 
开发者ID:aehrc,项目名称:snorocket,代码行数:26,代码来源:DebugUtils.java

示例3: visit

import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; //导入方法依赖的package包/类
@Override
public OWLClassExpression visit(OWLObjectIntersectionOf ce) {
	List<OWLClassExpression> operands = ce.getOperandsAsList();
	//replace operands by the short form
	for (int i = 0; i < operands.size(); i++) {
		operands.set(i, operands.get(i).accept(this));
	}
	
	Set<OWLClassExpression> newOperands = new HashSet<>(operands);
	
	if(newOperands.size() == 1){
		return newOperands.iterator().next().accept(this);
	}
	
	for (int i = 0; i < operands.size(); i++) {
		OWLClassExpression op1 = operands.get(i);
		for (int j = i + 1; j < operands.size(); j++) {
			OWLClassExpression op2 = operands.get(j);
			
			//remove operand if it is a super class
			if(isSubClassOf(op1, op2)){
				newOperands.remove(op2);
			} else if(isSubClassOf(op2, op1)){
				newOperands.remove(op1);
			}
		}
	}
	
	if(newOperands.size() == 1){
		return newOperands.iterator().next().accept(this);
	}
	
	return df.getOWLObjectIntersectionOf(newOperands);
}
 
开发者ID:SmartDataAnalytics,项目名称:OWL2SPARQL,代码行数:35,代码来源:OWLClassExpressionMinimizer.java


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