com.apelon.dts.client.association
Class AssociationQuery

java.lang.Object
  extended by com.apelon.apelonserver.client.BasicQuery
      extended by com.apelon.dts.client.attribute.QualifierTypeQuery
          extended by com.apelon.dts.client.association.AssociationQuery

public abstract class AssociationQuery
extends QualifierTypeQuery

AssociationQuery provides common methods for maintaining associations and association types. For synonym associations, use the DTSConceptQuery class.

The following events are fired in this class:

If you have two instances of AssociationQuery and you would like to share the listeners between them, then you can code something like this.
 AssociationQuery aq1 = null;
 AssociationQuery aq2 = null;

 // Initialization code for aq1 and aq2

 aq2.addConceptListener(aq1.getConceptListener());
 aq2.addTermListener(aq1.getTermListener());
 aq2.addKBTypeListener(aq1.getKBTypeListener());
 // Now any event from aq2 will be available to aq1 listeners
 

Copyright: Copyright (c) 2003

Company: Apelon, Inc.

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

Field Summary
protected  ConceptListener conceptListener
           
protected  TermListener termListener
           
 
Fields inherited from class com.apelon.dts.client.attribute.QualifierTypeQuery
kbtypeListener
 
Fields inherited from class com.apelon.apelonserver.client.BasicQuery
ADMIN, queryHeader
 
Method Summary
 AssociationType addAssociationType(AssociationType assocType)
          Adds an association type to the knowledgebase by passing an AssociationType object.
 boolean addConceptAssociation(ConceptAssociation newConceptAssociation)
          Adds a concept association to the knowledgebase.
 void addConceptListener(ConceptListener listener)
           
 boolean addTermAssociation(TermAssociation newTermAssociation)
          Adds a term association to the knowledgebase.
 void addTermListener(TermListener listener)
           
static AssociationQuery createInstance(ServerConnection sc)
          Creates an instance of AssociationQuery.
static AssociationQuery createInstance(ServerConnection sc, boolean isValidating)
          Creates an instance of AssociationQuery.
 boolean deleteAssociationType(AssociationType assocType)
          Deletes the specified association type.
 boolean deleteConceptAssociation(ConceptAssociation conceptAssociation)
          Deletes a concept association from the knowledgebase.
 boolean deleteTermAssociation(TermAssociation termAssociation)
          Deletes a term association.
 AssociationType findAssociationTypeByCode(String code, int namespaceID)
          Retrieves the AssociationType type with the specified code and namespace ID.
 AssociationType findAssociationTypeById(int assocId, int namespaceID)
          Retrieves the AssociationType with the specified ID and namespace ID.
 AssociationType findAssociationTypeByName(String assocName, int namespaceID)
          Retrieves the AssociationType with the specified name and namespace ID.
protected  void fireConceptAssociationAction(ConceptEvent event)
           
protected  void fireTermAssociationAction(TermEvent event)
           
 AssociationType[] getAllAssociationTypes()
          Retrieves all association types known in the knowledgebase.
 AssociationType[] getAllConceptAssociationTypes()
          Retrieves all concept association types.
 AssociationType[] getAllSynonymTypes()
          Retrieves all synonym types.
 AssociationType[] getAllTermAssociationTypes()
          Retrieves all term association types.
 AssociationType[] getConceptAssociationTypes(int namespaceId)
          Retrieves all concept association types in a namespace.
 ConceptListener getConceptListener()
          Get the ConceptListener.
 AssociationType[] getSynonymTypes(int namespaceId)
          Retrieves all synonym association types within a given namespace.
 AssociationType[] getTermAssociationTypes(int namespaceId)
          Retrieves all term association types in a namespace.
 TermListener getTermListener()
          Get the TermListener.
 boolean isAssociationTypeUsed(AssociationType assocType)
          Returns whether an association type is used in an association definition or not.
 void removeConceptListener(ConceptListener listener)
           
 void removeTermListener(TermListener listener)
           
 AssociationType updateAssociationType(AssociationType oldAssocType, AssociationType newAssocType)
          Updates an association type in the knowledgebase corresponding to an old AssociationType to values from a new AssociationType.
 boolean updateConceptAssociation(ConceptAssociation oldConceptAssociation, ConceptAssociation newConceptAssociation)
          Updates a concept association by passing the original association and a second one representing the updated values.
 boolean updateTermAssociation(TermAssociation oldTermAssociation, TermAssociation newTermAssociation)
          Updates a term association by passing the original association and a second one representing the updated values.
 
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
 

Field Detail

conceptListener

protected transient ConceptListener conceptListener

termListener

protected transient TermListener termListener
Method Detail

getAllAssociationTypes

public AssociationType[] getAllAssociationTypes()
                                         throws DTSException
Retrieves all association types known in the knowledgebase.

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

getAllConceptAssociationTypes

public AssociationType[] getAllConceptAssociationTypes()
                                                throws DTSException
Retrieves all concept association types.

Returns:
an array of all the concept AssociationTypes. Returns an empty array if there are no concept AssociationTypes.
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.0.0

getConceptAssociationTypes

public AssociationType[] getConceptAssociationTypes(int namespaceId)
                                             throws DTSException
Retrieves all concept association types in a namespace.

Parameters:
namespaceId - desired namespace ID of association types
Returns:
an array of all the concept AssociationTypes in that namespace. Returns an empty array if there are no concept AssociationTypes.
Throws:
DTSException - if any error occurs in the method

getAllTermAssociationTypes

public AssociationType[] getAllTermAssociationTypes()
                                             throws DTSException
Retrieves all term association types.

Returns:
an array of all the term AssociationTypes. Returns an empty array if there are no term AssociationTypes.
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.0.0

getTermAssociationTypes

public AssociationType[] getTermAssociationTypes(int namespaceId)
                                          throws DTSException
Retrieves all term association types in a namespace.

Parameters:
namespaceId - desired namespace ID of association types
Returns:
an array of all the term AssociationTypes in that namespace. Returns an empty array if there are no term AssociationTypes.
Throws:
DTSException - if any error occurs in the method

getAllSynonymTypes

public AssociationType[] getAllSynonymTypes()
                                     throws DTSException
Retrieves all synonym types.

Returns:
an array of all the synonym AssociationTypes. Returns an empty array if there are no synonym AssociationTypes.
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.0.0

getSynonymTypes

public AssociationType[] getSynonymTypes(int namespaceId)
                                  throws DTSException
Retrieves all synonym association types within a given namespace.

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

addAssociationType

public AssociationType addAssociationType(AssociationType assocType)
                                   throws DTSException
Adds an association type to the knowledgebase by passing an AssociationType object.

Parameters:
assocType - an association type which is added
Returns:
the fully populated instance of the added association type.
Throws:
DTSException - if any error occurs in the method

findAssociationTypeByName

public AssociationType findAssociationTypeByName(String assocName,
                                                 int namespaceID)
                                          throws DTSException
Retrieves the AssociationType with the specified name and namespace ID.

Parameters:
assocName - the name of the AssociationType to fetch
namespaceID - the AssociationType's namespace ID
Returns:
the AssociationType, or null if not found
Throws:
DTSException - if any error occurs in the method

findAssociationTypeById

public AssociationType findAssociationTypeById(int assocId,
                                               int namespaceID)
                                        throws DTSException
Retrieves the AssociationType with the specified ID and namespace ID.

Parameters:
assocId - the ID of the AssociationType to fetch
namespaceID - the AssociationType's namespace ID
Returns:
the AssociationType, or null if not found
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.0.0

findAssociationTypeByCode

public AssociationType findAssociationTypeByCode(String code,
                                                 int namespaceID)
                                          throws DTSException
Retrieves the AssociationType type with the specified code and namespace ID.

Parameters:
code - the code of the AssociationType to fetch
namespaceID - the AssociationType's namespace ID
Returns:
the AssociationType, or null if not found
Throws:
DTSException - if any error occurs in the method
Since:
DTS 3.0.0

isAssociationTypeUsed

public boolean isAssociationTypeUsed(AssociationType assocType)
                              throws DTSException
Returns whether an association type is used in an association definition or not.

Parameters:
assocType - Association Type
Returns:
true if the Association Type is used in association defintion else false.
Throws:
DTSException - for any error while executing request
Since:
3.4.0

updateAssociationType

public AssociationType updateAssociationType(AssociationType oldAssocType,
                                             AssociationType newAssocType)
                                      throws DTSException
Updates an association type in the knowledgebase corresponding to an old AssociationType to values from a new AssociationType.

Parameters:
oldAssocType - the AssociationType to be update
newAssocType - an AssociationType containing the new values
Returns:
true if the update is successful; false otherwise
Throws:
DTSException - if any error occurs in the method

deleteAssociationType

public boolean deleteAssociationType(AssociationType assocType)
                              throws DTSException
Deletes the specified association type. This can only be done on a namespace with read/write access where there are no associations of this type.

Parameters:
assocType - association type to be deleted
Returns:
true if the association is deleted succesfully; otherwise false.
Throws:
DTSException - if any error occurs in the method

addConceptAssociation

public boolean addConceptAssociation(ConceptAssociation newConceptAssociation)
                              throws DTSException
Adds a concept association to the knowledgebase. The concept association may be one with a qualifier. The namespace of the concept association is determined by the namespace of the AssociationType of the ConceptAssociation.

Parameters:
newConceptAssociation - the new concept association
Returns:
true if the concept association is added succesfully; otherwise false.
Throws:
DTSException - if any error occurs in the method

addTermAssociation

public boolean addTermAssociation(TermAssociation newTermAssociation)
                           throws DTSException
Adds a term association to the knowledgebase. The term association may be one with a qualifier. The namespace of the term association is determined by the namespace of the AssociationType.

Parameters:
newTermAssociation - the new term association
Returns:
true if the term association is added successfully; otherwise false.
Throws:
DTSException - if any error occurs in the method

updateConceptAssociation

public boolean updateConceptAssociation(ConceptAssociation oldConceptAssociation,
                                        ConceptAssociation newConceptAssociation)
                                 throws DTSException
Updates a concept association by passing the original association and a second one representing the updated values. Either one may be a qualified concept association.

Parameters:
oldConceptAssociation - the original concept association
newConceptAssociation - the updated concept association
Returns:
true if the update is successful; false otherwise
Throws:
DTSException - if any error occurs in the method

updateTermAssociation

public boolean updateTermAssociation(TermAssociation oldTermAssociation,
                                     TermAssociation newTermAssociation)
                              throws DTSException
Updates a term association by passing the original association and a second one representing the updated values. Either one may be a qualified term association.

Parameters:
oldTermAssociation - the original term association
newTermAssociation - the updated term association
Returns:
true if the update is successful; false otherwise
Throws:
DTSException - if any error occurs in the method

deleteConceptAssociation

public boolean deleteConceptAssociation(ConceptAssociation conceptAssociation)
                                 throws DTSException
Deletes a concept association from the knowledgebase.

Parameters:
conceptAssociation - the concept association to delete
Returns:
true if the association between the two concepts is deleted succesfully; otherwise false.
Throws:
DTSException - if any error occurs in the method

deleteTermAssociation

public boolean deleteTermAssociation(TermAssociation termAssociation)
                              throws DTSException
Deletes a term association.

Parameters:
termAssociation - the term association to delete
Returns:
true if the term association is deleted succesfully; otherwise return false.
Throws:
DTSException - if any error occurs in the method

createInstance

public static AssociationQuery createInstance(ServerConnection sc)
                                       throws IllegalArgumentException
Creates an instance of AssociationQuery.
Depending on the type of ServerConnection object passed in the argument, the server may be local(JDBC), socket, or another implementation.

Parameters:
sc - the type of server connection
Returns:
the created AssociationQuery
Throws:
IllegalArgumentException - if a null server connection is passed
See Also:
ServerConnectionJDBC, ServerConnectionSocket

createInstance

public static AssociationQuery createInstance(ServerConnection sc,
                                              boolean isValidating)
                                       throws IllegalArgumentException
Creates an instance of AssociationQuery.
Depending on the type of ServerConnection object passed in the argument, the server may be local(JDBC), socket, or another implementation.
The second argument is a boolean value for XML validation.

Parameters:
sc - the type of server connection
isValidating - true if XML needs to be validated; otherwise it is false.
Returns:
the created AssociationQuery
Throws:
IllegalArgumentException - if a null server connection is passed
See Also:
ServerConnectionJDBC, ServerConnectionSocket

fireConceptAssociationAction

protected void fireConceptAssociationAction(ConceptEvent event)

fireTermAssociationAction

protected void fireTermAssociationAction(TermEvent event)

getConceptListener

public ConceptListener getConceptListener()
Get the ConceptListener. This can be used to link the chain of concept listeners of this class to concept listener of another instance of AssociationQuery.

Returns:
ConceptListener

getTermListener

public TermListener getTermListener()
Get the TermListener. This can be used to link the chain of term listeners of this class to term listener of another instance of AssociationQuery.

Returns:
TermListener

addConceptListener

public void addConceptListener(ConceptListener listener)

addTermListener

public void addTermListener(TermListener listener)

removeConceptListener

public void removeConceptListener(ConceptListener listener)

removeTermListener

public void removeTermListener(TermListener listener)


Copyright © 2011. All Rights Reserved.