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


Java OWLOntology.getImportsClosure方法代码示例

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


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

示例1: getNamedDirectSuperClasses

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

示例2: preprocessAndClausify

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public Object[] preprocessAndClausify(OWLOntology rootOntology,Collection<DescriptionGraph> descriptionGraphs) {
    OWLDataFactory factory=rootOntology.getOWLOntologyManager().getOWLDataFactory();
    String ontologyIRI=rootOntology.getOntologyID().getDefaultDocumentIRI()==null ? "urn:hermit:kb" : rootOntology.getOntologyID().getDefaultDocumentIRI().toString();
    Collection<OWLOntology> importClosure=rootOntology.getImportsClosure();
    OWLAxioms axioms=new OWLAxioms();
    OWLNormalization normalization=new OWLNormalization(factory,axioms,0);
    for (OWLOntology ontology : importClosure)
        normalization.processOntology(ontology);
    BuiltInPropertyManager builtInPropertyManager=new BuiltInPropertyManager(factory);
    builtInPropertyManager.axiomatizeBuiltInPropertiesAsNeeded(axioms);
    ObjectPropertyInclusionManager objectPropertyInclusionManager=new ObjectPropertyInclusionManager(axioms);
    // now object property inclusion manager added all non-simple properties to axioms.m_complexObjectPropertyExpressions
    // now that we know which roles are non-simple, we can decide which negative object property assertions have to be
    // expressed as concept assertions so that transitivity rewriting applies properly.
    objectPropertyInclusionManager.rewriteNegativeObjectPropertyAssertions(factory,axioms,normalization.m_definitions.size());
    objectPropertyInclusionManager.rewriteAxioms(factory,axioms,0);
    if (descriptionGraphs==null)
        descriptionGraphs=Collections.emptySet();
    OWLAxiomsExpressivity axiomsExpressivity=new OWLAxiomsExpressivity(axioms);
    DLOntology dlOntology=clausify(factory,ontologyIRI,axioms,axiomsExpressivity,descriptionGraphs);
    return new Object[] { objectPropertyInclusionManager,dlOntology };
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:23,代码来源:OWLClausification.java

示例3: addSupportOntologiesFromImportsClosure

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Each ontology in the import closure of the source ontology
 * (and the import closure of each existing support ontology, if
 * doForAllSupportOntologies is true) is added to
 * the list of support ontologies
 * 
 * @param doForAllSupportOntologies
 */
public void addSupportOntologiesFromImportsClosure(boolean doForAllSupportOntologies) {
	Set<OWLOntology> ios = new HashSet<OWLOntology>();
	ios.add(sourceOntology);
	
	if (doForAllSupportOntologies) {
		ios.addAll(getSupportOntologySet());
	}
	for (OWLOntology so : ios) {
		for (OWLOntology o : so.getImportsClosure()) {
			if (o.equals(sourceOntology))
				continue;
			addSupportOntology(o);
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:OWLGraphWrapperBasic.java

示例4: loadOntology

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Load the root ontology and all imports and apply normalization.
 */
private OWLAxioms loadOntology(OWLOntology rootOntology) {
	OWLAxioms axioms = new OWLAxioms();

	Collection<OWLOntology> importClosure = rootOntology.getImportsClosure();
	if(configuration.getDomainIndividuals() == null) {
		configuration.setDomainIndividuals(rootOntology.getIndividualsInSignature(true));
	}

	normalization = new OWLNormalizationWithTracer(rootOntology.getOWLOntologyManager().getOWLDataFactory(), axioms, 0, configuration.getDomainIndividuals());

	for (OWLOntology ontology : importClosure) {
		normalization.processOntology(ontology);
	}

	return axioms;
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:20,代码来源:DebugTranslation.java

示例5: loadOntology

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Load the root ontology and all imports and apply normalization.
 */
private OWLAxioms loadOntology(OWLOntology rootOntology) {
	this.rootOntology = rootOntology;
	
	OWLAxioms axioms = new OWLAxioms();
	Collection<OWLOntology> importClosure = rootOntology.getImportsClosure();

	if(configuration.getDomainIndividuals() == null) {
		configuration.setDomainIndividuals(rootOntology.getIndividualsInSignature(true));
	}

	OWLNormalization normalization = new OWLNormalization(rootOntology.getOWLOntologyManager().getOWLDataFactory(), axioms, 0, configuration.getDomainIndividuals());

	for (OWLOntology ontology : importClosure) {
		normalization.processOntology(ontology);
	}
	return axioms;
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:21,代码来源:NaiveTranslation.java

示例6: removeLoadedOntologies

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Removes the specified ontology.
 * 
 * @param ontology
 *            ontology to remove.
 */
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
// New transaction since this method should be called even in the case of rollback.  
public void removeLoadedOntologies(OWLOntology ontology) {
    Set<OWLOntology> imports = ontology.getImportsClosure();
    imports.removeAll(BASE_ONTOLOGIES);
    for (OWLOntology imported : imports) {
        MANAGER.removeOntology(imported);
    }
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:16,代码来源:OntologyManager.java

示例7: getAxioms

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * @return the list of the axioms from the import closure of the given
 *         ontology
 */
private static List<OWLAxiom> getAxioms(OWLOntology main) {
	List<OWLAxiom> axioms = new ArrayList<OWLAxiom>();
	for (OWLOntology ont : main.getImportsClosure()) {
		axioms.addAll(ont.getAxioms());
	}
	return axioms;
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:12,代码来源:EmptyImportTest.java

示例8: nameObjectSomeValuesFrom

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Names all inner ObjectSomeValuesFrom expressions
 * 
 * @param srcOntology
 * @param tgtOntology
 * @param qmap
 * @param isAddLabels
 * @return
 */
public static Map<OWLClass, OWLClassExpression> nameObjectSomeValuesFrom(OWLOntology srcOntology,
		OWLOntology tgtOntology,
		Map<OWLClass,OWLClassExpression> qmap,
		boolean isAddLabels) {

	if (qmap == null) 
		qmap = new HashMap<OWLClass, OWLClassExpression>();
	OWLOntologyManager mgr = srcOntology.getOWLOntologyManager();
	OWLDataFactory df = mgr.getOWLDataFactory();
	for (OWLOntology ont : srcOntology.getImportsClosure()) {
		for (OWLAxiom ax : srcOntology.getAxioms()) {
			for (OWLClassExpression x : ax.getNestedClassExpressions()) {
				if (x instanceof OWLObjectSomeValuesFrom) {
					OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)x;
					OWLClass filler = (OWLClass) svf.getFiller();
					OWLObjectProperty p = (OWLObjectProperty) svf.getProperty();
					IRI iri = getSkolemIRI(filler, p);
					OWLClass c = df.getOWLClass(iri);
					mgr.addAxiom(tgtOntology, df.getOWLEquivalentClassesAxiom(c, svf));
					qmap.put(c, svf);
					if (isAddLabels) {
						Set<OWLAnnotation> anns = OwlHelper.getAnnotations(filler, df.getRDFSLabel(), ont);
						for (OWLAnnotation ann : anns) {
							mgr.addAxiom(tgtOntology, df.getOWLAnnotationAssertionAxiom(c.getIRI(), ann));
						}
					}
				}
			}
		}
	}
	return qmap;

}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:43,代码来源:TransformationUtils.java

示例9: OntologySetMetadata

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public OntologySetMetadata(OWLOntology ont) {
	ontologies = new HashSet<OntologyMetadata>();
	for (OWLOntology io : ont.getImportsClosure()) {
		OntologyMetadata om = new OntologyMetadata(io);
		ontologies.add(om);
		if (io.equals(ont)) {
			om.isRoot = true;
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:11,代码来源:OntologySetMetadata.java

示例10: loadOntology

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
private OWLAxioms loadOntology(OWLOntology rootOntology) {
	OWLAxioms axioms = new OWLAxioms();
	
	Collection<OWLOntology> importClosure = rootOntology.getImportsClosure();
	OWLNormalization normalization = new OWLNormalization(rootOntology.getOWLOntologyManager().getOWLDataFactory(), axioms, 0);
	
	for (OWLOntology ontology : importClosure) {
		normalization.processOntology(ontology);
	}
	
	return axioms;
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:13,代码来源:DirectTranslation.java

示例11: fillAspects

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
static void fillAspects(OWLOntology model, OWLReasoner reasoner, CurieHandler curieHandler, Set<OWLClass> bpSet, Set<OWLClass> mfSet, Set<OWLClass> ccSet, 
        OWLClass bp, OWLClass mf, OWLClass cc) {
    final IRI namespaceIRI = Obo2Owl.trTagToIRI(OboFormatTag.TAG_NAMESPACE.getTag());
    final OWLDataFactory df = model.getOWLOntologyManager().getOWLDataFactory();
    final OWLAnnotationProperty namespaceProperty = df.getOWLAnnotationProperty(namespaceIRI);
    final Set<OWLOntology> ontologies = model.getImportsClosure();
    for(OWLClass cls : model.getClassesInSignature(Imports.INCLUDED)) {
        if (cls.isBuiltIn()) {
            continue;
        }
        String id = curieHandler.getCuri(cls);
        if (id.startsWith("GO:") == false) {
            continue;
        }
        
        // if a reasoner object is passed, use inference to populate
        // the 3 subset
        if (reasoner != null) {
            if (reasoner.getSuperClasses(cls, false).containsEntity(mf) ||
                    reasoner.getEquivalentClasses(cls).contains(mf)) {
                mfSet.add(cls);
            }
            if (reasoner.getSuperClasses(cls, false).containsEntity(bp) ||
                    reasoner.getEquivalentClasses(cls).contains(bp)) {
                bpSet.add(cls);
            }
            if (reasoner.getSuperClasses(cls, false).containsEntity(cc) ||
                    reasoner.getEquivalentClasses(cls).contains(cc)) {
                ccSet.add(cls);
            }
        }

        
        for (OWLAnnotation annotation : OwlHelper.getAnnotations(cls, ontologies)) {
            if (annotation.getProperty().equals(namespaceProperty)) {
                String value = annotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {

                    @Override
                    public String visit(IRI iri) {
                        return null;
                    }

                    @Override
                    public String visit(OWLAnonymousIndividual individual) {
                        return null;
                    }

                    @Override
                    public String visit(OWLLiteral literal) {
                        return literal.getLiteral();
                    }
                });
                if (value != null) {
                    if ("molecular_function".equals(value)) {
                        mfSet.add(cls);
                    }
                    else if ("biological_process".equals(value)) {
                        bpSet.add(cls);
                    }
                    else if ("cellular_component".equals(value)) {
                        ccSet.add(cls);
                    }
                }
            }
        }
    }
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:68,代码来源:AbstractLegoTranslator.java

示例12: getImportedUnbaseOntologies

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Gets all imported unbase ontology for specified ontology plus this ontology.
 * 
 * @param ontology
 *            ontology
 * @return all imported unbase ontology and this ontology
 */
public Set<OWLOntology> getImportedUnbaseOntologies(OWLOntology ontology) {
    Set<OWLOntology> imports = ontology.getImportsClosure();
    imports.removeAll(BASE_ONTOLOGIES);
    return imports;
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:13,代码来源:OntologyManager.java

示例13: setOWLOntology

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Sets the given OWLOntology to be used by LogMap 
 * @param given_onto
 * @throws OWLOntologyCreationException
 */
public void setOWLOntology(OWLOntology given_onto) throws OWLOntologyCreationException{

	try {
		
		//TODO is this necessary to allow modifications of the ontology???
		
		//managerOnto.setSilentMissingImportsHandling(true);
		
		if (given_onto.getOntologyID().getOntologyIRI()!=null){
			iri_onto_str=given_onto.getOntologyID().getOntologyIRI().toString(); //Give this iri to module
		}
		else {
			iri_onto_str=getURIFromClasses(given_onto);
		}
		
		Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
		axioms.addAll(given_onto.getAxioms());
		//Get import closure
		for (OWLOntology imported_onto : given_onto.getImportsClosure()){
			axioms.addAll(imported_onto.getAxioms());
		}
		
		
		onto = managerOnto.createOntology(axioms, IRI.create(iri_onto_str));
		
		
		LogOutput.print("IRI: " + iri_onto_str);
		
				
		
		
		size_signature = onto.getSignature(true).size();
		size_classes = onto.getClassesInSignature(true).size();
		
		
		//We add dummy axiom
		if (size_classes==0){
			addDummyAxiom2Ontology();
		}
	}	
	
	catch(Exception e){
		System.err.println("Error creating OWL ontology 4 LogMap: " + e.getMessage());
		e.printStackTrace();
		throw new OWLOntologyCreationException();
	}
	
	
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:55,代码来源:OntologyLoader.java


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