|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.apelon.dts.client.subset.SubsetExpressionBuilder
public class SubsetExpressionBuilder
This class provides a way to construct a subset expression.
The rules for creating a subset expression is described in Subset
class header.
Example : Create an expression defined as
DTS Concepts FROM Triad HAVING CONCEPT NAME OR SYNONYM MATCHING *PROC* ALL PROCEDURE HAVING PROPERTY print_name EXCLUDE ALL DIAGNOSTIC_PROCEDUREThe code to create this expression will look similar to the following example:
// Subset Expression instance SubsetExpressionBuilder expr = new SubsetExpressionBuilder(); // FROM Triad Namespace ns = namespacequery.findNamespaceByName("Triad"); DefaultMutableTreeNode nsNode = expr.initNamespace(ns); // HAVING CONCEPT NAME OR SYNONYM MATCHING *PROC* expr.addConceptNameFilter(nsNode, "*PROC*", false); // ALL PROCEDURE DTSConcept con = ontylogquery.findConceptByName("PROCEDURE", ns.getId(), ConceptAttributeSetDescriptor.NO_ATTRIBUTES); DefaultMutableTreeNode conNode = expr.addConceptFilter(nsNode, con, false); // HAVING PROPERTY print_name DTSPropertyType propType = ontylogquery.findPropertyTypeByName("print_name", 50); DefaultMutableTreeNode propNode = expr.addPropertyFilter(conNode, propType, null); // EXCLUDE DefaultMutableTreeNode exNode = expr.addExclude(nsNode); // ALL DIAGNOSTIC_PROCEDURE DTSConcept con1 = ontylogquery.findConceptByName("DIAGNOSTIC_PROCEDURE", ns.getId(), ConceptAttributeSetDescriptor.NO_ATTRIBUTES); DefaultMutableTreeNode conNode1 = expr.addConceptFilter(exNode, con1, false); // Build subset expression String xml = expr.buildExpression();
Copyright: Copyright (c) 2004
Company: Apelon, Inc.
Field Summary | |
---|---|
static String |
DTS_CONCEPTS
|
static String |
EXCLUDE
|
Constructor Summary | |
---|---|
SubsetExpressionBuilder()
|
Method Summary | |
---|---|
void |
addConcept(DefaultMutableTreeNode parent,
DTSConcept con)
Creates OntylogConceptFilter for the given Concept with modifier "ONLY". |
DefaultMutableTreeNode |
addConceptFilter(DefaultMutableTreeNode parent,
DTSConcept con,
boolean descendentsOnly)
Creates OntylogConceptFilter for the given Concept. |
DefaultMutableTreeNode |
addConceptNameFilter(DefaultMutableTreeNode parent,
String pattern,
boolean searchConceptsOnly)
Creates ConceptNameFilter for the given search pattern. |
DefaultMutableTreeNode |
addExclude(DefaultMutableTreeNode parent)
Creates an Exclude node and adds it to parent |
DefaultMutableTreeNode |
addPropertyFilter(DefaultMutableTreeNode parent,
DTSPropertyType propType,
String pattern)
Creates PropertyFilter for the given DTSPropertyType and search pattern. |
void |
build(String expr)
Builds the root node from the given xml string using XMLDecoder . |
String |
buildExpression()
Returns XML representation of the root node created using XMLEncoder . |
DefaultMutableTreeNode |
getRootNode()
Returns the root node for the Subset Expression. |
DefaultMutableTreeNode |
initNamespace(Namespace ns)
Initializes the namespace for the subset expression. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DTS_CONCEPTS
public static final String EXCLUDE
Constructor Detail |
---|
public SubsetExpressionBuilder()
Method Detail |
---|
public DefaultMutableTreeNode getRootNode()
public String buildExpression() throws Exception
XMLEncoder
. This can be used as expression in
Subset.setExpression(String)
method.
Exception
- when
XMLEncoder
public void build(String expr) throws Exception
XMLDecoder
.
expr
- xml string created using XMLEncoder
Exception
- If there is error creating root node using XMLDecoder
public DefaultMutableTreeNode initNamespace(Namespace ns)
ns
- Namespace
public DefaultMutableTreeNode addConceptFilter(DefaultMutableTreeNode parent, DTSConcept con, boolean descendentsOnly)
OntylogConceptFilter
for the given Concept.
Creates a Concept Filter node for the filter and adds it as child of the given parent node.
parent
- Parent Node. This can be Namespace Node, Concept Filter Node or Exclude Nodecon
- ConceptdescendentsOnly
- true if only descendents of the concept are required
IllegalArgumentException
- If namespace of concept does not match expression namespace.public void addConcept(DefaultMutableTreeNode parent, DTSConcept con)
OntylogConceptFilter
for the given Concept with modifier "ONLY".
Creates a Concept node for the filter and adds it as child of the given parent node.
parent
- Parent Node. This can be Namespace Node, Concept Filter Node or Exclude Nodecon
- Concept
IllegalArgumentException
- If namespace of concept does not match expression namespace.public DefaultMutableTreeNode addPropertyFilter(DefaultMutableTreeNode parent, DTSPropertyType propType, String pattern)
PropertyFilter
for the given DTSPropertyType and search pattern. If the pattern is null,
the filter is on DTSPropertyType only.
Creates a Concept Filter node for the filter and adds it as child of the given parent node.
parent
- Parent Node. This can be Namespace Node, Concept Filter Node or Exclude NodepropType
- DTS Property Typepattern
- search pattern to search in Property value
public DefaultMutableTreeNode addConceptNameFilter(DefaultMutableTreeNode parent, String pattern, boolean searchConceptsOnly)
ConceptNameFilter
for the given search pattern. If the pattern cannot be null,
Creates a Concept Filter node for the filter and adds it as child of the given parent node.
parent
- Parent Node. This can be Namespace Node, Concept Filter Node or Exclude Nodepattern
- search pattern to search in synonyms and concept namessearchConceptsOnly
- true if only concept names are searched, false if both synonyms and concept
names are searched.
IllegalArgumentException
- if pattern is null or blankpublic DefaultMutableTreeNode addExclude(DefaultMutableTreeNode parent)
parent
- Parent Node. This can be Namespace Node or Concept Filter Node.
IllegalArgumentException
- if Parent node is Exclude node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |