org.semanticweb.owl.impl.model
Class OWLOntologyImpl

java.lang.Object
  |
  +--org.semanticweb.owl.impl.model.OWLObjectImpl
        |
        +--org.semanticweb.owl.impl.model.OWLNamedObjectImpl
              |
              +--org.semanticweb.owl.impl.model.OWLOntologyImpl
All Implemented Interfaces:
ChangeVisitor, Cloneable, OntologyChangeSource, OWLNamedObject, OWLObject, OWLOntology, Serializable

public class OWLOntologyImpl
extends OWLNamedObjectImpl
implements OWLOntology, ChangeVisitor, OntologyChangeSource

Represents an OWL ontology. An ontology comprises a number of collections. Each ontology has a number of classes, properties and individuals, along with a number of axioms asserting information about those objects. This is a very simple implementation of an Ontology. Nothing special in here -- just a basic data structure with minimal functionality. The class implements the change visitor interface which allows manipulation of the ontology.

Version:
$Id: OWLOntologyImpl.java,v 1.2 2003/12/11 12:59:45 sean_bechhofer Exp $
See Also:
Serialized Form

Nested Class Summary
protected  class OWLOntologyImpl.EntityAdder
           
protected  class OWLOntologyImpl.EntityRemover
           
 
Field Summary
protected  HashMap annotationProperties
           
protected  int anonymousIndividuals
           
protected  Set changeListeners
           
protected  Set classAxioms
           
protected  HashMap classes
           
protected  HashMap dataProperties
           
protected  HashMap datatypes
           
protected  Set importedOntologies
           
protected  Set individualAxioms
           
protected  HashMap individuals
           
protected  boolean mutable
           
protected  HashMap objectProperties
           
protected  URI physicalURI
           
protected  Set propertyAxioms
           
protected  ChangeVisitor visitorProxy
           
 
Fields inherited from class org.semanticweb.owl.impl.model.OWLNamedObjectImpl
uri
 
Constructor Summary
OWLOntologyImpl(OWLDataFactoryImpl factory, URI logicalURI, URI physicalURI)
           
 
Method Summary
 void accept(OWLObjectVisitor visitor)
          Accept a visit from a visitor
 void addOntologyChangeListener(OntologyChangeListener listener)
          Add an ontology change listener to the collection of things that should be notified when ontology change events occur.
 void applyChanges(List changeList)
          Processes changes in the change list.
protected  void filterEvent(OntologyChange event)
           
 Set getAnnotationProperties()
          Returns a list of the annotation properties of the ontology
 OWLAnnotationProperty getAnnotationProperty(URI uri)
          getAnnotationProperty Retrieves an AnnotationProperty with a given uri
 Set getBackwardCompatibleWith()
           
protected  ChangeVisitor getChangeVisitor()
          Returns a ChangeVisitor that will apply change events to this ontology.
 OWLClass getClass(URI uri)
          getClass Retrieves a class with a given uri
 Set getClassAxioms()
          Returns a list of class axioms in the ontology.
 Set getClasses()
          Returns a list of the classes of the ontology
 Set getDataProperties()
          Returns a list of the datatype properties of the ontology (i.e. those whose range is a concrete data type).
 OWLDataProperty getDataProperty(URI uri)
          getDataProperty Retrieves a DataProperty with a given uri
 OWLDataType getDatatype(URI uri)
          getDatatype Retrieves a datatype with a given uri
 Set getDatatypes()
          Returns a list of the classes of the ontology
 Set getIncludedOntologies()
          Returns a list of the Ontologies imported by this Ontology.
 Set getIncompatibleWith()
           
 OWLIndividual getIndividual(URI uri)
          getIndividual Retrieves an individual with a given uri
 Set getIndividualAxioms()
          Returns a list of the individual axioms in the ontology.
 Set getIndividuals()
          Returns a list of the individuals in the ontology
 URI getLogicalURI()
          getLogicalURI Identifies this ontology uniquely (enforced within one OWLConnection)
 Set getObjectProperties()
          Returns a list of the object properties of the ontology (i.e. those whose range is a subset of the object domain.
 OWLObjectProperty getObjectProperty(URI uri)
          getObjectProperty Retrieves a ObjectProperty with a given uri
 URI getPhysicalURI()
          getLogicalURI Physical URI of the ontology.
 Set getPriorVersion()
           
 Set getPropertyAxioms()
          Returns a list of the property axioms in the ontology.
protected  void handleEvent(OntologyChange event)
           
 boolean isMutable()
          Returns true if the ontology is mutable, i.e. can be changed.
protected  void notifyListeners(OntologyChange event)
           
 void removeOntologyChangeListener(OntologyChangeListener listener)
          Remove the listener from the collection
 void visit(AddAnnotationInstance event)
          Change Visitor events.
 void visit(AddClassAxiom event)
           
 void visit(AddDataPropertyInstance event)
           
 void visit(AddDataPropertyRange event)
           
 void visit(AddDataType event)
           
 void visit(AddDomain event)
           
 void visit(AddEntity event)
           
 void visit(AddEnumeration event)
           
 void visit(AddEquivalentClass event)
           
 void visit(AddImport event)
           
 void visit(AddIndividualAxiom event)
           
 void visit(AddIndividualClass event)
           
 void visit(AddInverse event)
           
 void visit(AddObjectPropertyInstance event)
           
 void visit(AddObjectPropertyRange event)
           
 void visit(AddPropertyAxiom event)
           
 void visit(AddSuperClass event)
           
 void visit(AddSuperProperty event)
           
 void visit(RemoveClassAxiom event)
           
 void visit(RemoveEntity event)
           
 void visit(RemoveEnumeration event)
           
 void visit(RemoveEquivalentClass event)
           
 void visit(RemoveSuperClass event)
           
 void visit(SetDeprecated event)
           
 void visit(SetFunctional event)
           
 void visit(SetInverseFunctional event)
           
 void visit(SetLogicalURI event)
           
 void visit(SetOneToOne event)
           
 void visit(SetSymmetric event)
           
 void visit(SetTransitive event)
           
 
Methods inherited from class org.semanticweb.owl.impl.model.OWLNamedObjectImpl
getURI
 
Methods inherited from class org.semanticweb.owl.impl.model.OWLObjectImpl
clone, getAnnotations, getAnnotations, getContainedObjects, getMetadata, getOWLConnection, getOWLDataFactory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.semanticweb.owl.model.OWLNamedObject
getURI
 
Methods inherited from interface org.semanticweb.owl.model.OWLObject
clone, getAnnotations, getAnnotations, getContainedObjects, getMetadata, getOWLConnection, getOWLDataFactory
 

Field Detail

classes

protected HashMap classes

annotationProperties

protected HashMap annotationProperties

dataProperties

protected HashMap dataProperties

objectProperties

protected HashMap objectProperties

individuals

protected HashMap individuals

datatypes

protected HashMap datatypes

anonymousIndividuals

protected int anonymousIndividuals

classAxioms

protected Set classAxioms

propertyAxioms

protected Set propertyAxioms

individualAxioms

protected Set individualAxioms

importedOntologies

protected Set importedOntologies

mutable

protected boolean mutable

physicalURI

protected URI physicalURI

visitorProxy

protected ChangeVisitor visitorProxy

changeListeners

protected Set changeListeners
Constructor Detail

OWLOntologyImpl

public OWLOntologyImpl(OWLDataFactoryImpl factory,
                       URI logicalURI,
                       URI physicalURI)
Method Detail

applyChanges

public void applyChanges(List changeList)
                  throws OWLException
Processes changes in the change list.

Parameters:
changeList - list of changes to the model
OWLException

getPhysicalURI

public URI getPhysicalURI()
Description copied from interface: OWLOntology
getLogicalURI Physical URI of the ontology.

Specified by:
getPhysicalURI in interface OWLOntology
Returns:
String representaion of the URI, could be null (e.g. not stored yet or in a database)

getLogicalURI

public URI getLogicalURI()
Description copied from interface: OWLOntology
getLogicalURI Identifies this ontology uniquely (enforced within one OWLConnection)

Specified by:
getLogicalURI in interface OWLOntology
Returns:
String representation of the URI

getClasses

public Set getClasses()
Returns a list of the classes of the ontology

Specified by:
getClasses in interface OWLOntology

getAnnotationProperties

public Set getAnnotationProperties()
Returns a list of the annotation properties of the ontology

Specified by:
getAnnotationProperties in interface OWLOntology

getDataProperties

public Set getDataProperties()
Returns a list of the datatype properties of the ontology (i.e. those whose range is a concrete data type).

Specified by:
getDataProperties in interface OWLOntology

getObjectProperties

public Set getObjectProperties()
Returns a list of the object properties of the ontology (i.e. those whose range is a subset of the object domain.

Specified by:
getObjectProperties in interface OWLOntology

getIndividuals

public Set getIndividuals()
Returns a list of the individuals in the ontology

Specified by:
getIndividuals in interface OWLOntology

getDatatypes

public Set getDatatypes()
Returns a list of the classes of the ontology

Specified by:
getDatatypes in interface OWLOntology

getClassAxioms

public Set getClassAxioms()
Returns a list of class axioms in the ontology. These include subclass axioms, disjointness axioms and equality axioms.

Specified by:
getClassAxioms in interface OWLOntology

getPropertyAxioms

public Set getPropertyAxioms()
Returns a list of the property axioms in the ontology. These include subproperty axioms and property equality axioms.

Specified by:
getPropertyAxioms in interface OWLOntology

getIndividualAxioms

public Set getIndividualAxioms()
Returns a list of the individual axioms in the ontology. These will include axioms asserting the equality and inequality of individuals.

Specified by:
getIndividualAxioms in interface OWLOntology

getIncludedOntologies

public Set getIncludedOntologies()
Returns a list of the Ontologies imported by this Ontology.

Specified by:
getIncludedOntologies in interface OWLOntology
Returns:
Set{OWLOntology}

getPriorVersion

public Set getPriorVersion()
Specified by:
getPriorVersion in interface OWLOntology

getBackwardCompatibleWith

public Set getBackwardCompatibleWith()
Specified by:
getBackwardCompatibleWith in interface OWLOntology

getIncompatibleWith

public Set getIncompatibleWith()
Specified by:
getIncompatibleWith in interface OWLOntology

isMutable

public boolean isMutable()
Returns true if the ontology is mutable, i.e. can be changed. If the ontology has been retrieved from a URI (for example as an imported ontology), then the ontology will be considered immutable.

Specified by:
isMutable in interface OWLOntology
Returns:
a boolean value

accept

public void accept(OWLObjectVisitor visitor)
            throws OWLException
Description copied from interface: OWLObject
Accept a visit from a visitor

Specified by:
accept in interface OWLObject
Specified by:
accept in class OWLObjectImpl
OWLException

getChangeVisitor

protected ChangeVisitor getChangeVisitor()
Returns a ChangeVisitor that will apply change events to this ontology. The visitor will also notify any listeners that the change has occurred.


getClass

public OWLClass getClass(URI uri)
getClass Retrieves a class with a given uri

Specified by:
getClass in interface OWLOntology
Parameters:
uri - (URI)
Returns:
OWLClass, null if there is no such thing

getAnnotationProperty

public OWLAnnotationProperty getAnnotationProperty(URI uri)
getAnnotationProperty Retrieves an AnnotationProperty with a given uri

Specified by:
getAnnotationProperty in interface OWLOntology
Parameters:
uri - (String)
Returns:
OWLAnnotationProperty, null if there is no such thing

getDataProperty

public OWLDataProperty getDataProperty(URI uri)
getDataProperty Retrieves a DataProperty with a given uri

Specified by:
getDataProperty in interface OWLOntology
Parameters:
uri - (String)
Returns:
OWLDataProperty, null if there is no such thing

getObjectProperty

public OWLObjectProperty getObjectProperty(URI uri)
getObjectProperty Retrieves a ObjectProperty with a given uri

Specified by:
getObjectProperty in interface OWLOntology
Parameters:
uri - (URI)
Returns:
OWLObjectProperty, null if there is no such thing

getIndividual

public OWLIndividual getIndividual(URI uri)
getIndividual Retrieves an individual with a given uri

Specified by:
getIndividual in interface OWLOntology
Parameters:
uri - (URI)
Returns:
OWLDataProperty, returns null if it is there

getDatatype

public OWLDataType getDatatype(URI uri)
getDatatype Retrieves a datatype with a given uri

Specified by:
getDatatype in interface OWLOntology
Parameters:
uri - (URI)
Returns:
OWLClass, null if there is no such thing

visit

public void visit(AddAnnotationInstance event)
           throws OWLException
Change Visitor events. Pass them all off to the proxy

Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddAnnotationInstance value
Throws:
OWLException - if an error occurs

visit

public void visit(AddEntity event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddEntity value
Throws:
OWLException - if an error occurs

visit

public void visit(AddDataType event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddDataType value
Throws:
OWLException - if an error occurs

visit

public void visit(RemoveEntity event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - a RemoveEntity value
Throws:
OWLException - if an error occurs

visit

public void visit(AddImport event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddImport value
Throws:
OWLException - if an error occurs

visit

public void visit(AddIndividualAxiom event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddIndividualAxiom value
Throws:
OWLException - if an error occurs

visit

public void visit(AddClassAxiom event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddPropertyAxiom event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddPropertyAxiom value
Throws:
OWLException - if an error occurs

visit

public void visit(AddSuperClass event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddSuperProperty event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddIndividualClass event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddEquivalentClass event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddEquivalentClass value
Throws:
OWLException - if an error occurs

visit

public void visit(AddEnumeration event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
Parameters:
event - an AddEnumeration value
Throws:
OWLException - if an error occurs

visit

public void visit(AddDomain event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddDataPropertyRange event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddObjectPropertyRange event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddInverse event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetFunctional event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetTransitive event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetSymmetric event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetInverseFunctional event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetOneToOne event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetDeprecated event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddObjectPropertyInstance event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(AddDataPropertyInstance event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(RemoveClassAxiom event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(RemoveSuperClass event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(RemoveEquivalentClass event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(RemoveEnumeration event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

visit

public void visit(SetLogicalURI event)
           throws OWLException
Specified by:
visit in interface ChangeVisitor
OWLException

filterEvent

protected void filterEvent(OntologyChange event)
                    throws OWLException
OWLException

handleEvent

protected void handleEvent(OntologyChange event)
                    throws OWLException
OWLException

notifyListeners

protected void notifyListeners(OntologyChange event)
                        throws OWLException
OWLException

addOntologyChangeListener

public void addOntologyChangeListener(OntologyChangeListener listener)
                               throws OWLException
Description copied from interface: OntologyChangeSource
Add an ontology change listener to the collection of things that should be notified when ontology change events occur.

Specified by:
addOntologyChangeListener in interface OntologyChangeSource
OWLException

removeOntologyChangeListener

public void removeOntologyChangeListener(OntologyChangeListener listener)
                                  throws OWLException
Description copied from interface: OntologyChangeSource
Remove the listener from the collection

Specified by:
removeOntologyChangeListener in interface OntologyChangeSource
OWLException


WonderWeb