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


Java OWLSubClassOfAxiom.getSubClass方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: addSubClassAxiom

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
private void addSubClassAxiom(OWLSubClassOfAxiom axiom)
{
   OWLClassExpression subClass = axiom.getSubClass();
   OWLClassExpression superClass = axiom.getSuperClass();
   
   OwlNode<OWLClassExpression> subClassNode = createNode(subClass);
   OwlNode<OWLClassExpression> superClassNode = createNode(superClass);
   
   if (mClassCache.contains(subClass)) {
      subClassNode = findNode(subClass);
      superClassNode.setParent(subClassNode.getParent());
      subClassNode.setParent(superClassNode);
   }
   else if (mClassCache.contains(superClass)) {
      superClassNode = findNode(superClass);
      subClassNode.setParent(superClassNode);
   }
   else {
      superClassNode.setParent(mRoot);
      subClassNode.setParent(superClassNode);
   }
   mClassCache.add(subClass);
   mClassCache.add(superClass);
}
 
开发者ID:obidea,项目名称:semantika,代码行数:25,代码来源:OwlClassStructureHandler.java

示例5: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
@Override
public void visit(OWLSubClassOfAxiom axiom) {
	// process subclass
	OWLClassExpression subClass = axiom.getSubClass();
	if(!subClass.isOWLThing()){// we do not need to convert owl:Thing
		String subClassPattern = expressionConverter.asGroupGraphPattern(subClass, subjectVar);
		sparql += subClassPattern;
	}

	// process superclass
	OWLClassExpression superClass = axiom.getSuperClass();
	boolean needsOuterTriplePattern = subClass.isOWLThing() &&
			(superClass.getClassExpressionType() == ClassExpressionType.OBJECT_COMPLEMENT_OF ||
			superClass.getClassExpressionType() == ClassExpressionType.DATA_ALL_VALUES_FROM ||
			superClass.getClassExpressionType() == ClassExpressionType.OBJECT_ALL_VALUES_FROM);
	String superClassPattern = expressionConverter.asGroupGraphPattern(superClass, subjectVar,
																	   needsOuterTriplePattern);
	sparql += superClassPattern;
}
 
开发者ID:SmartDataAnalytics,项目名称:OWL2SPARQL,代码行数:20,代码来源:OWLAxiomToSPARQLConverter.java

示例6: checkPotentialRedundantSubClassAxioms

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
/**
 * Check all classes for potential redundant subClass axioms of type:
 * <pre>
 *   A SubClassOf R some B
 *    and
 *   A SubClassOf B
 * </pre>
 * 
 * @return list of axiom pairs
 */
public List<PotentialRedundant> checkPotentialRedundantSubClassAxioms() {
	List<PotentialRedundant> result = new ArrayList<PotentialRedundant>();
	for(OWLClass cls : graph.getAllOWLClasses()) {
		Set<OWLSubClassOfAxiom> axioms = graph.getAllOWLSubClassOfAxiomsForSubClass(cls);
		if (axioms.size() > 1) {
			// only check sets with more than one axiom
			for (OWLSubClassOfAxiom main : axioms) {
				OWLClassExpression mainSuperClassCE = main.getSuperClass();
				if (mainSuperClassCE.isAnonymous()) {
					continue;
				}
				OWLClass mainSuperClass = mainSuperClassCE.asOWLClass();
				for (OWLSubClassOfAxiom current : axioms) {
					if (main == current) {
						continue;
					}
					OWLClassExpression currentSuperClass = current.getSuperClass();
					if (currentSuperClass.isAnonymous() && currentSuperClass instanceof OWLObjectSomeValuesFrom) {
						OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) currentSuperClass;
						final OWLClassExpression filler = someValuesFrom.getFiller();
						if (mainSuperClass.equals(someValuesFrom.getFiller())) {
							final OWLObjectPropertyExpression property = someValuesFrom.getProperty();
							final OWLClassExpression subClass = current.getSubClass();
							final PotentialRedundant redundant = new PotentialRedundant(main, current, subClass.asOWLClass(), property.asOWLObjectProperty(), filler.asOWLClass());
							result.add(redundant);
						}
					}
				}
			}
		}
	}
	
	if (!result.isEmpty()) {
		return result;
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:48,代码来源:InferenceBuilder.java

示例7: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
public void visit(OWLSubClassOfAxiom subClassAxiom) {
	OWLClassExpression subClass = subClassAxiom.getSubClass();
	OWLClassExpression supClass = subClassAxiom.getSuperClass();
	
	subClass.accept(this);
	supClass.accept(this);
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:8,代码来源:NiceAxiomPrinter.java

示例8: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
@Override
public Set<ComplexIntegerAxiom> visit(OWLSubClassOfAxiom axiom) throws TranslationException {
	Objects.requireNonNull(axiom);
	OWLClassExpression owlSubClass = axiom.getSubClass();
	OWLClassExpression owlSuperClass = axiom.getSuperClass();
	IntegerClassExpression leftDescription = translateClassExpression(owlSubClass);
	IntegerClassExpression rightDescription = translateClassExpression(owlSuperClass);
	ComplexIntegerAxiom ret = getAxiomFactory().createSubClassOfAxiom(leftDescription, rightDescription,
			translateAnnotations(axiom.getAnnotations()));
	return Collections.singleton(ret);
}
 
开发者ID:julianmendez,项目名称:jcel,代码行数:12,代码来源:AxiomTranslator.java

示例9: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
/**
 * A utility method to process OWL <code>SubClassOf(CE1 CE2)</code> axiom and produce inferred
 * mapping assertions.
 */
@Override
public void visit(OWLSubClassOfAxiom axiom)
{
   /*
    * Trace all the ancestors of the class expression in the given OWL SubClassOf axiom.
    */
   Set<OWLSubClassOfAxiom> ancestors = mOntology.traceAncestors(axiom.getSubClass(), true);
   for (OWLSubClassOfAxiom ax : ancestors) {
      /*
       * Get all (copy) known mappings for the visited subclass expression.
       */
      OWLClassExpression subClass = ax.getSubClass();
      subClass.accept(this); // this call will produce (subclass) mSignature
      Set<IMapping> subClassMappings = getMappingsForClassExpression();
      if (subClassMappings.isEmpty()) {
         continue;
      }
      /*
       * Produce the "extra" mappings for the visited super class expression as many as the known
       * mappings in the subclass expression.
       */
      OWLClassExpression superClass = ax.getSuperClass();
      superClass.accept(this); // this call will produce (super class) mSignature and mIsInverse
      URI superClassSignature = mSignature;
      for (IMapping subClassMapping : subClassMappings) {
         IClassMapping cm = createClassMapping(superClassSignature, subClassMapping, mIsInverse);
         addInferredMapping(cm);
      }
   }
}
 
开发者ID:obidea,项目名称:semantika,代码行数:35,代码来源:TMappingProcessor.java

示例10: addSubConceptsOf

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
/**
 * @param c1
 * @param c2
 */
private void addSubConceptsOf(OWLClass c1, OWLClass c2) {
    Set<OWLSubClassOfAxiom> subOfSuper = new HashSet<OWLSubClassOfAxiom>();
    for (OWLOntology ox : ontologies) {
        subOfSuper.addAll(ox.getSubClassAxiomsForSuperClass(c1));
    }
    for (OWLSubClassOfAxiom a : subOfSuper) {
        OWLClassExpression d = a.getSubClass();
        if (d instanceof OWLClass) {
            OWLSubClassOfAxiom a1 = manager.getOWLDataFactory()
                    .getOWLSubClassOfAxiom(c2, d);
            loadAxiom(a1);
        }
    }
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:19,代码来源:OntologyParser.java

示例11: loadAxiom

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
/**
 * @param subaxiom
 */
private void loadAxiom(OWLSubClassOfAxiom subaxiom) {
    if (subaxiom.getSuperClass() instanceof OWLClass) {
        if (!subaxiom.getSuperClass().isOWLThing()) {
            OWLClassExpression subCls = subaxiom.getSubClass();
            if (subCls instanceof OWLClass) {
                if (!subCls.isOWLNothing()) {
                    registerSubsumption(subaxiom, subCls);
                }

            }
        }
    }
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:17,代码来源:OntologyParser.java

示例12: transformOWLSubClassOfAxiom

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
private Axiom transformOWLSubClassOfAxiom(OWLSubClassOfAxiom a) {
    OWLClassExpression sub = a.getSubClass();
    OWLClassExpression sup = a.getSuperClass();

    try {
        Concept subConcept = getConcept(sub);
        Concept superConcept = getConcept(sup);
        return new ConceptInclusion(subConcept, superConcept);
    } catch(UnsupportedOperationException e) {
        problems.add(e.getMessage());
        return null;
    }
}
 
开发者ID:aehrc,项目名称:ontology-core,代码行数:14,代码来源:OWLImporter.java

示例13: visit

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
public void visit(OWLSubClassOfAxiom axiom) {
	OWLClassExpression sub = axiom.getSubClass();
	// OWLClassExpression sup = axiom.getSuperClass();
	if (!(sub.isOWLThing() || sub.isOWLNothing() || sub instanceof OWLClass)) {
		// LOG.log(Level.SEVERE,
		// "On the left side of a subAxiom is not a single class, skipping");
		unusedAxiom(axiom);
	}
}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:10,代码来源:CEXOWL2ELProfile.java

示例14: removeRedundantSVFs

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
@CLIMethod("--remove-redundant-svfs")
public void removeRedundantSVFs(Opts opts) throws Exception {
    opts.info("", "removes redundant existentials: X R Some C, X R Some D, C SubClassOf* D");
    if (g == null) {
        LOG.error("No current ontology loaded");
        exit(-1);
    }
    if (reasoner == null) {
        LOG.error("No reasoner available for the current ontology");
        exit(-1);
    }
    while (opts.hasOpts()) {
        if (opts.nextEq("--report-file")) {
            //reportFile = opts.nextOpt();
        }
        else {
            break;
        }
    }
    Set<OWLSubClassOfAxiom> axioms = g.getSourceOntology().getAxioms(AxiomType.SUBCLASS_OF);
    Set<OWLSubClassOfAxiom> rmAxioms = new HashSet<OWLSubClassOfAxiom>();
    LOG.info("Candidates: " + axioms.size());
    for (OWLSubClassOfAxiom axiom : axioms) {
        if (axiom.getSubClass().isAnonymous())
            continue;
        OWLClass subClass = (OWLClass)axiom.getSubClass();
        if (axiom.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
            //LOG.info("  TESTING " + axiom);
            OWLObjectSomeValuesFrom svf = ((OWLObjectSomeValuesFrom)axiom.getSuperClass());
            for (OWLSubClassOfAxiom msAxiom : g.getSourceOntology().getSubClassAxiomsForSubClass(subClass)) {
                if (msAxiom.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
                    OWLObjectSomeValuesFrom mssvf = ((OWLObjectSomeValuesFrom)msAxiom.getSuperClass());
                    if (mssvf.getProperty().equals(svf.getProperty())) {
                        if (!svf.getFiller().isAnonymous()) {
                            if (reasoner.getSuperClasses(mssvf.getFiller(), false).
                                    containsEntity((OWLClass) svf.getFiller())) {
                                LOG.info(axiom+" IS_REDUNDANT: "+mssvf.getFiller() +
                                        " more-specific-than "+svf.getFiller());
                                rmAxioms.add(axiom);
                            }
                        }
                    }
                }
                else if (!msAxiom.getSuperClass().isAnonymous()) {
                    // TODO
                }
            }
        }
    }
    g.getManager().removeAxioms(g.getSourceOntology(), rmAxioms);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:52,代码来源:CommandRunner.java

示例15: removeRedundantInferredSVFs

import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; //导入方法依赖的package包/类
@CLIMethod("--remove-redundant-inferred-svfs")
public void removeRedundantInferredSVFs(Opts opts) throws Exception {
    opts.info("", "removes redundant existentials using extended reasoner");
    if (g == null) {
        LOG.error("No current ontology loaded");
        exit(-1);
    }
    if (reasoner == null) {
        LOG.error("No reasoner available for the current ontology");
        exit(-1);
    }
    if (!(reasoner instanceof OWLExtendedReasoner)) {
        LOG.error("Reasoner is not extended");
        exit(-1);
    }
    OWLExtendedReasoner exr = (OWLExtendedReasoner)reasoner;
    while (opts.hasOpts()) {
        if (opts.nextEq("--report-file")) {
            //reportFile = opts.nextOpt();
        }
        else {
            break;
        }
    }
    OWLPrettyPrinter owlpp = new OWLPrettyPrinter(g);
    Set<OWLSubClassOfAxiom> axioms = g.getSourceOntology().getAxioms(AxiomType.SUBCLASS_OF);
    Set<OWLSubClassOfAxiom> rmAxioms = new HashSet<OWLSubClassOfAxiom>();
    LOG.info("Candidates: " + axioms.size());
    int n = 0;
    for (OWLSubClassOfAxiom axiom : axioms) {
        n++;
        if (n % 100 == 0) {
            LOG.info("Testing axiom #" +n);
        }
        if (axiom.getSubClass().isAnonymous())
            continue;
        OWLClass subClass = (OWLClass)axiom.getSubClass();
        if (axiom.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
            OWLObjectSomeValuesFrom svf = ((OWLObjectSomeValuesFrom)axiom.getSuperClass());
            if (svf.getProperty().isAnonymous())
                continue;
            if (svf.getFiller().isAnonymous())
                continue;
            OWLObjectProperty p = (OWLObjectProperty)svf.getProperty();
            Set<OWLClass> directParents = exr.getSuperClassesOver(subClass, p, true);
            if (!directParents.contains(svf.getFiller())) {
                rmAxioms.add(axiom);
                LOG.info("  IS_REDUNDANT: "+owlpp.render(axiom)+" as filler not in "+directParents);
                for (OWLClass dp : directParents) {
                    LOG.info("DIRECT_PARENT_OVER "+owlpp.render(p)+" "+owlpp.render(dp));
                }
            }
        }
    }
    g.getManager().removeAxioms(g.getSourceOntology(), rmAxioms);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:57,代码来源:CommandRunner.java


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