當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。