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


Java OWLSubClassOfAxiom类代码示例

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


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

示例1: loadPrimitiveDefinition

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

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
private void addNewDissubsumptions() {
	OWLOntology negOntology = view.getSelectedOntologyNeg();
	if (negOntology.equals(UelModel.EMPTY_ONTOLOGY)) {
		negOntology = model.createOntology();
		updateView();
		view.setSelectedOntologyNeg(negOntology);
	}

	Set<OWLAxiom> newAxioms = refineController.getDissubsumptions();

	for (OWLAxiom axiom : newAxioms) {
		if (!(axiom instanceof OWLSubClassOfAxiom)) {
			throw new IllegalStateException("Expected new dissubsumptions to be encoded as OWLSubClassOfAxioms.");
		}
		if (negOntology.containsAxiom(axiom)) {
			throw new IllegalStateException("The negative goal already contains the following axiom: " + axiom);
		}
		negOntology.getOWLOntologyManager().addAxiom(negOntology, axiom);
	}
	undoStack.push(newAxioms);
}
 
开发者ID:julianmendez,项目名称:uel,代码行数:22,代码来源:UelController.java

示例3: getNamedDirectSuperClasses

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
private Set<OWLClass> getNamedDirectSuperClasses(OWLClass current, OWLOntology model) {
	final Set<OWLClass> dedup = new HashSet<OWLClass>();
	Set<OWLOntology> closure = model.getImportsClosure();
	for (OWLOntology ont : closure) {
		for(OWLSubClassOfAxiom ax : ont.getSubClassAxiomsForSubClass(current)) {
			ax.getSuperClass().accept(new OWLClassExpressionVisitorAdapter(){

				@Override
				public void visit(OWLClass cls) {
					if (cls.isBuiltIn() == false) {
						dedup.add(cls);
					}
				}
			});
		}
	}
	return dedup;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:19,代码来源:FindGoCodes.java

示例4: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
@Override
public void visit(OWLClass desc) {
  if (!processedClasses.contains(desc)) {
    // If we are processing inherited restrictions then we
    // recursively visit named supers. Note that we need to keep
    // track of the classes that we have processed so that we don't
    // get caught out by cycles in the taxonomy
    processedClasses.add(desc);
    for (final OWLOntology ontology : ontologies) {
      for (final OWLSubClassOfAxiom ax : ontology
          .getSubClassAxiomsForSubClass(desc)) {
        ax.getSuperClass().accept(this);
      }
    }
  }
}
 
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:17,代码来源:RestrictionVisitor.java

示例5: getExplicitDLDisjointnessAxioms

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

示例6: materializeClassExpressionsReferencedBy

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
public Set<OWLClass> materializeClassExpressionsReferencedBy(OWLObjectProperty p) {
	Set<OWLClassExpression> xs = new HashSet<OWLClassExpression>();
	for (OWLAxiom ax : outputOntology.getReferencingAxioms(p, Imports.INCLUDED)) {
		if (ax instanceof OWLSubClassOfAxiom) {
			xs.addAll(getClassExpressionReferencedBy(p, ((OWLSubClassOfAxiom)ax).getSuperClass()));
		}
		else if (ax instanceof OWLClassAssertionAxiom) {
			xs.addAll(getClassExpressionReferencedBy(p, ((OWLClassAssertionAxiom)ax).getClassExpression()));
		}
		else if (ax instanceof OWLEquivalentClassesAxiom) {
			for (OWLClassExpression x : ((OWLEquivalentClassesAxiom)ax).getClassExpressions()) {
				xs.addAll(getClassExpressionReferencedBy(p,x));
			}
		}
	}
	return materializeClassExpressions(xs);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:AbstractSimPreProcessor.java

示例7: isEdgeEntailed

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
public boolean isEdgeEntailed(OWLEdge e, OWLOntology currentOntology, OWLReasoner reasoner) {
	OWLOntologyManager m = getManager();

	Set<OWLSubClassOfAxiom> scas = currentOntology.getSubClassAxiomsForSubClass(e.c);
	Set<OWLSubClassOfAxiom> rmAxioms = new HashSet<OWLSubClassOfAxiom>();
	for (OWLSubClassOfAxiom sca : scas) {
		if (sca.getSuperClass().equals(e.p)) {
			LOG.info("REMOVING: "+sca);
			rmAxioms.add(sca);
		}
	}
	boolean isEdgeAsserted = rmAxioms.size() > 0;
	if (isEdgeAsserted) {
		m.removeAxioms(currentOntology, rmAxioms);
		reasoner.flush();
	}
	boolean isEntailed;
	isEntailed = reasoner.getSuperClasses(e.c, false).containsEntity(e.p);
	if (isEdgeAsserted) {
		m.addAxioms(currentOntology, rmAxioms);
		reasoner.flush();
	}

	return isEntailed;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:26,代码来源:ProvenanceReasonerWrapper.java

示例8: removeRedundantSubClassAxioms

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
/**
 * Remove the redundant and marked as inferred super class assertions for
 * each class in the ontology signature. Uses the reasoner to infer the
 * direct super classes.
 * 
 * @param ontology
 * @param reasoner
 * @return map of class to set of redundant axioms
 */
public static Map<OWLClass, Set<RedundantAxiom>> removeRedundantSubClassAxioms(OWLOntology ontology, OWLReasoner reasoner) {
	Iterable<OWLClass> classes = ontology.getClassesInSignature();
	Map<OWLClass, Set<RedundantAxiom>> axioms = findRedundantSubClassAxioms(classes, ontology, reasoner);
	if (!axioms.isEmpty()) {
		Set<OWLSubClassOfAxiom> allAxioms = new THashSet<OWLSubClassOfAxiom>();
		for(OWLClass cls : axioms.keySet()) {
			for(RedundantAxiom redundantAxiom : axioms.get(cls)) {
				allAxioms.add(redundantAxiom.getAxiom());
			}
		}
		OWLOntologyManager manager = ontology.getOWLOntologyManager();
		manager.removeAxioms(ontology, allAxioms);
		LOG.info("Removed "+axioms.size()+" redundant axioms.");
	}
	return axioms;
	
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:RedundantInferences.java

示例9: hasLinks

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
/**
 * Check that the given subClass does not already has a matching subClass axiom.
 * 
 * @param subCls
 * @param p
 * @param superCls
 * @return existing axiom or null
 */
private OWLAxiom hasLinks(OWLClass subCls, OWLObjectProperty p, OWLClass superCls) {
	for(OWLOntology o : allOntologies) {
		Set<OWLSubClassOfAxiom> subClsAxioms = o.getSubClassAxiomsForSubClass(subCls);
		for (OWLSubClassOfAxiom subClsAxiom : subClsAxioms) {
			OWLClassExpression ce = subClsAxiom.getSuperClass();
			if (ce instanceof OWLObjectSomeValuesFrom) {
				OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) ce;
				OWLObjectPropertyExpression property = someValuesFrom.getProperty();
				if (p.equals(property)) {
					OWLClassExpression filler = someValuesFrom.getFiller();
					if (superCls.equals(filler)) {
						return subClsAxiom;
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:28,代码来源:LinkMaker.java

示例10: getMappings

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
public Set<Mapping> getMappings() {
	Set<Mapping> ms = new HashSet<Mapping>();
	OWLAnnotationProperty vap = getVariableAnnotationProperty();
	for (OWLSubClassOfAxiom sca : ontology.getAxioms(AxiomType.SUBCLASS_OF, Imports.INCLUDED)) {
		Mapping m = new Mapping();
		Set<OWLAnnotation> anns = sca.getAnnotations(vap);
		for (OWLAnnotation ann : anns) {
			IRI v = (IRI) ann.getValue();
			m.vars.add(v);
		}
		if (m.vars.size() > 0) {
			m.src = sca.getSubClass();
			m.tgt = sca.getSuperClass();
			ms.add(m);
			LOG.info("MAPPING: "+m);
		}
	}
	return ms;
	
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:21,代码来源:TemplatedTransformer.java

示例11: getSvfClasses

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
Set<OWLClass> getSvfClasses(OWLClass c, OWLObjectProperty p) {
	Set<OWLSubClassOfAxiom> axioms = new HashSet<OWLSubClassOfAxiom>();
	for(OWLOntology ont : getAllOntologies()) {
		axioms.addAll(ont.getSubClassAxiomsForSubClass(c));
	}
	Set<OWLClass> superClasses = new HashSet<OWLClass>();
	for (OWLSubClassOfAxiom axiom : axioms) {
		OWLClassExpression expr = axiom.getSuperClass();
		if (expr instanceof OWLObjectSomeValuesFrom) {
			OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) expr;
			if (p.equals(svf.getProperty())) {
				OWLClassExpression filler = svf.getFiller();
				if (filler instanceof OWLClass) {
					superClasses.add((OWLClass) filler);
				}
			}
		}
	}
	return superClasses;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:21,代码来源:OWLGraphWrapperEdgesAdvanced.java

示例12: initNeighborAxioms

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
private Map<OWLClass, Set<OWLSubClassOfAxiom>> initNeighborAxioms() {
	Map<OWLClass, Set<OWLSubClassOfAxiom>> result = new HashMap<OWLClass, Set<OWLSubClassOfAxiom>>();
	for(OWLOntology ont : getAllOntologies()) {
		for(OWLSubClassOfAxiom ax : ont.getAxioms(AxiomType.SUBCLASS_OF)) {
			Set<OWLClass> inSignature = ax.getClassesInSignature();
			for (OWLClass cls : inSignature) {
				Set<OWLSubClassOfAxiom> neighbors = result.get(cls);
				if (neighbors == null) {
					neighbors = new HashSet<OWLSubClassOfAxiom>();
					result.put(cls, neighbors);
				}
				neighbors.add(ax);
			}
		}
	}
	
	return result;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:OWLGraphWrapperEdgesAdvanced.java

示例13: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
@Override
public void visit(OWLSubClassOfAxiom axiom) {
	OWLClassExpression subClass = axiom.getSubClass();
	OWLClassExpression superClass = axiom.getSuperClass();
	HandlerResult modifiedSubClass = subClass.accept(handler);
	HandlerResult modifiedSuperClass = superClass.accept(handler);
	if (modifiedSubClass != null || modifiedSuperClass != null) {
		if (modifiedSubClass != null) {
			if (modifiedSubClass.remove) {
				remove(ontology, axiom);
				return;
			}
			subClass = modifiedSubClass.modified;
		}
		if (modifiedSuperClass != null) {
			if (modifiedSuperClass.remove) {
				remove(ontology, axiom);
				return;
			}
			superClass = modifiedSuperClass.modified;
		}
		remove(ontology, axiom);
		OWLSubClassOfAxiom newAxiom = factory.getOWLSubClassOfAxiom(subClass, superClass, axiom.getAnnotations());
		add(ontology, newAxiom);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:CardinalityContraintsTools.java

示例14: test

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
@Test
	public void test() throws Exception {
		Map<OWLClass, Set<RedundantAxiom>> redundantAxiomMap = RedundantInferences.removeRedundantSubClassAxioms(graph.getSourceOntology(), reasoner);
		assertNotNull(redundantAxiomMap);
		assertEquals(1, redundantAxiomMap.size());
		
		OWLClass test1Sub = graph.getOWLClassByIdentifier("FOO:0004");
		OWLClass test1Super = graph.getOWLClassByIdentifier("FOO:0002");
		Set<RedundantAxiom> redundantAxioms = redundantAxiomMap.get(test1Sub);
		assertEquals(1, redundantAxioms.size());
		RedundantAxiom redundantAxiom = redundantAxioms.iterator().next();
		OWLSubClassOfAxiom owlAxiom = redundantAxiom.getAxiom();
		assertTrue(AxiomAnnotationTools.isMarkedAsInferredAxiom(owlAxiom));
		assertEquals(test1Super, owlAxiom.getSuperClass());
		Set<OWLClass> moreSpecific = redundantAxiom.getMoreSpecific();
		assertEquals(1, moreSpecific.size());
		OWLClass moreSpecificClass = moreSpecific.iterator().next();
		assertEquals(graph.getOWLClassByIdentifier("FOO:0003"), moreSpecificClass);


//		graph.getManager().saveOntology(graph.getSourceOntology(), System.err);
	}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:RedundantInferencesTest.java

示例15: getAdjacent

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入依赖的package包/类
@Override
public List<OWLClass> getAdjacent(OWLClass cls) {
	Set<OWLClass> results = new HashSet<OWLClass>();
	Set<OWLOntology> allOntologies = graph.getAllOntologies();
	for (OWLOntology owlOntology : allOntologies) {
		Set<OWLSubClassOfAxiom> axioms = owlOntology.getSubClassAxiomsForSubClass(cls);
		if (axioms != null && !axioms.isEmpty()) {
			for (OWLSubClassOfAxiom axiom : axioms) {
				OWLClassExpression expression = axiom.getSuperClass();
				if (!expression.isAnonymous()) {
					results.add(expression.asOWLClass());
				}
			}
		}
	}
	if (results.isEmpty()) {
		return Collections.emptyList();
	}
	return new ArrayList<OWLClass>(results);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:21,代码来源:CycleCheck.java


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