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


Java OWLClassExpression.equals方法代码示例

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


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

示例1: loadPrimitiveDefinition

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
private OWLClassExpression loadPrimitiveDefinition(OWLClass cls) {
	Set<OWLClassExpression> allDefinitions = new HashSet<>();
	for (OWLOntology ontology : ontologies) {
		for (OWLSubClassOfAxiom definingAxiom : ontology.getSubClassAxiomsForSubClass(cls)) {
			OWLClassExpression superClass = definingAxiom.getSuperClass();
			if (!superClass.equals(top)) {
				// do not expand definitions beyond top
				allDefinitions.add(definingAxiom.getSuperClass());
			}
		}
	}
	if (allDefinitions.size() < 1) {
		return null;
	}
	if (allDefinitions.size() > 1) {
		return OWLManager.getOWLDataFactory().getOWLObjectIntersectionOf(allDefinitions);
	}
	return allDefinitions.iterator().next();
}
 
开发者ID:julianmendez,项目名称:uel,代码行数:20,代码来源:UelOntology.java

示例2: getExplicitOWLDisjointnessAxioms

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * OWLDisjointAxiom(A,B,C)
 * @param reasoner
 * @param ontology
 * @param cls
 * @return
 */
public static OWLClassNodeSet getExplicitOWLDisjointnessAxioms(OWLReasoner reasoner, OWLOntology ontology, OWLClass cls){
	
	OWLClassNodeSet nodeSet = new OWLClassNodeSet();
	
	for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) {                	
           for (OWLClassExpression op : ax.getClassExpressions()) {
               if (!op.isAnonymous() && !op.equals(cls)) { //Op must be differnt to ce
                   nodeSet.addNode(reasoner.getEquivalentClasses(op));
               }
           }
       }
	
	return nodeSet;
	
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:23,代码来源:DisjointnessAxiomExtractor.java

示例3: getExplicitDLDisjointnessAxioms

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * A ^ B -> bottom
 * @param reasoner
 * @param ontology
 * @param cls
 * @author Shuo Zhang
 * @return
 */
public static OWLClassNodeSet getExplicitDLDisjointnessAxioms(OWLReasoner reasoner, OWLOntology ontology, OWLClass cls){
	
	OWLClassNodeSet nodeSet = new OWLClassNodeSet();
	
	OWLClassExpression subExp;
   	Set<OWLClassExpression> set;
       for (OWLSubClassOfAxiom sax : ontology.getSubClassAxiomsForSuperClass(OWLManager.getOWLDataFactory().getOWLNothing())) {
       	subExp = sax.getSubClass();
       	if (subExp instanceof OWLObjectIntersectionOf) {
       		set = subExp.asConjunctSet();
       		if (set.contains(cls) && set.size() == 2) {
       			for (OWLClassExpression op : set) {
       				if (!op.equals(cls) && !op.isAnonymous()) {
       					nodeSet.addNode(reasoner.getEquivalentClasses(op));
       					break;
       				}
       			}
       		}
       	}
       } 
	
       return nodeSet;
       
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:33,代码来源:DisjointnessAxiomExtractor.java

示例4: isSubClassOf

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * Checks whether a class expression is a subclass of another class expression.
 * @param subClassExpr class expression on the left-hand side 
 * @param superClassExpr class expression on the right-hand side
 * @return <code>true</code> if the class expression on the left-hand side is a subclass of the class expression
 * on the right-hand side, <code>false</code> otherwise
 */
protected boolean isSubClassOf(OWLClassExpression subClassExpr, OWLClassExpression superClassExpr) {
	boolean ret = subClassExpr.isOWLNothing() || superClassExpr.isOWLThing() || subClassExpr.equals(superClassExpr);
	if (!ret) {
		OWLSubClassOfAxiom axiom = getReasoner().getRootOntology().
			getOWLOntologyManager().getOWLDataFactory().getOWLSubClassOfAxiom(subClassExpr, superClassExpr);
		if (!getReasoner().isEntailmentCheckingSupported(axiom.getAxiomType())){
			throw new RuntimeException("ERROR : Entailment not supported by reasoner '" + getReasoner().getReasonerName() + "'.");
		}
		ret = getReasoner().isEntailed(axiom);
	}
	return ret;
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:20,代码来源:IndividualContext.java

示例5: removeType

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * remove ClassAssertion(c,i) from the model
 * 
 * @param model
 * @param i
 * @param ce
 * @param metadata
 */
public void removeType(ModelContainer model, OWLIndividual i, 
		OWLClassExpression ce, METADATA metadata) {
	Set<OWLClassAssertionAxiom> allAxioms = model.getAboxOntology().getClassAssertionAxioms(i);
	// use search to remove also axioms with annotations
	for (OWLClassAssertionAxiom ax : allAxioms) {
		if (ce.equals(ax.getClassExpression())) {
			removeAxiom(model, ax, metadata);
		}
	}
	
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:20,代码来源:CoreMolecularModelManager.java

示例6: getChildren

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的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

示例7: makeUnionWithReduction

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
private OWLClassExpression makeUnionWithReduction(OWLClassExpression xa, OWLClassExpression xb) {
	if (xa.equals(xb))
		return xa;
	OWLClassExpression rx = makeUnionUsingReflexiveProperty(xa,xb);
		
	if (rx == null)
		rx = makeUnionUsingReflexiveProperty(xb,xa);
	if (rx == null) {
		rx = makeUnionBasic(xa,xb);
	}
	return rx;		
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:13,代码来源:DescriptionTreeSimilarity.java

示例8: makeUnionBasic

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * combines two class expressions to a UnionOf expression.
 * if both are identical, returns the expression.
 * does not attempt to reduce the union expression
 * 
 * @param xa
 * @param xb
 * @return class expression
 */
private OWLClassExpression makeUnionBasic(OWLClassExpression xa, OWLClassExpression xb) {
	if (xa.equals(xb)) {
		return xa;
	}
	else {
		Set<OWLClassExpression> args = new HashSet<OWLClassExpression>();
		args.add(xa);
		args.add(xb);
		return graph.getDataFactory().getOWLObjectUnionOf(args);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:21,代码来源:DescriptionTreeSimilarity.java

示例9: makeUnionUsingReflexiveProperty

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * makes a reduced union expression.
 * 
 * Uses the following two reduction rules:
 * 
 * (r1 some X) U (r2 some Y) ==> lcs(r1,r2) some MakeUnionOf(X,Y)
 * (r1 some X) U X ==> reflexive-version-of-r1 some X
 * 
 * TODO: test for (r some r some X) u (r some X) cases. needs to be done over final expression.
 *  
 * if a reduced form cannot be made, returns null
 * 
 * @param xa
 * @param xb
 * @return class expression
 */
private OWLClassExpression makeUnionUsingReflexiveProperty(OWLClassExpression xa, OWLClassExpression xb) {
	LOG.info("testing if there is a more compact union expression for "+xa+" ++ "+xb);
	OWLDataFactory df = graph.getDataFactory();
	if (xa instanceof OWLQuantifiedRestriction) {
		// TODO - check before casting
		OWLObjectProperty prop = (OWLObjectProperty) ((OWLQuantifiedRestriction) xa).getProperty();
		OWLClassExpression xaRest = (OWLClassExpression) ((OWLQuantifiedRestriction)xa).getFiller();
		if (xb instanceof OWLQuantifiedRestriction) {
			OWLObjectPropertyExpression p2 =
				propertySubsumer(prop, 
					((OWLQuantifiedObjectRestriction) xb).getProperty());
			
			if (p2 != null) {
				OWLClassExpression xbRest = (OWLClassExpression) ((OWLQuantifiedRestriction)xb).getFiller();
				OWLClassExpression x = makeUnionWithReduction(xaRest,xbRest);
				// todo - mixing some and all
				if (xa instanceof OWLObjectSomeValuesFrom)
					return df.getOWLObjectSomeValuesFrom(p2,x);
				else if (xa instanceof OWLObjectAllValuesFrom)
					return df.getOWLObjectAllValuesFrom(p2, x);
			}
		}
		LOG.info("  test: "+xaRest+" == "+xb);
		

		if (xaRest.equals(xb)) {
			LOG.info("     TRUE: "+xaRest+" == "+xb);

			OWLObjectProperty rprop = null;
			if (graph.getIsReflexive(prop)) {
				rprop = prop;
			}
			if (forceReflexivePropertyCreation) {
				OWLOntologyManager manager = graph.getManager();
				OWLOntology ont = graph.getSourceOntology();
				rprop = 
					df.getOWLObjectProperty(IRI.create(prop.getIRI().toString()+"_reflexive"));
				manager.applyChange(new AddAxiom(ont, df.getOWLSubObjectPropertyOfAxiom(prop, rprop)));
				manager.applyChange(new AddAxiom(ont, df.getOWLTransitiveObjectPropertyAxiom(rprop)));
				LOG.info("  reflexive prop:"+rprop);

			}
			if (rprop != null) {
				if (xa instanceof OWLObjectSomeValuesFrom)
					return df.getOWLObjectSomeValuesFrom(rprop,xb);
				else if (xa instanceof OWLObjectAllValuesFrom)
					return df.getOWLObjectAllValuesFrom(rprop, xb);
			}

		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:70,代码来源:DescriptionTreeSimilarity.java

示例10: getInferences

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
static Set<OWLAxiom> getInferences(OWLGraphWrapper graph, String reasonerName) throws OWLException {
	
	graph.mergeImportClosure();
	InferenceBuilder builder = new InferenceBuilder(graph, reasonerName);
	try {
		Set<OWLAxiom> inferredAxioms = new HashSet<OWLAxiom>();

		OWLOntology ontology = graph.getSourceOntology();
		OWLDataFactory dataFactory = ontology.getOWLOntologyManager().getOWLDataFactory();

		OWLReasoner reasoner = builder.getReasoner(ontology);
		for (OWLClass cls : ontology.getClassesInSignature()) {
			NodeSet<OWLClass> scs = reasoner.getSuperClasses(cls, true);
			for (Node<OWLClass> scSet : scs) {
				for (OWLClass sc : scSet) {
					if (sc.isOWLThing()) {
						continue; // do not report subclasses of owl:Thing
					}
					// we do not want to report inferred subclass links
					// if they are already asserted in the ontology
					boolean isAsserted = false;
					for (OWLClassExpression asc : OwlHelper.getSuperClasses(cls, ontology)) {
						if (asc.equals(sc)) {
							// we don't want to report this
							isAsserted = true;
						}
					}
					// include any inferred axiom that is NOT already asserted in the ontology
					if (!isAsserted) {						
						inferredAxioms.add(dataFactory.getOWLSubClassOfAxiom(cls, sc));
					}
				}
			}
		}
		return inferredAxioms;
	}
	finally {
		builder.dispose();
	}
	
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:ReasonerDiff.java

示例11: hasAssertedSubClassAxiom

import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
 * Check the ontology for an existing subClassOf axiom with the given sub- and superclass. 
 * This search ignores axiom annotations (i.e. is_inferred=true).
 * 
 * WARNING: Do not use {@link OWLOntology#containsAxiomIgnoreAnnotations(OWLAxiom)}
 * In the current OWL-API, this seems to be very very slow.
 * 
 * @param subClass
 * @param superClass
 * @param ontology
 * @return true, if there is an axiom for this subClass statement.
 */
protected boolean hasAssertedSubClassAxiom(OWLClass subClass, OWLClassExpression superClass, OWLOntology ontology) {
	Set<OWLSubClassOfAxiom> existing = ontology.getSubClassAxiomsForSubClass(subClass);
	if (existing != null) {
		for (OWLSubClassOfAxiom sca : existing) {
			if (superClass.equals(sca.getSuperClass())) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:InferenceBuilder.java


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