edu.unika.aifb.daml
Class DAMLOntologyImpl

edu.unika.aifb.daml.DAMLResourceImpl
  |
  +--edu.unika.aifb.daml.DAMLOntologyImpl

public class DAMLOntologyImpl
extends DAMLResourceImpl
implements DAMLOntology


Field Summary
 (package private) DAMLOntologyImpl_o
           
 (package private) HashtabledamlClasses
           
 (package private) ModeldamlCore
           
 (package private) StringdamlCoreURI
           
 (package private) HashtabledamlDatatypes
           
 (package private) HashtabledamlImports
           
 (package private) HashtabledamlLiterals
           
 (package private) HashtabledamlProperties
           
 (package private) HashtabledamlResources
           

Fields inherited from class edu.unika.aifb.daml.DAMLResourceImpl
_m, _this, isCore

Constructor Summary
DAMLOntologyImpl(Model damlCore)
           
DAMLOntologyImpl(Model theIDresource, String damlCoreURI)
           
DAMLOntologyImpl(String theIDresource, Model damlCore)
           
DAMLOntologyImpl(Model theIDresource, Model damlCore)
           

Method Summary
 voidaddImport(DAMLOntology theImport)
          Adds the provided ontology to the ontology's imports.
 Iteratorclasses()
          Provides an iterator for the all of the ontology's classes.
 Iteratorclasses(DAMLResource aType)
          Provides an iterator for only the ontology's classes of the provided type.
 booleancontainsClass(Object theID)
          Checks for the existence of a Class in this ontology whose ID matches the provided ID.
 booleancontainsDatatype(Object theID)
          Checks for the existence of a Datatype in this ontology whose ID matches the provided ID.
 booleancontainsImport(Object theID)
          Looks for an imported ontology in this ontology whose ID matches the provided ID.
 booleancontainsLiteral(Object theID)
          Looks for a literal in this ontology whose ID matches the provided ID.
 booleancontainsProperty(Object theID)
          Checks for the existence of a property in this ontology whose ID matches the provided ID.
 booleancontainsResource(Object theID)
          Looks for a resource in this ontology whose ID matches the provided ID.
 DAMLClasscreateClass()
          Creates a Class in this ontology with a generated unique ID and adds the Class to the ontology.
 DAMLClasscreateClass(String theID)
          Looks for, and possibilly creates, a Class in this ontology.
 DAMLClasscreateClass(DAMLResource aType)
          Creates a Class in this ontology with a generated unique ID, sets the Classes type to the passed in type and adds the Class to the ontology.
 DAMLClasscreateClass(DAMLResource aType, String theID)
          Looks for, and possibilly creates, a Class in this ontology.
 DAMLDatatypecreateDatatype()
          Creates a Datatype in this ontology with a generated unique ID and adds the Datatype to the ontology.
 DAMLDatatypecreateDatatype(String theID)
          Looks for, and possibilly creates, a Datatype in this ontology.
 DAMLDatatypecreateDatatype(DAMLResource aType)
          Creates a Datatype in this ontology with a generated unique ID, sets the Clases type to the passed in type and adds the Datatype to the ontology.
 DAMLDatatypecreateDatatype(DAMLResource aType, String theID)
          Looks for, and possibilly creates, a Datatype in this ontology.
 voidcreateFromRDF(Model theRDF)
          Builds ontologies from RDF models.
 DAMLLiteralcreateLiteralByValue(DAMLResource aType, String theValue)
          Looks for, and possibilly creates, a Literal in this ontology.
 DAMLPropertycreateProperty()
          Creates a Property in this ontology with a generated unique ID and adds the Property to the ontology.
 DAMLPropertycreateProperty(String theID)
          Looks for, and possibilly creates, a Property in this ontology.
 DAMLPropertycreateProperty(DAMLResource aType)
          Creates a Property in this ontology with a generated unique ID, sets the Clases type to the passed in type and adds the Property to the ontology.
 DAMLPropertycreateProperty(DAMLResource aType, String theID)
          Looks for, and possibilly creates, a Property in this ontology.
 Iteratordatatypes()
          Provides an iterator for the all of the ontology's data types.
 Iteratordatatypes(DAMLResource aType)
          Provides an iterator for only the ontology's data types of the provided type.
 DAMLClassgetClass(Object theID)
          Looks for a Class in this ontology whose ID matches the provided ID.
 CollectiongetClasses(DAMLResource aType)
          Provides a Collection of the ontology's classes of the provided type.
 DAMLDatatypegetDatatype(Object theID)
          Looks for a Datatype in this ontology whose ID matches the provided ID.
 CollectiongetDatatypes(DAMLResource aType)
          Provides a Collection of the ontology's data types of the provided type.
 StringgetID()
          Getter method for the ID of this ontology.
 DAMLOntologygetImport(Object theID)
          Looks for an imported ontology in this ontology whose ID matches the provided ID.
 DAMLOntology[]getImports()
          Accessor for the read only indexed bean property, "imports"
 DAMLLiteralgetLiteral(Object theID)
          Looks for a literal in this ontology whose ID matches the provided ID.
 CollectiongetLiterals(DAMLResource aType)
          Provides a Collection of the ontology's literals of the provided type.
 CollectiongetProperties(DAMLResource aType)
          Provides a Collection of the ontology's properties of the provided type.
 DAMLPropertygetProperty(Object theID)
          Looks for a property in this ontology whose ID matches the provided ID.
 DAMLResourcegetResource(Object theID)
           
 CollectiongetResources(DAMLResource aType)
           
 StringgetSourceURI()
          Getter method for the source URI of this ontology.
 StringgetVersionInfo()
          Getter method for the version information of this ontology.
 Iteratorimports()
          Provides an iterator for the all of the ontology's imports.
 Iteratorliterals()
          Provides an iterator for the all of the ontology's literals.
 Iteratorliterals(DAMLResource aType)
          Provides an iterator for only the ontology's literals of the provided type.
 DAMLClasslookupClass(Object theID)
          Looks for a matching class in this ontology.
 DAMLClasslookupClass(Object theID, boolean pCreate)
          Looks for, and possibilly creates, a Class in this ontology.
 DAMLDatatypelookupDatatype(Object theID)
          Looks for a matching data type in this ontology.
 DAMLDatatypelookupDatatype(Object theID, boolean pCreate)
          Looks for, and possibilly creates, a Datatype in this ontology.
 DAMLOntologylookupImport(Object theID)
          Looks for an imported ontology by ID.
 DAMLLiterallookupLiteral(Object theID)
          Looks for a matching literal in this ontology.
 DAMLPropertylookupProperty(Object theID)
          Looks for a matching property in this ontology.
 DAMLPropertylookupProperty(Object theID, boolean pCreate)
          Looks for, and possibilly creates, a property in this ontology.
 DAMLResourcelookupResource(Object theID)
          Looks for a matching resource in this ontology.
 Iteratorproperties()
          Provides an iterator for the all of the ontology's properties.
 Iteratorproperties(DAMLResource aType)
          Provides an iterator for only the ontology's properties of the provided type.
 voidremoveClass(DAMLClass theClass)
          Removes the provided class from the ontology.
 voidremoveDatatype(DAMLDatatype theDatatype)
          Removes the provided data type from the ontology.
 voidremoveImport(DAMLOntology theImport)
          Removes the provided ontology from the ontology's imports.
 voidremoveLiteral(DAMLLiteral theLiteral)
          Removes the provided literal from the ontology.
 voidremoveProperty(DAMLProperty theProperty)
          Removes the provided property from the ontology.
 Iteratorresources()
           
 Iteratorresources(DAMLResource aType)
           
 voidsetSourceURI(String theURI)
          Setter method for the source URI of this ontology.
 voidsetVersionInfo(String theVersionInfo)
          Setter method for the version information of this ontology.
 ModeltoRDFModel()
          Creates an RDF model from an ontology.

Methods inherited from class edu.unika.aifb.daml.DAMLResourceImpl
addProperty, getComment, getLabel, getLocalName, getNamespace, getOntology, getProperties, getRDFResource, getType, getURI, removeComment, setComment, setLabel, setType

Field Detail

_o

DAMLOntologyImpl _o

damlClasses

Hashtable damlClasses

damlCore

Model damlCore

damlCoreURI

String damlCoreURI

damlDatatypes

Hashtable damlDatatypes

damlImports

Hashtable damlImports

damlLiterals

Hashtable damlLiterals

damlProperties

Hashtable damlProperties

damlResources

Hashtable damlResources
Constructor Detail

DAMLOntologyImpl

public DAMLOntologyImpl(Model damlCore)

DAMLOntologyImpl

public DAMLOntologyImpl(Model theIDresource, String damlCoreURI)

DAMLOntologyImpl

public DAMLOntologyImpl(String theIDresource, Model damlCore)

DAMLOntologyImpl

public DAMLOntologyImpl(Model theIDresource, Model damlCore)
Method Detail

addImport

public void addImport(DAMLOntology theImport)
Adds the provided ontology to the ontology's imports. *
Parameters:
theImport - The ontology to add to the imports.

classes

public Iterator classes()
Provides an iterator for the all of the ontology's classes.
Returns: An iterator over all the ontology's classes.

classes

public Iterator classes(DAMLResource aType)
Provides an iterator for only the ontology's classes of the provided type.
Parameters:
aType - The type of classes to include in the iterator.
Returns: An iterator over some of the ontology's classes.

containsClass

public boolean containsClass(Object theID)
Checks for the existence of a Class in this ontology whose ID matches the provided ID. The class must be in this ontology, not in its imports.
Parameters:
theID - The ID of the sought class.
Returns: true if the class exists in this ontology.

containsDatatype

public boolean containsDatatype(Object theID)
Checks for the existence of a Datatype in this ontology whose ID matches the provided ID. The data type must be in this ontology, not in its imports.
Parameters:
theID - The ID of the sought data type.
Returns: true if the data type exists in this ontology.

containsImport

public boolean containsImport(Object theID)
Looks for an imported ontology in this ontology whose ID matches the provided ID. The ontology must be in this ontologies imports.
Parameters:
theID - The ID of the sought ontology.
Returns: true if the ontology exists in the imports.

containsLiteral

public boolean containsLiteral(Object theID)
Looks for a literal in this ontology whose ID matches the provided ID. The literal must be in this ontology, not in its imports.
Parameters:
theID - The ID of the sought literal.
Returns: true if the literal exists in this ontology.

containsProperty

public boolean containsProperty(Object theID)
Checks for the existence of a property in this ontology whose ID matches the provided ID. The property must be in this ontology, not in its imports.
Parameters:
theID - The ID of the sought property.
Returns: true if the property exists in this ontology.

containsResource

public boolean containsResource(Object theID)
Looks for a resource in this ontology whose ID matches the provided ID. The resource must be in this ontology, not in its imports.
Parameters:
theID - The ID of the sought resource.
Returns: true if the resource exists in this ontology.

createClass

public DAMLClass createClass()
Creates a Class in this ontology with a generated unique ID and adds the Class to the ontology.
Returns: The matching DAML class created, otherwise returns void.

createClass

public DAMLClass createClass(String theID)
Looks for, and possibilly creates, a Class in this ontology. Searches this onlology and all imported ontologies for a class whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists. The class if new is added to the Ontology.
Parameters:
theID - The ID of the new class.
Returns: The matching DAML class if found or created, otherwise returns void.

createClass

public DAMLClass createClass(DAMLResource aType)
Creates a Class in this ontology with a generated unique ID, sets the Classes type to the passed in type and adds the Class to the ontology.
Parameters:
aType - The type of the new class.
Returns: The matching DAML class created, otherwise returns void.

createClass

public DAMLClass createClass(DAMLResource aType, String theID)
Looks for, and possibilly creates, a Class in this ontology. Searches this ontology and all imported ontologies for a class whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists. The class if new is added to the Ontology with the type sets to the passed in type.
Parameters:
aType - The type of the new class.
theID - The ID of the new class.
Returns: The matching DAML class if found or created, otherwise returns void.

createDatatype

public DAMLDatatype createDatatype()
Creates a Datatype in this ontology with a generated unique ID and adds the Datatype to the ontology.
Returns: The matching DAML Datatype created, otherwise returns void.

createDatatype

public DAMLDatatype createDatatype(String theID)
Looks for, and possibilly creates, a Datatype in this ontology. Searches this onlology and all imported ontologies for a Datatype whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists. The Datatype if new is added to the Ontology.
Parameters:
theID - The ID of the new Datatype.
Returns: The matching DAML Datatype if found or created, otherwise returns void.

createDatatype

public DAMLDatatype createDatatype(DAMLResource aType)
Creates a Datatype in this ontology with a generated unique ID, sets the Clases type to the passed in type and adds the Datatype to the ontology.
Parameters:
aType - The type of the new Datatype.
Returns: The matching DAML Datatype created, otherwise returns void.

createDatatype

public DAMLDatatype createDatatype(DAMLResource aType, String theID)
Looks for, and possibilly creates, a Datatype in this ontology. Searches this onlology and all imported ontologies for a Datatype whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists. The Datatype if new is added to the Ontology with the type sets to the passed in type.
Parameters:
aType - The type of the new Datatype.
theID - The ID of the new Datatype.
Returns: The matching DAML Datatype if found or created, otherwise returns void.

createFromRDF

public void createFromRDF(Model theRDF)
Builds ontologies from RDF models. Adds the triples in an RDF model to this ontology.
Parameters:
theRDF - The org.w3c.rdf.model.Model to add the ontology.

createLiteralByValue

public DAMLLiteral createLiteralByValue(DAMLResource aType, String theValue)
Looks for, and possibilly creates, a Literal in this ontology. May create a new instance if none exists and sets its value and type. The Literal if new is added to the Ontology.
Parameters:
aType - The type of the new Literal.
theValue - The value of the new Literal.
Returns: The matching DAML Literal if found or created, otherwise returns void.

createProperty

public DAMLProperty createProperty()
Creates a Property in this ontology with a generated unique ID and adds the Property to the ontology.
Returns: The matching DAML Property created, otherwise returns void.

createProperty

public DAMLProperty createProperty(String theID)
Looks for, and possibilly creates, a Property in this ontology. Searches this onlology and all imported ontologies for a Property whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists. The Property if new is added to the Ontology.
Parameters:
theID - The ID of the new Property.
Returns: The matching DAML Property if found or created, otherwise returns void.

createProperty

public DAMLProperty createProperty(DAMLResource aType)
Creates a Property in this ontology with a generated unique ID, sets the Clases type to the passed in type and adds the Property to the ontology.
Parameters:
aType - The type of the new Property.
Returns: The matching DAML Property created, otherwise returns void.

createProperty

public DAMLProperty createProperty(DAMLResource aType, String theID)
Looks for, and possibilly creates, a Property in this ontology. Searches this onlology and all imported ontologies for a Property whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists. The Property if new is added to the Ontology with the type sets to the passed in type.
Parameters:
aType - The type of the new Property.
theID - The ID of the new Property.
Returns: The matching DAML Property if found or created, otherwise returns void.

datatypes

public Iterator datatypes()
Provides an iterator for the all of the ontology's data types.
Returns: An iterator over all the ontology's data types.

datatypes

public Iterator datatypes(DAMLResource aType)
Provides an iterator for only the ontology's data types of the provided type.
Parameters:
aType - The type of data types to include in the iterator.
Returns: An iterator over some of the ontology's data types.

getClass

public DAMLClass getClass(Object theID)
Looks for a Class in this ontology whose ID matches the provided ID.
Parameters:
theID - The ID of the sought class.
Returns: The matching DAML class if found, otherwise returns void.

getClasses

public Collection getClasses(DAMLResource aType)
Provides a Collection of the ontology's classes of the provided type.
Parameters:
aType - The type of classes to include in the iterator.
Returns: A collection of some of the ontology's classes.

getDatatype

public DAMLDatatype getDatatype(Object theID)
Looks for a Datatype in this ontology whose ID matches the provided ID. Differs from lookupDatatype in that the imports are not searched.
Parameters:
theID - The ID of the sought data type.
Returns: The matching DAML data type if found, otherwise returns void.

getDatatypes

public Collection getDatatypes(DAMLResource aType)
Provides a Collection of the ontology's data types of the provided type.
Parameters:
aType - The type of data types to include in the iterator.
Returns: A collection of some of the ontology's data types.

getID

public String getID()
Getter method for the ID of this ontology. The ID is immutable after creation.
Returns: The ID String.

getImport

public DAMLOntology getImport(Object theID)
Looks for an imported ontology in this ontology whose ID matches the provided ID.
Parameters:
theID - The ID of the sought ontology.
Returns: The matching DAML ontology if found, otherwise returns void.

getImports

public DAMLOntology[] getImports()
Accessor for the read only indexed bean property, "imports"
Returns: The imported ontologies of this resources as an array.

getLiteral

public DAMLLiteral getLiteral(Object theID)
Looks for a literal in this ontology whose ID matches the provided ID. Differs from lookupLiteral in that the imports are not searched.
Parameters:
theID - The ID of the sought literal.
Returns: The matching DAML literal if found, otherwise returns void.

getLiterals

public Collection getLiterals(DAMLResource aType)
Provides a Collection of the ontology's literals of the provided type.
Parameters:
aType - The type of literals to include in the iterator.
Returns: A collection of some of the ontology's literals.

getProperties

public Collection getProperties(DAMLResource aType)
Provides a Collection of the ontology's properties of the provided type.
Parameters:
aType - The type of properties to include in the iterator.
Returns: A collection of some of the ontology's properties.

getProperty

public DAMLProperty getProperty(Object theID)
Looks for a property in this ontology whose ID matches the provided ID. Differs from lookupProperty in that the imports are not searched.
Parameters:
theID - The ID of the sought property.
Returns: The matching DAML property if found, otherwise returns void.

getResource

public DAMLResource getResource(Object theID)

getResources

public Collection getResources(DAMLResource aType)

getSourceURI

public String getSourceURI()
Getter method for the source URI of this ontology.
Returns: The source URI String.

getVersionInfo

public String getVersionInfo()
Getter method for the version information of this ontology.
Returns: The version information String.

imports

public Iterator imports()
Provides an iterator for the all of the ontology's imports. Only this ontology's imports are included.
Returns: An iterator over all the ontology's imports.

literals

public Iterator literals()
Provides an iterator for the all of the ontology's literals.
Returns: An iterator over all the ontology's literals.

literals

public Iterator literals(DAMLResource aType)
Provides an iterator for only the ontology's literals of the provided type.
Parameters:
aType - The type of literals to include in the iterator.
Returns: An iterator over some of the ontology's literals.

lookupClass

public DAMLClass lookupClass(Object theID)
Looks for a matching class in this ontology. Searches this ontology and all imported ontologies for a class whose ID matches the provided ID.
Parameters:
theID - The ID of the sought class.
Returns: The matching DAML class if found, otherwise returns void.

lookupClass

public DAMLClass lookupClass(Object theID, boolean pCreate)
Looks for, and possibilly creates, a Class in this ontology. Searches this onlology and all imported ontologies for a class whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists.
Parameters:
theID - The ID of the sought class.
pCreate - true causes a new instance to be created if no existing match is found. And add it to this ontology.
Returns: The matching DAML class if found or created, otherwise returns void.

lookupDatatype

public DAMLDatatype lookupDatatype(Object theID)
Looks for a matching data type in this ontology. Searches this ontology and all imported ontologies for a data type whose ID matches the provided ID.
Parameters:
theID - The ID of the sought data type.
Returns: The matching DAML data type if found, otherwise returns void.

lookupDatatype

public DAMLDatatype lookupDatatype(Object theID, boolean pCreate)
Looks for, and possibilly creates, a Datatype in this ontology. Searches this onlology and all imported ontologies for a data type whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists.
Parameters:
theID - The ID of the sought data type.
pCreate - true causes a new instance to be created if no existing match is found.
Returns: The matching DAML data type if found or created, otherwise returns void.

lookupImport

public DAMLOntology lookupImport(Object theID)
Looks for an imported ontology by ID. Searches this onlology's imports for an imported ontology whose ID matches the provided ID. Searches NOT in the imports of the imports!
Parameters:
theID - The ID of the sought ontology.
Returns: The matching DAML ontology if found, otherwise returns void.

lookupLiteral

public DAMLLiteral lookupLiteral(Object theID)
Looks for a matching literal in this ontology. Searches this onlology and all imported ontologies for a literal whose ID matches the provided ID.
Parameters:
theID - The ID of the sought literal.
Returns: The matching DAML literal if found, otherwise returns void.

lookupProperty

public DAMLProperty lookupProperty(Object theID)
Looks for a matching property in this ontology. Searches this onlology and all imported ontologies for a property whose ID matches the provided ID.
Parameters:
theID - The ID of the sought property.
Returns: The matching DAML property if found, otherwise returns void.

lookupProperty

public DAMLProperty lookupProperty(Object theID, boolean pCreate)
Looks for, and possibilly creates, a property in this ontology. Searches this onlology and all imported ontologies for a property whose ID matches the provided ID. May create a new instance with the appropriate ID in this ontology if none exists.
Parameters:
theID - The ID of the sought property.
pCreate - true causes a new instance to be created if no existing match is found.
Returns: The matching DAML property if found or created, otherwise returns void.

lookupResource

public DAMLResource lookupResource(Object theID)
Looks for a matching resource in this ontology. Searches this ontology and all imported ontologies for a resource whose ID matches the provided ID. Resources are added an removed only throught the specific class, property, literal mehtods.
Parameters:
theID - The ID of the sought resource.
Returns: The matching DAML resource if found, otherwise returns void.

properties

public Iterator properties()
Provides an iterator for the all of the ontology's properties.
Returns: An iterator over all the ontology's properties

properties

public Iterator properties(DAMLResource aType)
Provides an iterator for only the ontology's properties of the provided type.
Parameters:
aType - The type of properties to include in the iterator.
Returns: An iterator over some of the ontology's properties.

removeClass

public void removeClass(DAMLClass theClass)
Removes the provided class from the ontology.
Parameters:
theClass - The class to remove.

removeDatatype

public void removeDatatype(DAMLDatatype theDatatype)
Removes the provided data type from the ontology.
Parameters:
theDatatype - The data type to remove to the ontology.

removeImport

public void removeImport(DAMLOntology theImport)
Removes the provided ontology from the ontology's imports.
Parameters:
theImport - The ontology to remove from the imports.

removeLiteral

public void removeLiteral(DAMLLiteral theLiteral)
Removes the provided literal from the ontology.
Parameters:
theLiteral - The literal to remove to the ontology.

removeProperty

public void removeProperty(DAMLProperty theProperty)
Removes the provided property from the ontology.
Parameters:
theProperty - The property from remove to the ontology.

resources

public Iterator resources()

resources

public Iterator resources(DAMLResource aType)

setSourceURI

public void setSourceURI(String theURI)
Setter method for the source URI of this ontology.
Parameters:
theURI - The source URI String.

setVersionInfo

public void setVersionInfo(String theVersionInfo)
Setter method for the version information of this ontology.
Parameters:
theVersionInfo - The version information String.

toRDFModel

public Model toRDFModel()
throws java.lang.Exception
Creates an RDF model from an ontology.
Returns: The RDF model.