com.apelon.dts.client.concept
Class BaseOntylogConceptQuery

java.lang.Object
  extended by com.apelon.apelonserver.client.BasicQuery
      extended by com.apelon.dts.client.attribute.QualifierTypeQuery
          extended by com.apelon.dts.client.attribute.PropertyTypeQuery
              extended by com.apelon.dts.client.concept.BaseConceptQuery
                  extended by com.apelon.dts.client.concept.BaseOntylogConceptQuery
Direct Known Subclasses:
NavQuery, OntylogClassQuery, OntylogConceptQuery

public abstract class BaseOntylogConceptQuery
extends BaseConceptQuery

The BaseOntylogConceptQuery class provides access to Ontylog concepts. Ontylog concepts reside in an externally defined namespace, provided by subscription from Apelon, or loaded from a TDE or existing DTS 2.4 database. Concepts in an Ontylog namespace cannot be added or deleted using DTS (TDE must be used for this purpose), but properties and synonyms of concepts may be added, deleted or modified.

Note: Many methods that OntylogConceptQuery inherits from DTSConceptQuery can be regarded as factory methods whose product is an OntylogConcept instead of a DTSConcept. Those methods that return a DTSConcept will in fact return an OntylogConcept when called from OntylogConceptQuery. You will need to cast the returned object to an OntylogConcept in order to use any methods specific to an OntylogConcept. Also of course since OntylogConcept extends DTSConcept, anywhere a DTSConcept is required to pass as an argument, you may and normally would pass an OntylogConcept when invoking the method from OntylogConceptQuery.

Copyright: Copyright (c) 2007

Company: Apelon, Inc.

Since:
DTS 3.0.0
Version:
DTS 3.4.2
Author:
Apelon, Inc.

Field Summary
 
Fields inherited from class com.apelon.dts.client.concept.BaseConceptQuery
conceptListener
 
Fields inherited from class com.apelon.dts.client.attribute.QualifierTypeQuery
kbtypeListener
 
Fields inherited from class com.apelon.apelonserver.client.BasicQuery
ADMIN, queryHeader
 
Method Summary
 boolean addRoleType(DTSRoleType roleType)
          Adds a new Role Type to a writable Ontylog Extension Namespace.
protected  void assertIsNotNull(Object obj, String objName)
          Asserts that the given object is not null.
 boolean deleteRoleType(DTSRoleType roleType)
          Deletes the given Role Type from writable Ontylog Extension Namespace.
 boolean deleteRoleType(DTSRoleType roleType, boolean removeReferencesInRoleTypes)
          Deletes the given Role Type from writable Ontylog Extension Namespace.
 DTSRoleType[] fetchParentReferences(DTSRoleType roleType)
          Fetches the array of children Role Types of the given Role Type.
 DTSRoleType[] fetchRightIdentityReferences(DTSRoleType roleType)
          Fetches the array of Role Types where the given Role type is the Right Identity
 DTSRoleType findRoleTypeByCode(String code, int namespaceId)
          Retrieves the role type with the specified string valued code.
 DTSRoleType findRoleTypeById(int id, int namespaceId)
          Retrieves the role type with the specified ID.
 DTSRoleType findRoleTypeByName(String name, int namespaceId)
          Retrieves the role type with the specified name.
 Kind[] getAllKinds()
          Retrieves all Kinds.
 DTSRoleType[] getAllRoleTypes()
          Retrieves all role types.
 Kind[] getKinds(int namespaceId)
          Retrieves the Kinds for a given namespace.
protected  com.apelon.dts.util.DTSResponse getResponse(com.apelon.dts.util.DTSRequest request)
          Sends in a DTSRequest query object and returns the DTSResponse object from the server
 DTSRoleType[] getRoleTypes(int namespaceId)
          Retrieves all concept role types within a given namespace.
 boolean isRoleTypeUsed(DTSRoleType roleType)
          Determines whether the given Role Type is used in a Role definition.
 boolean updateRoleType(DTSRoleType oldRoleType, DTSRoleType newRoleType)
          Updates the given Role Type in a writable Ontylog Extension Namespace.
 
Methods inherited from class com.apelon.dts.client.concept.BaseConceptQuery
addConceptListener, addProperty, addSynonym, deleteProperty, deleteSynonym, findConceptByCode, findConceptById, findConceptByName, findConceptsByCode, findConceptsById, findConceptsByName, fireConceptAction, getAllConceptPropertyTypes, getConceptListener, getConceptPropertyTypes, getNamespaceQuery, removeConceptListener, updateProperty, updateSynonym
 
Methods inherited from class com.apelon.dts.client.attribute.PropertyTypeQuery
addPropertyType, buildPropertyTypes, deletePropertyType, findPropertyTypeByCode, findPropertyTypeById, findPropertyTypeByName, isPropertyTypeUsed, updatePropertyType
 
Methods inherited from class com.apelon.dts.client.attribute.QualifierTypeQuery
addKBTypeListener, addQualifierType, deleteQualifierType, findQualifierTypeByCode, findQualifierTypeById, findQualifierTypeByName, fireKBTypeAction, getAllConceptAssociationQualifierTypes, getAllConceptPropertyQualifierTypes, getAllQualifierTypes, getAllTermAssociationQualifierTypes, getAllTermPropertyQualifierTypes, getConceptAssociationQualifierTypes, getConceptPropertyQualifierTypes, getKBTypeListener, getTermAssociationQualifierTypes, getTermPropertyQualifierTypes, removeKBTypeListener, updateQualifierType
 
Methods inherited from class com.apelon.apelonserver.client.BasicQuery
executeQuery, executeQueryNoParse, getServerConnection, initializeDtds, initializeDtds, ping, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAllKinds

public Kind[] getAllKinds()
                   throws DTSException
Retrieves all Kinds.

Returns:
An array of all the Kinds. Returns an empty array if there are no Kinds.
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.3.0

getKinds

public Kind[] getKinds(int namespaceId)
                throws DTSException
Retrieves the Kinds for a given namespace.

Parameters:
namespaceId - the ID of the namespace of interest
Returns:
an array of Kinds.
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.3.0

getAllRoleTypes

public DTSRoleType[] getAllRoleTypes()
                              throws DTSException
Retrieves all role types.

Returns:
An array of all the DTSRoleType. Returns an empty array if there are no DTSRoleType.
Throws:
DTSException - if any error occurs in the method

getRoleTypes

public DTSRoleType[] getRoleTypes(int namespaceId)
                           throws DTSException
Retrieves all concept role types within a given namespace.

Parameters:
namespaceId - the ID of the namespace of interest
Returns:
an array of DTSRoleTypes in the namespace. Returns an empty array if there are no concept DTSRoleTypes.
Throws:
DTSException - if any error occurs in the method

findRoleTypeByName

public DTSRoleType findRoleTypeByName(String name,
                                      int namespaceId)
                               throws DTSException
Retrieves the role type with the specified name.

Parameters:
name - the role name of the DTSRoleType to fetch
namespaceId - the ID of the role type's namespace
Returns:
the DTSRoleType, or null if not found
Throws:
DTSException - if any error occurs in the method

findRoleTypeById

public DTSRoleType findRoleTypeById(int id,
                                    int namespaceId)
                             throws DTSException
Retrieves the role type with the specified ID.

Parameters:
id - the role ID of the DTSRoleType to fetch
namespaceId - the ID of the role type's namespace
Returns:
the DTSRoleType, or null if not found
Throws:
DTSException - if any error occurs in the method

findRoleTypeByCode

public DTSRoleType findRoleTypeByCode(String code,
                                      int namespaceId)
                               throws DTSException
Retrieves the role type with the specified string valued code.

Parameters:
code - the role code of the DTSRoleType to fetch
namespaceId - the ID of the role type's namespace
Returns:
the DTSRoleType, or null if not found
Throws:
DTSException - if any error occurs in the method

addRoleType

public boolean addRoleType(DTSRoleType roleType)
                    throws DTSException
Adds a new Role Type to a writable Ontylog Extension Namespace.

The attributes of the Role Type are validated for the conditions described below:

An exception is thrown if any of the conitions specified above is not satisfied.

When Role Type is added succesfully, ID and Code fields of the Role Type parameter are populated. Registered KBTypeListeners are notified through KBTypeEvent about the addition of the new role.

Parameters:
roleType - New Role Type
Returns:
boolean true if the Role Type is added, elsa false.
Throws:
DTSException - For any Error
Since:
DTS 3.4.2

updateRoleType

public boolean updateRoleType(DTSRoleType oldRoleType,
                              DTSRoleType newRoleType)
                       throws DTSException
Updates the given Role Type in a writable Ontylog Extension Namespace. Name, Domain Kind, Range Kind, Right Identity Role Type and Parent Role Type attributes of a Role Type can be updated. If the Role Type is used in a Role definition, only name can be updated. Use isRoleTypeUsed(com.apelon.dts.client.attribute.DTSRoleType) to determine whether the Role Type is used.

The updatable attributes of the Role Type are validated for the conditions described below:

An exception is thrown if any of the conitions specified above is not satisfied.

When Role Type is updated succesfully, ID and Code fields of the Role Type parameter are populated. Registered KBTypeListeners are notified through KBTypeEvent about the update of the existing role.

Parameters:
oldRoleType - Existing Role Type. The ID and Namespace ID from this is used as key for update.
newRoleType - New Role Type with attributes to to update.
Returns:
boolean true if the Role Type is updated, else false.
Throws:
DTSException - For any errors.
Since:
DTS 3.4.2

deleteRoleType

public boolean deleteRoleType(DTSRoleType roleType)
                       throws DTSException
Deletes the given Role Type from writable Ontylog Extension Namespace. If the Role Type is used in a Role definition, an exception is thrown. Use isRoleTypeUsed(com.apelon.dts.client.attribute.DTSRoleType) to determine whether the Role Type is used.

If the Role Type is referenced as Parent or Right Identity in another Role Type, an exception is thrown.

Parameters:
roleType - Role Type to delete. The ID and Namespace ID from this is used as key for delete.
Returns:
boolean true if the Role Type is deleted, else false.
Throws:
DTSException - For any error.
Since:
DTS 3.4.2

deleteRoleType

public boolean deleteRoleType(DTSRoleType roleType,
                              boolean removeReferencesInRoleTypes)
                       throws DTSException
Deletes the given Role Type from writable Ontylog Extension Namespace. If the Role Type is used in a Role definition, an exception is thrown. Use isRoleTypeUsed(com.apelon.dts.client.attribute.DTSRoleType) to determine whether the Role Type is used.

If the Role Type is referenced as Parent or Right Identity in another Role Type, then if removeReferencesInRoleTypes is true, all the references will be removed and the Role Type is deleted. Otherwise if removeReferencesInRoleTypes is false, an exception is thrown.

Parameters:
roleType - Role Type to delete. The ID and Namespace ID from this is used as key for delete.
removeReferencesInRoleTypes - For true, all the references will be removed and the Role Type is deleted. Otherwise Role Type will not be deleted if it is referenced and an exception will be thrown.
Returns:
boolean true if the Role Type is deleted, else false.
Throws:
DTSException - For any error.
Since:
DTS 3.4.2

isRoleTypeUsed

public boolean isRoleTypeUsed(DTSRoleType roleType)
                       throws DTSException
Determines whether the given Role Type is used in a Role definition.

Parameters:
roleType - Role Type to check
Returns:
true if the Role Type is used, else false
Throws:
DTSException - for any error
Since:
DTS 3.4.2
See Also:
updateRoleType(com.apelon.dts.client.attribute.DTSRoleType, com.apelon.dts.client.attribute.DTSRoleType), deleteRoleType(com.apelon.dts.client.attribute.DTSRoleType, boolean)

fetchRightIdentityReferences

public DTSRoleType[] fetchRightIdentityReferences(DTSRoleType roleType)
                                           throws DTSException
Fetches the array of Role Types where the given Role type is the Right Identity

Parameters:
roleType - Role Type
Returns:
the array of Role Types where the given Role type is the Right Identity or empty array
Throws:
DTSException - For any error

fetchParentReferences

public DTSRoleType[] fetchParentReferences(DTSRoleType roleType)
                                    throws DTSException
Fetches the array of children Role Types of the given Role Type.

Parameters:
roleType - Role Type
Returns:
the array of children Role Types of the given Role Type or empty array
Throws:
DTSException - For any error

getResponse

protected com.apelon.dts.util.DTSResponse getResponse(com.apelon.dts.util.DTSRequest request)
                                               throws DTSException
Sends in a DTSRequest query object and returns the DTSResponse object from the server

Parameters:
request - DTSRequest
Returns:
DTSresponse response from server
Throws:
DTSException - Wrapped Exception
Since:
DTS 3.4.2

assertIsNotNull

protected void assertIsNotNull(Object obj,
                               String objName)
Asserts that the given object is not null.

Parameters:
obj - Object to verify
objName - Name of the object. Used in the exception message.
Throws:
IllegalArgumentException - if the given object is null


Copyright © 2011. All Rights Reserved.