com.apelon.dts.client.term
Class BaseTermQuery

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.term.BaseTermQuery
Direct Known Subclasses:
TermQuery, TermSearchQuery

public abstract class BaseTermQuery
extends PropertyTypeQuery

BaseTermQuery is a base class for TermQuery and TermSearchQuery. It supports queries on terms, including their properties.

The following events are fired in this class:

Copyright: Copyright (c) 2003

Company: Apelon, Inc.

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

Field Summary
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
 Term addProperty(Term term, DTSProperty property)
          Adds a property to a term.
 Term addTerm(Term newTerm)
          Adds a new Term to the knowledgebase.
 void addTermListener(TermListener listener)
           
 Term deleteProperty(Term term, DTSProperty property)
          Deletes a property from a term.
 boolean deleteTerm(Term term)
          Deletes a term from the knowledgebase.
 Term fetchProperties(Term term)
          Fetch the properties for the passed Term.
 Term findTermByCode(String termCode, int namespaceId, TermAttributeSetDescriptor termDescriptor)
          Gets a Term object with the specified code and namespace ID.
 Term findTermById(int termId, int namespaceId, TermAttributeSetDescriptor termDescriptor)
          Gets a Term object by passing the ID and a namespace ID.
 Term[] findTermsByName(String termName, int namespaceId, TermAttributeSetDescriptor termDescriptor)
          Gets Term objects with the specified name and namespace ID.
protected  void fireTermAction(TermEvent event)
           
 DTSPropertyType[] getAllTermPropertyTypes()
          Retrieves all term property types.
 TermListener getTermListener()
          Get the TermListener.
 DTSPropertyType[] getTermPropertyTypes(int namespaceId)
          Retrieves all term property types within a given namespace.
 void removeTermListener(TermListener listener)
           
 Term updateProperty(Term term, DTSProperty oldProperty, DTSProperty newProperty)
          Updates a term property.
 Term updateTerm(Term oldTerm, Term newTerm)
          Updates a term in the knowledgebase corresponding to the passed old Term, using the values from the new Term.
 
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
 

Field Detail

termListener

protected transient TermListener termListener
Method Detail

addTerm

public Term addTerm(Term newTerm)
             throws DTSException
Adds a new Term to the knowledgebase.

Parameters:
newTerm - new Term to be added
Returns:
boolean indicator. true if Term succesfully added; false otherwise.
Throws:
DTSException - if any error occurs in the method

deleteTerm

public boolean deleteTerm(Term term)
                   throws DTSException
Deletes a term from the knowledgebase.

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

updateTerm

public Term updateTerm(Term oldTerm,
                       Term newTerm)
                throws DTSException
Updates a term in the knowledgebase corresponding to the passed old Term, using the values from the new Term.

Parameters:
oldTerm - the term to be updated
newTerm - the term as it should look when updated
Returns:
an instance of the updated term added to the server.
Throws:
DTSException - if any error occurs in the method

findTermsByName

public Term[] findTermsByName(String termName,
                              int namespaceId,
                              TermAttributeSetDescriptor termDescriptor)
                       throws DTSException
Gets Term objects with the specified name and namespace ID. Since a term name may not be unique within a namespace, it's possible to have more than one term returned.

Parameters:
termName - the Term name
namespaceId - the Term's namespace ID
termDescriptor - the attribute set descriptor for the term(s)
Returns:
the Terms identified by the specified name and namespace, along with the specified properties, term associations and qualifiers
Throws:
DTSException - if any error occurs in the method

findTermByCode

public Term findTermByCode(String termCode,
                           int namespaceId,
                           TermAttributeSetDescriptor termDescriptor)
                    throws DTSException
Gets a Term object with the specified code and namespace ID. A term code is guaranteed to be unique within a namespace, even if the name is not, so only a single term is returned.

Parameters:
termCode - the Term code
namespaceId - the Term's namespace ID
termDescriptor - the attribute set descriptor for the term(s)
Returns:
the Terms identified by the specified code and namespace, along with the specified properties, term associations and qualifiers
Throws:
DTSException - if any error occurs in the method

findTermById

public Term findTermById(int termId,
                         int namespaceId,
                         TermAttributeSetDescriptor termDescriptor)
                  throws DTSException
Gets a Term object by passing the ID and a namespace ID. A term ID is guaranteed to be unique within a namespace, even if the name is not, so only a single term is returned.

Parameters:
termId - the Term ID
namespaceId - the Term's namespace ID
termDescriptor - the attribute set descriptor for the term(s)
Returns:
the Term identified by the specified ID and namespace, along with the specified properties, term associations and qualifiers
Throws:
DTSException - if any error occurs in the method

addProperty

public Term addProperty(Term term,
                        DTSProperty property)
                 throws DTSException
Adds a property to a term. The property may be a qualified property.

Parameters:
term - the term to which a property will be added
property - the property to add
Returns:
the original Term with the property added
Throws:
DTSException - if any error occurs in the method

deleteProperty

public Term deleteProperty(Term term,
                           DTSProperty property)
                    throws DTSException
Deletes a property from a term.

Parameters:
term - the term from which a property will be deleted
property - the property to delete
Returns:
the original Term with the property deleted
Throws:
DTSException - if any error occurs in the method

updateProperty

public Term updateProperty(Term term,
                           DTSProperty oldProperty,
                           DTSProperty newProperty)
                    throws DTSException
Updates a term property.

Parameters:
term - term for which a property is to be updated
oldProperty - existing property to be updated
newProperty - DTSProperty having updated values
Returns:
the original Term with the property updated
Throws:
DTSException - if any error occurs in the method

fetchProperties

public Term fetchProperties(Term term)
                     throws DTSException
Fetch the properties for the passed Term.

Parameters:
term - the Term to fetch properties for
Returns:
a Term that is the same as the argument Term, except that its properties and any property qualifiers are fetched
Throws:
DTSException - if any error occurs in the method

getAllTermPropertyTypes

public DTSPropertyType[] getAllTermPropertyTypes()
                                          throws DTSException
Retrieves all term property types.

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

getTermPropertyTypes

public DTSPropertyType[] getTermPropertyTypes(int namespaceId)
                                       throws DTSException
Retrieves all term property types within a given namespace.

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

fireTermAction

protected void fireTermAction(TermEvent event)

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 Query which extends from BaseTermQuery.

Returns:
TermListener

addTermListener

public void addTermListener(TermListener listener)

removeTermListener

public void removeTermListener(TermListener listener)


Copyright © 2011. All Rights Reserved.