org.primordion.xholon.base
Interface IXPath

All Known Implementing Classes:
XPath

public interface IXPath

The XML Path Language (XPath) is an internet W3C standard, that defines how to locate nodes in a tree.

Since:
0.1 (Created on Sep 8, 2005)
Author:
Ken Webb
See Also:
XML Path Language (XPath) Version 1.0 (W3C Recommendation 16 November 1999)., 206 Java API for XML Processing (JAXP) 1.3

Field Summary
static int AXIS_ANCESTOR
           
static int AXIS_ANCESTORORSELF
           
static int AXIS_ATTRIBUTE
           
static int AXIS_CHILD
           
static int AXIS_DEFAULT
           
static int AXIS_DESCENDANT
           
static int AXIS_DESCENDANTORSELF
           
static int AXIS_FOLLOWING
           
static int AXIS_FOLLOWINGSIBLING
           
static int AXIS_NAMESPACE
           
static int AXIS_PARENT
           
static int AXIS_PRECEDING
           
static int AXIS_PRECEDINGSIBLING
           
static int AXIS_SELF
           
static int XPATH_OP_EQ
           
static int XPATH_OP_GE
           
static int XPATH_OP_GT
           
static int XPATH_OP_LE
           
static int XPATH_OP_LT
           
static int XPATH_OP_NE
           
static int XPATH_OP_NOP
           
 
Method Summary
 IXholon evaluate(java.lang.String expression, IXholon item)
          Evaluate an XPath expression in the specified context and return the result as a IXholon.
 java.lang.String evaluate(java.lang.String expression, java.lang.Object item)
          Evaluate an XPath expression in the specified context and return the result as a String.
 java.lang.Object evaluate(java.lang.String expression, java.lang.Object item, int returnType)
          Evaluate an XPath expression in the specified context and return the result as the specified type.
 java.util.Vector searchForClosestNeighbors(int distance, int include, java.lang.String excludeXhcName, java.lang.String xhcName, int maxQuantity, boolean matchSuperClasses, IXholon xhNode)
          Search for closest neighbors whose XholonClass names are xhcName.
 

Field Detail

AXIS_CHILD

public static final int AXIS_CHILD
See Also:
Constant Field Values

AXIS_DESCENDANT

public static final int AXIS_DESCENDANT
See Also:
Constant Field Values

AXIS_ATTRIBUTE

public static final int AXIS_ATTRIBUTE
See Also:
Constant Field Values

AXIS_SELF

public static final int AXIS_SELF
See Also:
Constant Field Values

AXIS_DESCENDANTORSELF

public static final int AXIS_DESCENDANTORSELF
See Also:
Constant Field Values

AXIS_FOLLOWINGSIBLING

public static final int AXIS_FOLLOWINGSIBLING
See Also:
Constant Field Values

AXIS_FOLLOWING

public static final int AXIS_FOLLOWING
See Also:
Constant Field Values

AXIS_NAMESPACE

public static final int AXIS_NAMESPACE
See Also:
Constant Field Values

AXIS_PARENT

public static final int AXIS_PARENT
See Also:
Constant Field Values

AXIS_ANCESTOR

public static final int AXIS_ANCESTOR
See Also:
Constant Field Values

AXIS_PRECEDINGSIBLING

public static final int AXIS_PRECEDINGSIBLING
See Also:
Constant Field Values

AXIS_PRECEDING

public static final int AXIS_PRECEDING
See Also:
Constant Field Values

AXIS_ANCESTORORSELF

public static final int AXIS_ANCESTORORSELF
See Also:
Constant Field Values

AXIS_DEFAULT

public static final int AXIS_DEFAULT
See Also:
Constant Field Values

XPATH_OP_NOP

public static final int XPATH_OP_NOP
See Also:
Constant Field Values

XPATH_OP_EQ

public static final int XPATH_OP_EQ
See Also:
Constant Field Values

XPATH_OP_NE

public static final int XPATH_OP_NE
See Also:
Constant Field Values

XPATH_OP_LT

public static final int XPATH_OP_LT
See Also:
Constant Field Values

XPATH_OP_GT

public static final int XPATH_OP_GT
See Also:
Constant Field Values

XPATH_OP_LE

public static final int XPATH_OP_LE
See Also:
Constant Field Values

XPATH_OP_GE

public static final int XPATH_OP_GE
See Also:
Constant Field Values
Method Detail

evaluate

public java.lang.Object evaluate(java.lang.String expression,
                                 java.lang.Object item,
                                 int returnType)
Evaluate an XPath expression in the specified context and return the result as the specified type.

Parameters:
expression - The XPath expression.
item - The starting context (node or node list, for example).
returnType - The desired return type.
Returns:
Result of evaluating an XPath expression as an Object of returnType.
See Also:
1.3

evaluate

public java.lang.String evaluate(java.lang.String expression,
                                 java.lang.Object item)
Evaluate an XPath expression in the specified context and return the result as a String.

Parameters:
expression - The XPath expression.
item - The starting context (node or node list, for example).
Returns:
The string that is the result of evaluating the expression and converting the result to a String.
See Also:
1.3

evaluate

public IXholon evaluate(java.lang.String expression,
                        IXholon item)
Evaluate an XPath expression in the specified context and return the result as a IXholon.

Parameters:
expression - The XPath expression.
item - The starting context, a IXholon.
Returns:
The IXholon that is the result of evaluating the expression.

Examples of expressions (location paths):

ancestor::AnElevatorSystem/Floor[1]/CallButton[1]

ancestor::Cytoplasm/Cytosol/Pyruvate

ancestor::ExtraCellularSolution/child::Glucose

./DescendantName

./child::DescendantName/TargetDescendantName


searchForClosestNeighbors

public java.util.Vector searchForClosestNeighbors(int distance,
                                                  int include,
                                                  java.lang.String excludeXhcName,
                                                  java.lang.String xhcName,
                                                  int maxQuantity,
                                                  boolean matchSuperClasses,
                                                  IXholon xhNode)
Search for closest neighbors whose XholonClass names are xhcName.

Parameters:
distance - How far within the tree to search for neighbors.
include - Whether to include (P)arent and/or (S)iblings and/or (C)hildren.
excludeXhcName - Name of a XholonClass, used to limit the scope of the returned Vector.
xhcName - Name of a XholonClass.
maxQuantity - Maximum quantity of closest neighbors to return (may return fewer)
matchSuperClasses - Whether or not to match superclasses.
Returns:
Vector containing instances of IXholon, or null. TODO Make this fully part of my XPath implementation, once it supports returning a NodeSet and not just a single node.