本文整理匯總了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;
}
示例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 };
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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);
}
}
}
}
}
}
示例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;
}
示例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();
}
}