|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.apelon.apelonserver.client.BasicQuery com.apelon.dts.client.subset.SubsetQuery
public abstract class SubsetQuery
Provides subset related query and edit methods.
Requests related to navigation of a subset hierarchy are provided in
NavQuery
.
Requests for searching against concepts in a subset are provided in
SearchQuery
.
A SubsetEvent
is generated for the following actions:
SubsetQuery sq1 = null; SubsetQuery sq2 = null; // Initialization code for sq1 and sq2 sq2.addSubsetListener(sq1.getSubsetListener()); // Now any event from sq2 will be available to sq1 listeners
Copyright: Copyright (c) 2005
Company: Apelon, Inc.
Field Summary |
---|
Fields inherited from class com.apelon.apelonserver.client.BasicQuery |
---|
ADMIN, queryHeader |
Constructor Summary | |
---|---|
protected |
SubsetQuery()
|
protected |
SubsetQuery(boolean isValidating)
|
Method Summary | |
---|---|
Subset |
add(Subset subset)
Adds a Subset to the knowledgebase. |
void |
addSubsetListener(SubsetListener sl)
Adds the given SubsetListener if it is not already added. |
boolean |
build(int subsetId)
Computes the concepts for a subset. |
static SubsetQuery |
createInstance(ServerConnection sc)
|
static SubsetQuery |
createInstance(ServerConnection sc,
boolean isValidating)
|
boolean |
delete(int subsetId)
Deletes a Subset based on its id. |
boolean |
export(int subsetId,
int namespaceId,
long requestId)
Exports a Subset to the given namespace. |
void |
exportSubsetExpression(int subsetId,
Writer out)
Exports a subset expression to a given output stream. |
Subset |
fetch(int subsetId)
Returns a subset matching the given subset id. |
Subset |
fetch(String subsetName)
Returns a subset matching the given subset name. |
int |
fetchConceptCount(Subset subset)
Returns the number of concepts in a given Subset . |
DTSConcept[] |
fetchConcepts(int subsetId)
Returns a list of DTSConcept for a given Subset . |
DTSConcept[] |
fetchConcepts(int subsetId,
ConceptAttributeSetDescriptor casd)
Returns a list of DTSConcept for a given Subset . |
Subset[] |
fetchConceptSubsets(int conceptId,
int conceptNamespaceId)
Retrieves the list of subsets which contain the given concept. |
int[] |
fetchNamespaces(int subsetId)
Returns a single element array containing the namespace id linked to the subset. |
DTSConcept[] |
fetchPreview(PreviewOptions options)
Fetches concepts from the subset when PreviewOptions.FULL is specified. |
Subset[] |
find(DataTypeFilter filter,
SubsetDescriptor descriptor)
Retrieves subsets based on the DataTypeFilter . |
Subset[] |
findAll(SubsetDescriptor descriptor)
Retrieves all subsets. |
protected void |
fireSubsetEvent(SubsetEvent se)
|
SubsetListener |
getSubsetListener()
Get the SubsetListener. |
void |
importSubsetExpression(int subsetId,
Reader in)
Imports a subset expression from a given input stream to the subset provided by the user. |
void |
removeSubsetListener(SubsetListener sl)
Removes the given SubsetListener if it was added earlier. |
boolean |
update(SubsetUpdate subsetUpdate)
Updates subset with the details provided in the given SubsetUpdate . |
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 |
Constructor Detail |
---|
protected SubsetQuery()
protected SubsetQuery(boolean isValidating)
Method Detail |
---|
public static SubsetQuery createInstance(ServerConnection sc) throws IllegalArgumentException
IllegalArgumentException
public static SubsetQuery createInstance(ServerConnection sc, boolean isValidating) throws IllegalArgumentException
IllegalArgumentException
public SubsetListener getSubsetListener()
public void addSubsetListener(SubsetListener sl)
SubsetListener
if it is not already added.
sl
- SubsetListener
public void removeSubsetListener(SubsetListener sl)
SubsetListener
if it was added earlier.
sl
- SubsetListener
protected void fireSubsetEvent(SubsetEvent se)
public Subset[] findAll(SubsetDescriptor descriptor) throws DTSException
SubsetDescriptor
.
descriptor
- SubsetDescriptor
options for the subsets.
Subset
. Returns an empty array
if there are no Subsets.
DTSException
- if any error occurs in the methodpublic Subset[] find(DataTypeFilter filter, SubsetDescriptor descriptor) throws DTSException
DataTypeFilter
.
Subset object for each subset is populated
with the information requested in SubsetDescriptor
.
If no DataTypeFilter is provided (filter is null), all subsets are returned.
filter
- The DataTypeFilter applied when retrieveing subsets.descriptor
- SubsetDescriptor options for the subsets.
Subset
. Returns an empty array
if there are no Subsets.
DTSException
- if any error occurs in the methodpublic Subset fetch(int subsetId) throws DTSException
Subset
object
are populated.
subsetId
- The subset id
Subset
or null if subset does not exist
DTSException
- if any error occurs in the methodpublic Subset fetch(String subsetName) throws DTSException
Subset
object
are populated.
subsetName
- The subset name
Subset
or null if subset does not exist
DTSException
- if any error occurs in the methodpublic Subset[] fetchConceptSubsets(int conceptId, int conceptNamespaceId) throws DTSException
The Subset
objects have only id and name fields populated.
conceptId
- the conceptconceptNamespaceId
- the namespace id of the concept above
Subset
. Returns an empty array
if there are no Subsets.
DTSException
- if any error occurs in the methodpublic Subset add(Subset subset) throws DTSException
Subset
to the knowledgebase.
This does not compute the expression or build the subset hierarchy.
A SubsetEvent
is generated if the subset is added successfully.
The action for this event is set to SubsetEvent.ACTION_ADD
subset
- The Subset
to be stored.
Subset
or null if subset is not added.
Note: Id of the Subset is generated and set by the server.
DTSException
- if any error occurs in the methodpublic DTSConcept[] fetchPreview(PreviewOptions options) throws DTSException
PreviewOptions.FULL
is specified.
In the case PreviewOptions.DIFF_ADDITIONS
or PreviewOptions.DIFF_DELETIONS
,
the difference between the result of the subset expression and the result of the
subset stored in the knowledgebase (specified by the subset id in the PreviewOptions
)
is computed.
Note: The additions and deletions are limited by the setting the limit variable in the PreviewOptions object.
For example, first 500 subset preview results can be obtained as :
Object[] concepts = new Object[0]; PreviewOptions options = PreviewOptions.PREVIEW_FULL; options.setLimit( 500 ); options.setSubsetExpression( subsetExpression ); concepts = subsetQuery.fetchPreview( options );And 1000 preview differences (additions and deletions) can be computed as :
DTSConcept[][] diffs = new DTSConcept[2][]; PreviewOptions addOptions = PreviewOptions.PREVIEW_DIFF_ADDITIONS; addOptions.setLimit( 1000 ); addOptions.setSubsetExpression( modifiedSubsetExpression ); addOptions.setSubsetId( storedSubsetId ); diffs[0] = subsetQuery.fetchPreview( addOptions ); PreviewOptions delOptions = PreviewOptions.PREVIEW_DIFF_DELETIONS; delOptions.setLimit( 1000 ); delOptions.setSubsetExpression( modifiedSubsetExpression ); delOptions.setSubsetId( storedSubsetId ); diffs[1] = subsetQuery.fetchPreview( delOptions );
options
- The PreviewOptions
for computing previews.
DTSConcept
based on above PreviewOptions
DTSException
- If there is a problem computing preview for the subset expression or if
one of the following occurs:
SubsetExpressionBuilder
,
PreviewOptions
public boolean build(int subsetId) throws DTSException
A SubsetEvent
is generated if the subset is built successfully.
The action for this event is set to SubsetEvent.ACTION_MODIFY
subsetId
- ID of the subset
DTSException
- if any error occurs in the methodpublic boolean update(SubsetUpdate subsetUpdate) throws DTSException
SubsetUpdate
.
Updates are only performed for non-null fields in SubsetUpdate
.
A SubsetEvent
is generated if the subset is updated successfully.
The action for this event is set to SubsetEvent.ACTION_MODIFY
subsetUpdate
- Update details as SubsetUpdate
DTSException
- if SubsetUpdate
is null or server error occurspublic boolean delete(int subsetId) throws DTSException
Subset
based on its id.
A SubsetEvent
is generated if the subset is deleted successfully.
The action for this event is set to SubsetEvent.ACTION_DELETE
subsetId
- The id of the Subset
Subset
was successfully deleted
DTSException
- if any error occurs in the methodpublic DTSConcept[] fetchConcepts(int subsetId, ConceptAttributeSetDescriptor casd) throws DTSException
DTSConcept
for a given Subset
. Concept attributes are populated
based on the given ConceptAttributeSetDescriptor
.
Warning: For Subsets with large number of concepts, this may take a long time to complete.
subsetId
- The id of the Subset
casd
- ConceptAttributeSetDescriptor
to use to populate concepts
Subset
. Returns an empty array
if the given Subset
doesn't exist.
DTSException
- if any error occurs in the methodpublic DTSConcept[] fetchConcepts(int subsetId) throws DTSException
DTSConcept
for a given Subset
. Concepts are not populated
with any attributes.
Warning: For Subsets with large number of concepts, this may take a long time to complete.
subsetId
- The id of the Subset
Subset
. Returns an empty array
if the given Subset
doesn't exist.
DTSException
- if any error occurs in the methodpublic int fetchConceptCount(Subset subset) throws DTSException
Subset
. Updates the concept count field
of the Subset object.
subset
- the Subset
Subset
. Returns 0
if the given Subset
doesn't exist.
DTSException
- if Subset parameter is null or server error occurspublic int[] fetchNamespaces(int subsetId) throws DTSException
subsetId
- The subset id
Subset
doesn't exist.
DTSException
- if server error occurspublic boolean export(int subsetId, int namespaceId, long requestId) throws DTSException
Subset
to the given namespace.
subsetId
- The id of the Subset
.namespaceId
- The id of the namespace to which subset concepts are exported.
The namespace must exist in the knowledgebase. It also must be editable and of type Thesaurus
for the export to work. Any content in the namespace will be overwritten.requestId
- The request id to track and cancel this request
Subset
was successfully exported to the namespace.
DTSException
- if
public void importSubsetExpression(int subsetId, Reader in) throws DTSException, IOException
subsetId
- The id of the subset whose expression is to be updated.in
- The input reader which has a handle to the subset expression file.
DTSException
- IOException
- If any error is encountered handling the input stream.public void exportSubsetExpression(int subsetId, Writer out) throws DTSException, IOException
subsetId
- The id of the subset whose expression is required to be exported.out
- The output reader to which the subset expression has to be written.
DTSException
- IOException
- If any error is encountered handling the output stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |