owltools.mooncat
Class Mooncat

java.lang.Object
  extended by owltools.mooncat.Mooncat

public class Mooncat
extends Object

Given one source ontology referencing one or more referenced ontologies (e.g. CL referencing PRO, GO, CHEBI, UBERON), merge/copy a subset of axioms from the referenced ontologies into the source ontology. This relies on a OWLGraphWrapper object being created, in which the the source ontology is the primary ontology of interest, and the support ontologies are the set of ontologies from which references are drawn. For example, src=CL, sup={PRO,GO,CHEBI,UBERON} The owltools.graph algorithm is used to find the reference closure - i.e. all classes in the support ontologies referenced in the main ontology, together with their ancestors over subclass, equivalence and someValuesFrom. As a first step, previously merged classes are removed. These are marked out by an annotation assertion using IAO_0000412. Any classes merged in get this assigned automatically. In the future, owl imports will be supported.

Author:
cjm

Constructor Summary
Mooncat(OWLGraphWrapper g)
           
Mooncat(org.semanticweb.owlapi.model.OWLOntologyManager manager, org.semanticweb.owlapi.model.OWLDataFactory dataFactory, org.semanticweb.owlapi.model.OWLOntology ontology)
           
 
Method Summary
 void addImport(String importedIRIString)
          Deprecated. 
 void addReferencedOntology(org.semanticweb.owlapi.model.OWLOntology refOnt)
           
 void addSourceOntologyPrefix(String prefix)
          Add a source ontology prefix to the internal set.
 boolean belongsToSource(org.semanticweb.owlapi.model.OWLEntity obj)
           
 Set<org.semanticweb.owlapi.model.OWLOntology> getAllOntologies()
           
 Set<org.semanticweb.owlapi.model.OWLAxiom> getAxiomsForSubset(Set<org.semanticweb.owlapi.model.OWLObject> objs)
          "slim down" an ontology.
 Set<org.semanticweb.owlapi.model.OWLAxiom> getClosureAxiomsOfExternalReferencedEntities()
          find all axioms in closure of external referenced entities.
 Set<org.semanticweb.owlapi.model.OWLObject> getClosureOfExternalReferencedEntities()
          finds the full closure of all external referenced entities.
 Set<org.semanticweb.owlapi.model.OWLAxiom> getDanglingAxioms(org.semanticweb.owlapi.model.OWLOntology ont)
           
 Set<org.semanticweb.owlapi.model.OWLClass> getDanglingClasses()
           
 Set<org.semanticweb.owlapi.model.OWLClass> getDanglingClasses(org.semanticweb.owlapi.model.OWLOntology ont)
          finds all classes for which isDangling(OWLOntology, OWLEntity) is true
 Set<org.semanticweb.owlapi.model.OWLEntity> getExternalReferencedEntities()
          returns set of entities that belong to a referenced ontology that are referenced in the source ontology.
 OWLGraphWrapper getGraph()
           
 org.semanticweb.owlapi.model.OWLOntologyManager getManager()
           
 org.semanticweb.owlapi.model.OWLOntology getOntology()
           
 Set<org.semanticweb.owlapi.model.OWLOntology> getReferencedOntologies()
          delegates to OWLGraphWrapper support ontologies
 Set<String> getSourceOntologyPrefixes()
          E.g.
 boolean isDangling(org.semanticweb.owlapi.model.OWLOntology ont, org.semanticweb.owlapi.model.OWLEntity obj)
          Here a dangling entity is one that has no annotation assertions; this is not a perfect test, as conceivable a class could lack assertions; however, this would not be the case for any ontology following obo library principles.
static boolean isImportMarkedEntity(org.semanticweb.owlapi.model.OWLNamedObject named, org.semanticweb.owlapi.model.OWLOntology ontology)
          Check, if the named object has the annotation property IAO:0000412, declaring the object as imported.
 org.semanticweb.owlapi.model.OWLOntology makeSubsetOntology(Set<org.semanticweb.owlapi.model.OWLClass> subset, org.semanticweb.owlapi.model.IRI subOntIRI)
          Given a set of classes (e.g.
 void mergeIntoReferenceOntology(org.semanticweb.owlapi.model.OWLOntology ont)
           
 void mergeOntologies()
          merge minimal subset of referenced ontologies into the source ontology.
 void removeDanglingAxioms()
           
 void removeDanglingAxioms(org.semanticweb.owlapi.model.OWLOntology ont)
          Removes any axiom from ont if that axiom contains a dangling reference - i.e.
 void removeExternalEntities()
           
 void removeExternalEntities(boolean main, org.semanticweb.owlapi.model.OWLOntology ont)
           
 void removeExternalEntities(org.semanticweb.owlapi.model.OWLOntology ont)
          Removes all classes, individuals and object properties that are marked with IAO_0000412
 void removeExternalOntologyClasses(boolean removeDangling)
           
 void removeSubsetComplementClasses(Set<org.semanticweb.owlapi.model.OWLClass> subset, boolean removeDangling)
          Remove all classes *not* in subset.
 void setGraph(OWLGraphWrapper graph)
           
 void setManager(org.semanticweb.owlapi.model.OWLOntologyManager manager)
           
 void setOntology(org.semanticweb.owlapi.model.OWLOntology ontology)
           
 void setReferencedOntologies(Set<org.semanticweb.owlapi.model.OWLOntology> referencedOntologies)
          Deprecated. 
 void setSourceOntologyPrefixes(Set<String> sourceOntologyPrefixes)
          Set the source ontology prefixes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mooncat

public Mooncat(org.semanticweb.owlapi.model.OWLOntologyManager manager,
               org.semanticweb.owlapi.model.OWLDataFactory dataFactory,
               org.semanticweb.owlapi.model.OWLOntology ontology)

Mooncat

public Mooncat(OWLGraphWrapper g)
Method Detail

getSourceOntologyPrefixes

public Set<String> getSourceOntologyPrefixes()
E.g. http://purl.obolibrary.org/obo/go_

Returns:
set of prefixes

setSourceOntologyPrefixes

public void setSourceOntologyPrefixes(Set<String> sourceOntologyPrefixes)
Set the source ontology prefixes.

Parameters:
sourceOntologyPrefixes -

addSourceOntologyPrefix

public void addSourceOntologyPrefix(String prefix)
Add a source ontology prefix to the internal set.

Parameters:
prefix -

getReferencedOntologies

public Set<org.semanticweb.owlapi.model.OWLOntology> getReferencedOntologies()
delegates to OWLGraphWrapper support ontologies

Returns:
all support ontologies

getAllOntologies

public Set<org.semanticweb.owlapi.model.OWLOntology> getAllOntologies()
Returns:
union of referenced ontologies and source ontology

setReferencedOntologies

@Deprecated
public void setReferencedOntologies(Set<org.semanticweb.owlapi.model.OWLOntology> referencedOntologies)
Deprecated. 


addReferencedOntology

public void addReferencedOntology(org.semanticweb.owlapi.model.OWLOntology refOnt)
                           throws org.semanticweb.owlapi.model.OWLOntologyCreationException
Parameters:
refOnt -
Throws:
org.semanticweb.owlapi.model.OWLOntologyCreationException

mergeIntoReferenceOntology

public void mergeIntoReferenceOntology(org.semanticweb.owlapi.model.OWLOntology ont)
                                throws org.semanticweb.owlapi.model.OWLOntologyCreationException
Throws:
org.semanticweb.owlapi.model.OWLOntologyCreationException

getManager

public org.semanticweb.owlapi.model.OWLOntologyManager getManager()

setManager

public void setManager(org.semanticweb.owlapi.model.OWLOntologyManager manager)

getGraph

public OWLGraphWrapper getGraph()

setGraph

public void setGraph(OWLGraphWrapper graph)

getOntology

public org.semanticweb.owlapi.model.OWLOntology getOntology()
Returns:
source ontology (delegated to OWLGraphWrapper)

setOntology

public void setOntology(org.semanticweb.owlapi.model.OWLOntology ontology)

addImport

@Deprecated
public void addImport(String importedIRIString)
Deprecated. 


mergeOntologies

public void mergeOntologies()
merge minimal subset of referenced ontologies into the source ontology. This is the main entry method for this class. finds all external ontology axioms required to make a sub-ontology such that the source is "graph-complete", then add these axioms to source ontology


getExternalReferencedEntities

public Set<org.semanticweb.owlapi.model.OWLEntity> getExternalReferencedEntities()
returns set of entities that belong to a referenced ontology that are referenced in the source ontology. If the source ontology is not explicitly declared, then all entities that are referenced in the source ontology and declared in a reference ontology are returned. Example: if the source ontology is cl, and cl contains axioms that reference go:1, go:2, ... and go is in the set of referenced ontologies, then {go:1,go:2,...} will be in the returned set. It is irrelevant whether go:1, ... is declared in the source (e.g. MIREOTED) Note this only returns direct references. See getClosureOfExternalReferencedEntities() for closure of references

Returns:
all objects referenced by source ontology

getClosureOfExternalReferencedEntities

public Set<org.semanticweb.owlapi.model.OWLObject> getClosureOfExternalReferencedEntities()
finds the full closure of all external referenced entities. TODO: include object properties calls getExternalReferencedEntities() and then finds all reflexive ancestors of this set. to configure the traversal, see OWLGraphWrapper

Returns:
closure of all external referenced entities

getClosureAxiomsOfExternalReferencedEntities

public Set<org.semanticweb.owlapi.model.OWLAxiom> getClosureAxiomsOfExternalReferencedEntities()
find all axioms in closure of external referenced entities. Steps: The first step is carried out by getClosureOfExternalReferencedEntities() The second and third steps by getAxiomsForSubset(Set) Example: if the source is cl, and cl references go classes, and go is in the set of referenced ontologies, then this will return a collection of axioms constituting a sub-ontology of go such that the graph closure of cl is complete.

Returns:
axioms for sub-ontology

getAxiomsForSubset

public Set<org.semanticweb.owlapi.model.OWLAxiom> getAxiomsForSubset(Set<org.semanticweb.owlapi.model.OWLObject> objs)
"slim down" an ontology. Given a set of objects (e.g. a GO slim), find axioms constituting sub-ontology Steps: For example, if O contains the axiom [A SubClassOf R some B] and A ∈ S and B ∉ S, then this axiom will *not* be added for the set S Currently, all annotation assertions about an object are added by default

Parameters:
objs -
Returns:
axioms in subontology

belongsToSource

public boolean belongsToSource(org.semanticweb.owlapi.model.OWLEntity obj)

isDangling

public boolean isDangling(org.semanticweb.owlapi.model.OWLOntology ont,
                          org.semanticweb.owlapi.model.OWLEntity obj)
Here a dangling entity is one that has no annotation assertions; this is not a perfect test, as conceivable a class could lack assertions; however, this would not be the case for any ontology following obo library principles. this is probably the most reliable test - simply checking for declarations is insufficient as the owlapi may infer declarations

Parameters:
ont -
obj -
Returns:
boolean

getDanglingClasses

public Set<org.semanticweb.owlapi.model.OWLClass> getDanglingClasses()

getDanglingClasses

public Set<org.semanticweb.owlapi.model.OWLClass> getDanglingClasses(org.semanticweb.owlapi.model.OWLOntology ont)
finds all classes for which isDangling(OWLOntology, OWLEntity) is true

Parameters:
ont -
Returns:
set of classes that contain a dangling reference

removeDanglingAxioms

public void removeDanglingAxioms(org.semanticweb.owlapi.model.OWLOntology ont)
Removes any axiom from ont if that axiom contains a dangling reference - i.e. a reference a class in another ontology

Parameters:
ont -

removeDanglingAxioms

public void removeDanglingAxioms()

getDanglingAxioms

public Set<org.semanticweb.owlapi.model.OWLAxiom> getDanglingAxioms(org.semanticweb.owlapi.model.OWLOntology ont)

removeSubsetComplementClasses

public void removeSubsetComplementClasses(Set<org.semanticweb.owlapi.model.OWLClass> subset,
                                          boolean removeDangling)
Remove all classes *not* in subset. This means: * remove all annotation assertions for that class * remove all logical axioms about that class If removeDangling is true, also remove all axioms that reference this class

Parameters:
subset -
removeDangling -

makeSubsetOntology

public org.semanticweb.owlapi.model.OWLOntology makeSubsetOntology(Set<org.semanticweb.owlapi.model.OWLClass> subset,
                                                                   org.semanticweb.owlapi.model.IRI subOntIRI)
                                                            throws org.semanticweb.owlapi.model.OWLOntologyCreationException
Given a set of classes (e.g. those corresponding to an obo-subset or go-slim), and an ontology in which these are declared, generate a sub-ontology. The sub-ontology will only include classes in the subset. It will remove any axioms that refer to classes not in the subset. Inference is used to ensure that as many entailments as possible are preserved. note: this does the same as the perl script go-slimdown, used by the GO

Parameters:
subset -
subOntIRI -
Returns:
subOntology
Throws:
org.semanticweb.owlapi.model.OWLOntologyCreationException

isImportMarkedEntity

public static boolean isImportMarkedEntity(org.semanticweb.owlapi.model.OWLNamedObject named,
                                           org.semanticweb.owlapi.model.OWLOntology ontology)
Check, if the named object has the annotation property IAO:0000412, declaring the object as imported.

Parameters:
named -
ontology -
Returns:
true if the item has the annotation property IAO:0000412

removeExternalOntologyClasses

public void removeExternalOntologyClasses(boolean removeDangling)

removeExternalEntities

public void removeExternalEntities()

removeExternalEntities

public void removeExternalEntities(org.semanticweb.owlapi.model.OWLOntology ont)
Removes all classes, individuals and object properties that are marked with IAO_0000412

Parameters:
ont -

removeExternalEntities

public void removeExternalEntities(boolean main,
                                   org.semanticweb.owlapi.model.OWLOntology ont)


Copyright © 2010-2012. All Rights Reserved.