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


Java OWLObjectUnionOf类代码示例

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


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

示例1: createUnionExpression

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
public OWLObject createUnionExpression(OWLObject a, OWLObject b, OWLObject c) {
	Set<OWLGraphEdge> edgesA = graph.getEdgesBetween(a, c);
	Set<OWLGraphEdge> edgesB = graph.getEdgesBetween(b, c);
	if (edgesA.equals(edgesB)) {
		return edgeSetToExpression(edgesA);
	}
	else {
		OWLClassExpression xa = edgeSetToExpression(edgesA);
		OWLClassExpression xb = edgeSetToExpression(edgesA);
		HashSet<OWLClassExpression> xl = new HashSet<OWLClassExpression>();
		xl.add(xa);
		xl.add(xb);
		if (xl.size() == 1)
			return xl.iterator().next();
		OWLObjectUnionOf xu = graph.getDataFactory().getOWLObjectUnionOf(xl);
		return xu;
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:SimEngine.java

示例2: reverseOWLObjectUnionOfs

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的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.OWLObjectUnionOf; //导入依赖的package包/类
@Override
public HandlerResult visit(OWLObjectUnionOf unionOf) {
	Set<OWLClassExpression> newOperands = new HashSet<OWLClassExpression>();
	boolean changed = false;
	for (OWLClassExpression ce : unionOf.getOperands()) {
		HandlerResult handlerResult = ce.accept(this);
		if (handlerResult != null) {
			if (handlerResult.remove) {
				return HandlerResult.remove();
			}
			changed = true;
			newOperands.add(handlerResult.modified);
		}
		else {
			newOperands.add(ce);
		}
	}
	if (changed) {
		if (newOperands.size() == 1) {
			return HandlerResult.modified(newOperands.iterator().next());
		}
		return HandlerResult.modified(factory.getOWLObjectUnionOf(newOperands));
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:26,代码来源:CardinalityContraintsTools.java

示例4: cacheReverseUnionMap

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的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: handleUnionOf

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

示例6: getNextPossibleSymptom

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
public String getNextPossibleSymptom() {
    OWLClass disease = model.getClass("Disease");
    OWLObjectUnionOf allDiseases = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(disease));
    OWLObjectIntersectionOf intersectionOfSelected = getIntersectionOfSelected();
    OWLObjectUnionOf unionOfSubSelected = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(intersectionOfSelected));
    OWLObjectIntersectionOf possibleDiseasesIntersection = model.getDataFactory().getOWLObjectIntersectionOf(allDiseases, unionOfSubSelected);
    Set<OWLClass> possibleDiseases = model.getSubOfExpression(possibleDiseasesIntersection);
    possibleDiseases.addAll(model.getEquivalentOfExpression(possibleDiseasesIntersection));
    possibleDiseases.remove(model.getDataFactory().getOWLNothing());
    Set<OWLClass> possibleSymptoms = new TreeSet<OWLClass>();
    Iterator<OWLClass> possibleDiseasesIterator = possibleDiseases.iterator();
    while (possibleDiseasesIterator.hasNext()) {
        OWLClass next = possibleDiseasesIterator.next();
        possibleSymptoms.addAll(model.getSuperOfExpression(next));
    }
    possibleSymptoms.remove(model.getDataFactory().getOWLThing());
    possibleSymptoms.remove(model.getClass("Disease"));
    possibleSymptoms.removeAll(selectedSymptoms);
    possibleSymptoms.removeAll(notSelectedSymptoms);
    System.out.println(possibleDiseases);
    if(possibleSymptoms.size()!=0 && possibleDiseases.size()>1)
    return (new SimpleShortFormProvider().getShortForm((OWLClass)possibleSymptoms.toArray()[0])).substring(7);
    else
    return null;

}
 
开发者ID:UyumazHakan,项目名称:SemanticMedic,代码行数:27,代码来源:DiseaseQueryMaker.java

示例7: getPossibleDisease

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
public String getPossibleDisease(){
    OWLClass disease = model.getClass("Disease");
    OWLObjectUnionOf allDiseases = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(disease));
    OWLObjectIntersectionOf intersectionOfSelected = getIntersectionOfSelected();
    OWLObjectUnionOf unionOfSubSelected = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(intersectionOfSelected));
    OWLObjectIntersectionOf possibleDiseasesIntersection = model.getDataFactory().getOWLObjectIntersectionOf(allDiseases, unionOfSubSelected);
    Set<OWLClass> possibleDiseases = model.getSubOfExpression(possibleDiseasesIntersection);
    possibleDiseases.addAll(model.getEquivalentOfExpression(possibleDiseasesIntersection));
    possibleDiseases.remove(model.getDataFactory().getOWLNothing());
    String value="";
    if(possibleDiseases.size()!=0) {
        Iterator<OWLClass> it = possibleDiseases.iterator();
        while (it.hasNext()) {
            value+="\n"+new SimpleShortFormProvider().getShortForm(it.next());
        }
    }else
        value+="\nCould not found";
    return value;
}
 
开发者ID:UyumazHakan,项目名称:SemanticMedic,代码行数:20,代码来源:DiseaseQueryMaker.java

示例8: visit

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
public void visit(OWLObjectUnionOf union) {

			Set<OWLClassExpression> ops = union.getOperands();
			for (OWLClassExpression op : ops) {
				/*
				 * ArrayList<OWLClassExpression> l = new
				 * ArrayList<OWLClassExpression>(); new
				 * NormalizatorClassExpressionVisitor(op, l); list.addAll(l);
				 */
				try {
					list.addAll(getListOfConjunctions(op));
				} catch (UnusedClassExpressionException e) {
					errorCnt++;
				}
			}

		}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:18,代码来源:CEXOWL2ELProfile.java

示例9: addToOntology

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLClass c1 = featurePool.getExclusiveClass(":ObjectUnionOf_RL_Class1");
  OWLClass c2 = featurePool.getExclusiveClass(":ObjectUnionOf_RL_Class2");
  OWLClass c3 = featurePool.getExclusiveClass(":ObjectUnionOf_RL_Class3");
  OWLObjectUnionOf unionOf = factory.getOWLObjectUnionOf(c1, c2, c3);

  OWLClass unionClass = featurePool.getExclusiveClass(":ObjectUnionOf_RL");

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(unionOf, unionClass));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlObjectUnionOfOwl2RlFeature.java

示例10: addToOntology

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLClass c1 = featurePool.getExclusiveClass(":ObjectUnionOf_Class1");
  OWLClass c2 = featurePool.getExclusiveClass(":ObjectUnionOf_Class2");
  OWLClass c3 = featurePool.getExclusiveClass(":ObjectUnionOf_Class3");
  OWLObjectUnionOf unionOf = factory.getOWLObjectUnionOf(c1, c2, c3);

  OWLClass unionClass = featurePool.getExclusiveClass(":ObjectUnionOf");

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(unionClass, unionOf));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlObjectUnionOfFeature.java

示例11: getConceptForOwlClassExpression

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
/**
 * Load owl class.
 *
 * @param expr the owl class
 * @param ontology the ontology
 * @param level the level
 * @return the concept
 * @throws Exception the exception
 */
private Concept getConceptForOwlClassExpression(OWLClassExpression expr,
  OWLOntology ontology, int level) throws Exception {

  // Log it
  if (expr instanceof OWLClass) {
    OwlUtility.logOwlClass((OWLClass) expr, ontology, level);
  } else {
    OwlUtility.logOwlClassExpression(expr, ontology, level);
  }

  // Handle direct OWLClass
  if (expr instanceof OWLClass) {
    return getConceptForOwlClass((OWLClass) expr, ontology, level);
  }

  // Handle ObjectIntersectionOf
  else if (expr instanceof OWLObjectIntersectionOf) {
    return getConceptForIntersectionOf((OWLObjectIntersectionOf) expr,
        ontology, level);
  }

  // Handle ObjectUnionOf
  else if (expr instanceof OWLObjectUnionOf) {
    return getConceptForUnionOf((OWLObjectUnionOf) expr, ontology, level);
  }

  // Handle ObjectSomeValuesFrom
  else if (expr instanceof OWLObjectSomeValuesFrom) {
    return getConceptForSomeValuesFrom((OWLObjectSomeValuesFrom) expr,
        ontology, level);

  }

  else {
    throw new Exception("Unexpected class expression type - "
        + expr.getClassExpressionType());
  }

}
 
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:49,代码来源:OwlLoaderAlgorithm.java

示例12: visit

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
public OWLClassExpression visit(OWLObjectUnionOf d) {
    Set<OWLClassExpression> newDisjuncts=new HashSet<OWLClassExpression>();
    for (OWLClassExpression description : d.getOperands()) {
        OWLClassExpression descriptionNNF=getNNF(description);
        newDisjuncts.add(descriptionNNF);
    }
    return m_factory.getOWLObjectUnionOf(newDisjuncts);
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:9,代码来源:ExpressionManager.java

示例13: visit

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
@Override
public OWLObjectUnionOf visit(OWLObjectUnionOf ce) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Unfolding union_of: "+ce);
	}
	
	Set<OWLClassExpression> operands = ce.getOperands();
	if (operands != null && !operands.isEmpty()) {
		Set<OWLClassExpression> unfolded = unfoldExpressions(operands);
		if (unfolded != null) {
			return factory.getOWLObjectUnionOf(unfolded);
		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:16,代码来源:TBoxUnFoldingTool.java

示例14: removeOWLObjectUnionOfs

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
/**
 * Remove any {@code OWLEquivalentClassesAxiom} containing an {@code OWLObjectUnionOf} 
 * as class expression, and any {@code OWLSubClassOfAxiom} whose superclass is an 
 * {@code OWLObjectUnionOf}.
 * 
 * @see #performDefaultModifications()
 * @see #reverseOWLObjectUnionOfs()
 */
private void removeOWLObjectUnionOfs() {
    log.info("Removing OWLEquivalentClassesAxiom or OWLSubClassOfAxiom containig OWLObjectUnionOf...");
    
    for (OWLOntology ont : this.getOwlGraphWrapper().getAllOntologies()) {
        for (OWLAxiom ax: ont.getAxioms()) {
            boolean toRemove = false;
            if (ax instanceof OWLSubClassOfAxiom) {
                if (((OWLSubClassOfAxiom) ax).getSuperClass() instanceof  OWLObjectUnionOf) {
                    toRemove = true;
                }
            } else if (ax instanceof OWLEquivalentClassesAxiom) {
                for (OWLClassExpression ce : 
                    ((OWLEquivalentClassesAxiom) ax).getClassExpressions()) {
                    if (ce instanceof  OWLObjectUnionOf) {
                        toRemove = true;
                        break;
                    }
                }
            }
            if (toRemove) {
                ont.getOWLOntologyManager().removeAxiom(ont, ax);
            }
        }
    }

    this.triggerWrapperUpdate();
    log.info("Done removing OWLObjectUnionOfs");
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:37,代码来源:OWLGraphManipulator.java

示例15: visit

import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入依赖的package包/类
public void visit(OWLObjectUnionOf arg0) {
	boolean isFirst=true;
	for (OWLClassExpression operand : arg0.getOperands()) {
		if (!isFirst)
			writer.write(" or ");
		operand.accept(this);
		isFirst=false;
	}
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:10,代码来源:NiceAxiomPrinter.java


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