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


Java OWLClassAssertionAxiom.getClassExpression方法代码示例

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


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

示例1: getTypes

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
    ensurePrepared();
    DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
    for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
        for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(ind)) {
            OWLClassExpression ce = axiom.getClassExpression();
            if (!ce.isAnonymous()) {
                result.addNode(classHierarchyInfo.getEquivalents(ce.asOWLClass()));
                if (!direct) {
                    result.addAllNodes(getSuperClasses(ce, false).getNodes());
                }
            }
        }
    }
    return result;
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:17,代码来源:StructuralReasoner2.java

示例2: removeDangningAnnotations

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
@CLIMethod("--remove-dangling-annotations")
public void removeDangningAnnotations(Opts opts) throws Exception {
	OWLOntology ont = g.getSourceOntology();
	int n = 0;
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
		for (OWLClassAssertionAxiom ca : ont.getClassAssertionAxioms(i)) {
			OWLClassExpression cx = ca.getClassExpression();
			if (cx instanceof OWLClass) {
				OWLClass c = (OWLClass) cx;
				String label = g.getLabel(c);
				if (label == null)
					rmAxioms.add(ca);
				else
					n++;
			}
		}
	}
	LOG.info("Removing " + rmAxioms.size() + " axioms");
	ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
	LOG.info("Remaining: " + n + " axioms");
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:Sim2CommandRunner.java

示例3: makeHasPhenotypeInstancesDirect

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
protected void makeHasPhenotypeInstancesDirect() {
	// x Type has_phenotype some C ==> x Type C
	LOG.info("x Type has_phenotype some C ==> x Type C");
	OWLObjectProperty hasPhenotype = getOWLObjectPropertyViaOBOSuffix(HAS_PHENOTYPE);
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
	for (OWLClassAssertionAxiom caa : outputOntology.getAxioms(AxiomType.CLASS_ASSERTION)) {
		OWLClassExpression ex = caa.getClassExpression();
		OWLIndividual i = caa.getIndividual();
		if (ex instanceof OWLObjectSomeValuesFrom) {
			OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)ex;
			if (svf.getProperty().equals(hasPhenotype)) {
				rmAxioms.add(caa);
				newAxioms.add(getOWLDataFactory().getOWLClassAssertionAxiom(svf.getFiller(), i));
			}

		}
	}
	LOG.info("making instances direct: +"+newAxioms.size()+ " -"+rmAxioms.size());
	addAxiomsToOutput(newAxioms, false);
	removeAxiomsFromOutput(rmAxioms, false);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:PhenoSimHQEPreProcessor.java

示例4: visit

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public void visit(OWLClassAssertionAxiom classAssertion) {
	OWLIndividual individual = classAssertion.getIndividual();
	OWLClassExpression classExpression = classAssertion.getClassExpression();
	
	if (!classExpression.isAnonymous()) {
		OWLClass namedClass = classExpression.asOWLClass();
		
		writer.print(namedClass.getIRI().getFragment());
		writer.print("(");
		writer.print(IRI.create(individual.toStringID()).getFragment());
		writer.print(").\n");
	}
	else {
		
	}
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:17,代码来源:NiceAxiomPrinter.java

示例5: getTypes

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
private Set<OWLClass> getTypes(OWLNamedIndividual i, OWLOntology model) {
	Set<OWLClassAssertionAxiom> axioms = model.getClassAssertionAxioms(i);
	Set<OWLClass> types = new HashSet<OWLClass>();
	for (OWLClassAssertionAxiom axiom : axioms) {
		OWLClassExpression ce = axiom.getClassExpression();
		if (ce instanceof OWLClass) {
			OWLClass cls = ce.asOWLClass();
			if (cls.isBuiltIn() == false) {
				types.add(cls);
			}
		}
	}
	return types;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:15,代码来源:LegoModelWalker.java

示例6: visit

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public void visit(OWLClassAssertionAxiom axiom) {
    OWLClassExpression classExpression=axiom.getClassExpression();
    if (classExpression instanceof OWLDataHasValue) {
        OWLDataHasValue hasValue=(OWLDataHasValue)classExpression;
        addFact(m_factory.getOWLDataPropertyAssertionAxiom(hasValue.getProperty(), axiom.getIndividual(), hasValue.getValue()));
        return;
    }
    if (classExpression instanceof OWLDataSomeValuesFrom) {
        OWLDataSomeValuesFrom someValuesFrom=(OWLDataSomeValuesFrom)classExpression;
        OWLDataRange dataRange=someValuesFrom.getFiller();
        if (dataRange instanceof OWLDataOneOf) {
            OWLDataOneOf oneOf=(OWLDataOneOf)dataRange;
            if (oneOf.getValues().size()==1) {
                addFact(m_factory.getOWLDataPropertyAssertionAxiom(someValuesFrom.getProperty(),axiom.getIndividual(),oneOf.getValues().iterator().next()));
                return;
            }
        }
    }
    classExpression=positive(classExpression);
    if (!isSimple(classExpression)) {
        OWLClassExpression definition=getDefinitionFor(classExpression,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_classExpressionInclusionsAsDisjunctions.add(new OWLClassExpression[] { negative(definition),classExpression });
        classExpression=definition;
    }
    addFact(m_factory.getOWLClassAssertionAxiom(classExpression,axiom.getIndividual()));
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:28,代码来源:OWLNormalization.java

示例7: visit

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public Boolean visit(OWLClassAssertionAxiom axiom) {
    OWLIndividual ind=axiom.getIndividual();
    if (ind.isAnonymous()) {
        anonymousIndividualAxioms.add(axiom);
        return true; // will be checked afterwards by rolling-up
    }
    OWLClassExpression c=axiom.getClassExpression();
    return reasoner.hasType(ind.asOWLNamedIndividual(),c,false);
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:10,代码来源:EntailmentChecker.java

示例8: findFirstType

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
private OWLClass findFirstType(OWLNamedIndividual relevant) {
	Set<OWLClassAssertionAxiom> axioms = model.getClassAssertionAxioms(relevant);
	for (OWLClassAssertionAxiom axiom : axioms) {
		OWLClassExpression ce = axiom.getClassExpression();
		if (ce.isAnonymous() == false) {
			return ce.asOWLClass();
		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:11,代码来源:ModelAnnotationSolrDocumentLoader.java

示例9: visit

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public void visit(OWLClassAssertionAxiom axiom) {
	OWLClassExpression classExpression=axiom.getClassExpression();
	if (classExpression instanceof OWLDataHasValue) {
        OWLDataHasValue hasValue=(OWLDataHasValue)classExpression;
        addFact(m_factory.getOWLDataPropertyAssertionAxiom(hasValue.getProperty(), axiom.getIndividual(), hasValue.getValue()));
        return;
    }
    if (classExpression instanceof OWLDataSomeValuesFrom) {
        OWLDataSomeValuesFrom someValuesFrom=(OWLDataSomeValuesFrom)classExpression;
        OWLDataRange dataRange=someValuesFrom.getFiller();
        if (dataRange instanceof OWLDataOneOf) {
            OWLDataOneOf oneOf=(OWLDataOneOf)dataRange;
            if (oneOf.getValues().size()==1) {
                addFact(m_factory.getOWLDataPropertyAssertionAxiom(someValuesFrom.getProperty(),axiom.getIndividual(),oneOf.getValues().iterator().next()));
                return;
            }
        }
    }
    classExpression=positive(classExpression);
    if (!isSimple(classExpression)) {
        OWLClassExpression definition=getDefinitionFor(classExpression,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_classExpressionInclusionsAsDisjunctions.add(new OWLClassExpression[] { negative(definition),classExpression });
        classExpression=definition;
    }
    addFact(m_factory.getOWLClassAssertionAxiom(classExpression,axiom.getIndividual()));
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:28,代码来源:OWLNormalization.java

示例10: mapClassAssertionsUp

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public static void mapClassAssertionsUp(OWLOntology ont, OWLReasoner reasoner, Set<OWLClass> targetClasses, Set<OWLClass> inputClasses) {
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
	Map<OWLClass, Set<OWLClass>> cmap = new HashMap<OWLClass, Set<OWLClass>>();
	LOG.info("Target classes: "+targetClasses.size());
	int n=0;
	for (OWLClassAssertionAxiom ca : ont.getAxioms(AxiomType.CLASS_ASSERTION)) {
		if (ca.getClassExpression().isAnonymous())
			continue;
		OWLClass c = (OWLClass) ca.getClassExpression();
		n++;
		if (inputClasses == null || inputClasses.contains(c)) {
			if (targetClasses.contains(c))
				continue;
			Set<OWLClass> supers;
			if (cmap.containsKey(c)) {
				supers = cmap.get(c);
			}
			else {
				supers = reasoner.getSuperClasses(c, false).getFlattened();
				supers.addAll(reasoner.getEquivalentClasses(c).getEntities());
				LOG.info(c+" has #supers: "+supers.size());
				LOG.info(c + " ===> "+supers);
				supers.retainAll(targetClasses);
				LOG.info(c+" has #supersInTargetSet: "+supers.size());
				supers = getNonRedundant(supers, reasoner);
				//LOG.info(c+" has #NRsupers: "+supers.size());
				//LOG.info(c + " ===> "+supers);
				cmap.put(c, supers);
				if (supers.size() > 0) {
					LOG.info(c + " ===> "+supers);
				}
			}
			rmAxioms.add(ca);
			OWLIndividual individual = ca.getIndividual();
			for (OWLClass sc : supers) {
				newAxioms.add(ont.getOWLOntologyManager().getOWLDataFactory().getOWLClassAssertionAxiom(sc, individual));
			}
		}
	}
	LOG.info("named class assertions (start): "+n);
	LOG.info("rm:"+rmAxioms.size());
	LOG.info("new:"+newAxioms.size());
	ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
	ont.getOWLOntologyManager().addAxioms(ont, newAxioms);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:47,代码来源:ABoxUtils.java


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