vub.starlab.ontoserver.database
Class DatabaseAPI

java.lang.Object
  |
  +--vub.starlab.ontoserver.database.DatabaseAPI
All Implemented Interfaces:
IDatabaseAPI, IDatabaseInsertionAPI, IDatabaseRetrievalAPI

public class DatabaseAPI
extends java.lang.Object
implements IDatabaseInsertionAPI, IDatabaseRetrievalAPI


Constructor Summary
DatabaseAPI()
           
DatabaseAPI(java.lang.String DriverName, java.lang.String URL)
           
 
Method Summary
 int addConcept(java.lang.String description, java.lang.String sourceName, java.lang.String key)
          Method adds a new concept to the ontology
 void addContextInOntology(java.lang.String ContextLabel, int ConceptId, java.lang.String OntoName)
          This method adds a new context in an existing ontology.
 void addContextInOntology(java.lang.String ContextLabel, java.lang.String ConceptDescription, java.lang.String SourceName, java.lang.String Key, java.lang.String OntoName)
           
 void addLexonInContext(java.lang.String TermLabel1, java.lang.String TermLabel2, java.lang.String Role, java.lang.String Context, java.lang.String OntoName)
          This method adds a (term - relation - term) triple in an existing context in an existing ontology.
 void addOntology(java.lang.String OntologyName, java.lang.String ContributorUserName, java.lang.String OwnerUserName, java.lang.String Status, java.lang.String Documentation)
          This method adds a new ontology.
 void addTermInContext(java.lang.String TermLabel, int ConceptId, java.lang.String Context, java.lang.String OntoName)
          This method adds a term in an existing context in an existing ontology.
 void addTermInContext(java.lang.String TermLabel, java.lang.String ConceptDescription, java.lang.String ConceptSourceName, java.lang.String Key, java.lang.String Context, java.lang.String OntoName)
           
 void addUserAccount(java.lang.String UserName, java.lang.String Name, java.lang.String Email, java.lang.String PassWord, boolean Administrator, java.lang.String Affiliation)
          This method adds a new user
 void addVersion(java.lang.String OntoName, java.lang.String CreatedDate, java.lang.String Documentation, java.lang.String CreatorUserName, java.lang.String VersionLabel)
          This method adds a new version.
 void closeConnection()
          This method is called when all database operations are finished, and a connection to the database is not longer required.
 void establishConnection()
           
 void establishConnection(java.lang.String DriverName, java.lang.String URL)
          This method should be called before calling any other method of this interface.
 IContext getContextDetail(java.lang.String ontologyName, java.lang.String contextIdentifyingTerm)
          This method returns the details associated with a context.
 OntologyObjectCollection getContexts(java.lang.String ontologyName)
          This method retrieves all contexts for a stored ontology present the ontology server.
 OntologyObjectCollection getLexons(java.lang.String ontologyName, java.lang.String contextIdentifyingTerm)
          This method retrieves all lexons for a context within a stored ontology As parameters, the ontology name and the context name for which you want to retrieve the lexons are required.
 OntologyObjectCollection getOntologies()
          This method retrieves all ontologies currently stored in the ontology server.
 IOntology getOntologyDetail(java.lang.String ontoName)
          This method returns the details associated with an ontology.
 ITerm getTermDetail(java.lang.String ontologyName, java.lang.String contextIdentifyingTerm, java.lang.String term)
          This method returns the details associated with a term.
 OntologyObjectCollection getTerms(java.lang.String ontologyName, java.lang.String contextIdentifyingTerm)
          This method retrieves all terms for a context withing a stored ontology present the ontology server.
 IUser getUserDetail(java.lang.String userName)
          This method returns the details associated with a user.
 OntologyObjectCollection getUsers()
          This method retrieves all users currently registered in the ontology server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseAPI

public DatabaseAPI()

DatabaseAPI

public DatabaseAPI(java.lang.String DriverName,
                   java.lang.String URL)
Method Detail

establishConnection

public void establishConnection(java.lang.String DriverName,
                                java.lang.String URL)
Description copied from interface: IDatabaseAPI
This method should be called before calling any other method of this interface. It opens de connection to the database. Method expects as parameters the driver that should be used to establish the connection, and an URL, which is a java conventional string consisting of jdbc:<subprotocol >:<subname>, mostly this URL is suplied by the driver vendor. As an example, the URL could be "jdbc:odbc:name_of_datasource".
Specified by:
establishConnection in interface IDatabaseAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseAPI
Parameters:
DriverName - the name of the driver, for example, when using the jdbc-odbc bridge, this DriverName would be "sun.jdbc.odbc.JdbcOdbcDriver"
URL - a java conventional string consisting of jdbc:<subprotocol >:<subname>, mostly this URL is suplied by the driver, for example, when using the jdbc-odbc bridge, this URL would be "jdbc:odbc:name_of_datasource"
See Also:
IDatabaseAPI.closeConnection()

closeConnection

public void closeConnection()
Description copied from interface: IDatabaseAPI
This method is called when all database operations are finished, and a connection to the database is not longer required. Java.sql.* junk is cleaned up before exiting.
Specified by:
closeConnection in interface IDatabaseAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseAPI
See Also:
IDatabaseAPI.establishConnection(String, String)

addUserAccount

public void addUserAccount(java.lang.String UserName,
                           java.lang.String Name,
                           java.lang.String Email,
                           java.lang.String PassWord,
                           boolean Administrator,
                           java.lang.String Affiliation)
                    throws UserAccountAlreadyExistsException
Description copied from interface: IDatabaseInsertionAPI
This method adds a new user
Specified by:
addUserAccount in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
UserName - the username for the new user
Name - the name for the new user
Email - the email adres for the new user
PassWord - the password for the new user
Administrator - denoting if the user does or does not have administrator access
Affiliation - the affiliation for the new user
Throws:
UserAccountAlreadyExistsException - exception is thrown when the user already exists

addContextInOntology

public void addContextInOntology(java.lang.String ContextLabel,
                                 java.lang.String ConceptDescription,
                                 java.lang.String SourceName,
                                 java.lang.String Key,
                                 java.lang.String OntoName)
                          throws ContextAlreadyExistsException

addContextInOntology

public void addContextInOntology(java.lang.String ContextLabel,
                                 int ConceptId,
                                 java.lang.String OntoName)
                          throws ContextAlreadyExistsException
Description copied from interface: IDatabaseInsertionAPI
This method adds a new context in an existing ontology. (the context is also added in the meta-context for this ontology)
Specified by:
addContextInOntology in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
ContextLabel - the name for the new context
ConceptId - the id of the concept which is associated with the term specifying the ontology
OntoName - the name for the ontology
Throws:
ContextAlreadyExistsException - exception is thrown when the context was already present in the ontology

addConcept

public int addConcept(java.lang.String description,
                      java.lang.String sourceName,
                      java.lang.String key)
Description copied from interface: IDatabaseInsertionAPI
Method adds a new concept to the ontology
Specified by:
addConcept in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
description - the description for the concept
sourceName - the name of the source where the concept originates from
key - an identification of the key which was used for the description, which should give a hint on how the description parameter should be interpreted
Returns:
int the Id for the concept which you just added
See Also:

addTermInContext

public void addTermInContext(java.lang.String TermLabel,
                             int ConceptId,
                             java.lang.String Context,
                             java.lang.String OntoName)
                      throws ContextNotFoundException
Description copied from interface: IDatabaseInsertionAPI
This method adds a term in an existing context in an existing ontology. If the Context is not found within that ontology, an exception is thrown.
Specified by:
addTermInContext in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
TermLabel - the name of the term you want to add
ConceptId - the id of the concept which is associated with the term you want to add
Context - the name for the context in which you want to add the term
OntoName - the name for the ontology
Returns:
 
Throws:
-  
See Also:

addTermInContext

public void addTermInContext(java.lang.String TermLabel,
                             java.lang.String ConceptDescription,
                             java.lang.String ConceptSourceName,
                             java.lang.String Key,
                             java.lang.String Context,
                             java.lang.String OntoName)
                      throws ContextNotFoundException

addLexonInContext

public void addLexonInContext(java.lang.String TermLabel1,
                              java.lang.String TermLabel2,
                              java.lang.String Role,
                              java.lang.String Context,
                              java.lang.String OntoName)
                       throws ContextNotFoundException
Description copied from interface: IDatabaseInsertionAPI
This method adds a (term - relation - term) triple in an existing context in an existing ontology. If the context is not found within that ontology, an exception is thrown. Note that the error mechanisme is not yet fully implemented, a OntologyNotFoundException should also be thrown here one day
Specified by:
addLexonInContext in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
TermLabel1 - the label of the first term in the lexon triple
TermLabel2 - the label of the second term in the lexon triple
Role - the rolename for the lexon triple
Context - the name of the context in which you want to add the triple
OntoName - the name of the ontology
Throws:
ContextNotFoundException - exception thrown when the context in which you want to insert is not found

addOntology

public void addOntology(java.lang.String OntologyName,
                        java.lang.String ContributorUserName,
                        java.lang.String OwnerUserName,
                        java.lang.String Status,
                        java.lang.String Documentation)
                 throws OntologyAlreadyExistsException
Description copied from interface: IDatabaseInsertionAPI
This method adds a new ontology. Note that the addOntology method also adds a meta-context for this ontology (a context with contextlabel "Context")
Specified by:
addOntology in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
OntologyName - the name for the new ontology
ContributorUserName - the username of the person who contributed the ontology
OwnerUserName - the username of the owner of this ontology
Status - the status of the new ontology
Documentation - some documentation for the new ontology
Throws:
OntologyAlreadyExistsException - exception thrown when the ontology already exists

addVersion

public void addVersion(java.lang.String OntoName,
                       java.lang.String CreatedDate,
                       java.lang.String Documentation,
                       java.lang.String CreatorUserName,
                       java.lang.String VersionLabel)
                throws VersionAlreadyExistsException
Description copied from interface: IDatabaseInsertionAPI
This method adds a new version. There is no version management yet, this method just assigns a new version every time it is called.
Specified by:
addVersion in interface IDatabaseInsertionAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseInsertionAPI
Parameters:
OntoName - the name of the ontology for which you want to add a version
CreatedDate - the date from this version
Documentation - documentation which may be supplied
CreatorUserName - the username of the user creating this new version
VersionLabel - the label for the version
Throws:
VersionAlreadyExistsException - cannot occur yet, as there is no version management in the current version

establishConnection

public void establishConnection()

getOntologies

public OntologyObjectCollection getOntologies()
Description copied from interface: IDatabaseRetrievalAPI
This method retrieves all ontologies currently stored in the ontology server. The method returns an OntologyObjectCollection, which in its turn contains objects implementing the IOntology interface: objects retrieved from the OntologyObjectCollection must be casted to the IOntology type
Specified by:
getOntologies in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Returns:
OntologyObjectCollection a collection designed to contain object implementing the IOntologyObject interface
See Also:
OntologyObjectCollection, OntologyObjectIterator, OntologyCollectionIterator, IOntology

getOntologyDetail

public IOntology getOntologyDetail(java.lang.String ontoName)
                            throws OntologyNotFoundException
Description copied from interface: IDatabaseRetrievalAPI
This method returns the details associated with an ontology. The return object implements the IOntology interface, and contains the ontology details. This method expects as parameters an ontology name, the ontology for which you want the details. If the ontology is not found, an OntologyNotFoundException is returned.
Specified by:
getOntologyDetail in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
ontoName - the name of the ontology for which you want the details
Returns:
IOntology an object implementing the IOntology interface
Throws:
OntologyNotFoundException - exception thrown when the ontology is not found
See Also:
IOntology, OntologyNotFoundException

getUsers

public OntologyObjectCollection getUsers()
Description copied from interface: IDatabaseRetrievalAPI
This method retrieves all users currently registered in the ontology server. The method returns an OntologyObjectCollection, which in its turn contains objects implementing the IUser interface: objects retrieved from the OntologyObjectCollection must be casted to the IUser type
Specified by:
getUsers in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Returns:
OntologyObjectCollection a collection designed to contain object implementing the IOntologyObject interface
See Also:
OntologyObjectCollection, OntologyObjectIterator, UserCollectionIterator, IUser

getUserDetail

public IUser getUserDetail(java.lang.String userName)
                    throws UserNotFoundException
Description copied from interface: IDatabaseRetrievalAPI
This method returns the details associated with a user. The return object implements the IUser interface, and contains the user details. This method expects as a parameter a username, the username for the person you want the details from. If the user is not found, an UserNotFoundException is returned.
Specified by:
getUserDetail in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
userName - the username for which you want the details
Returns:
IUser an object implementing the IUser interface
Throws:
UserNotFoundException - exception thrown when the user is not found
See Also:
IUser, UserNotFoundException

getContexts

public OntologyObjectCollection getContexts(java.lang.String ontologyName)
Description copied from interface: IDatabaseRetrievalAPI
This method retrieves all contexts for a stored ontology present the ontology server. As parameters, the ontology name for which you want retrieve its contexts is required. The method returns an OntologyObjectCollection, which in its turn contains objects implementing the IContext interface: objects retrieved from the OntologyObjectCollection must be casted to the IContext type
Specified by:
getContexts in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
ontologyName - the name of the ontology for which you want the contexts
Returns:
OntologyObjectCollection a collection designed to contain object implementing the IOntologyObject interface
See Also:
OntologyObjectCollection, OntologyObjectIterator, ContextCollectionIterator, IContext

getContextDetail

public IContext getContextDetail(java.lang.String ontologyName,
                                 java.lang.String contextIdentifyingTerm)
                          throws ContextNotFoundException
Description copied from interface: IDatabaseRetrievalAPI
This method returns the details associated with a context. The return object implements the IContext interface, and contains the context details. This method expects as parameters an ontology name and the context name for which you want the details. If the context is not found, an ContextNotFoundException is returned.
Specified by:
getContextDetail in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
userName - the username for which you want the details
Returns:
IContext an object implementing the IContext interface
Throws:
ContextNotFoundException - exception thrown when the context is not found
See Also:
IContext, ContextNotFoundException

getLexons

public OntologyObjectCollection getLexons(java.lang.String ontologyName,
                                          java.lang.String contextIdentifyingTerm)
                                   throws ContextNotFoundException
Description copied from interface: IDatabaseRetrievalAPI
This method retrieves all lexons for a context within a stored ontology As parameters, the ontology name and the context name for which you want to retrieve the lexons are required. The method returns an OntologyObjectCollection, which in its turn contains objects implementing the ILexon interface: objects retrieved from the OntologyObjectCollection must be casted to the ILexon type
Specified by:
getLexons in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
ontologyName - the name of the ontology
contextIdentifyingTerm - the name of the context
Returns:
OntologyObjectCollection a collection designed to contain object implementing the IOntologyObject interface
See Also:
OntologyObjectCollection, OntologyObjectIterator, LexonCollectionIterator, ILexon

getTerms

public OntologyObjectCollection getTerms(java.lang.String ontologyName,
                                         java.lang.String contextIdentifyingTerm)
                                  throws ContextNotFoundException
Description copied from interface: IDatabaseRetrievalAPI
This method retrieves all terms for a context withing a stored ontology present the ontology server. As parameters, the ontology name and a context are required for which you want to retrieve the terms are required. The method returns an OntologyObjectCollection, which in its turn contains objects implementing the IContext interface: objects retrieved from the OntologyObjectCollection must be casted to the ITerm type
Specified by:
getTerms in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
ontologyName - the name of the ontology for which you want the contexts
contextIdentifyingTerm - the name of the term specifying the context
Returns:
OntologyObjectCollection a collection designed to contain object implementing the IOntologyObject interface
See Also:
OntologyObjectCollection, OntologyObjectIterator, TermCollectionIterator, ITerm

getTermDetail

public ITerm getTermDetail(java.lang.String ontologyName,
                           java.lang.String contextIdentifyingTerm,
                           java.lang.String term)
                    throws ContextNotFoundException,
                           TermNotFoundException
Description copied from interface: IDatabaseRetrievalAPI
This method returns the details associated with a term. The return object implements the ITerm interface, and contains the term details. This method expects as parameters an ontology name, a term identifying the context within this ontology, and the term for which you want to retrieve the details. If the context is not found within this ontology, a ContextNotFoundException is returned. NOTE: error throwing is not yet fully implemented here
Specified by:
getTermDetail in interface IDatabaseRetrievalAPI
Following copied from interface: vub.starlab.ontoserver.database.IDatabaseRetrievalAPI
Parameters:
ontologyName - the name of the ontology for which you want the contexts
contextIdentifyingTerm - the name of the term specifying the context
term - the term for which you want to retrieve the details
Returns:
IContext an object implementing the IContext interface
Throws:
ContextNotFoundException - exception thrown when the context is not found
ContextNotFoundException - exception thrown when the term is not found
See Also:
ITerm, ContextNotFoundException, TermNotFoundException