public class PathMap
extends java.lang.Object
The current implementation works only for XPath 2.0 expressions (for example, constructs like xsl:for-each-group are not handled.)
This class, together with the overloaded method
Expression.addToPathMap(PathMap, net.sf.saxon.expr.PathMap.PathMapNodeSet)
can be
seen as an implementation of the static path analysis algorithm given in section 4 of
A. Marian and J. Simeon,
Projecting XML Documents, VLDB 2003.
Modifier and Type | Class | Description |
---|---|---|
static class |
PathMap.PathMapArc |
An arc joining two nodes in the path map.
|
static class |
PathMap.PathMapNode |
A node in the path map.
|
static class |
PathMap.PathMapNodeSet |
A (mutable) set of nodes in the path map
|
static class |
PathMap.PathMapRoot |
A root node in the path map.
|
Constructor | Description |
---|---|
PathMap(Expression exp) |
Create the PathMap for an expression
|
Modifier and Type | Method | Description |
---|---|---|
void |
diagnosticDump(java.io.PrintStream out) |
Display a printed representation of the path map
|
PathMap.PathMapRoot |
getContextRoot() |
Get the path map root for the context document
|
PathMap.PathMapNodeSet |
getPathForVariable(Binding binding) |
Get the path used when evaluating a given variable binding
|
PathMap.PathMapRoot[] |
getPathMapRoots() |
Get all the root expressions from the path map
|
PathMap.PathMapRoot |
getRootForDocument(java.lang.String requiredUri) |
Get the path map root for a call on the doc() or document() function with a given literal argument
|
static void |
main(java.lang.String[] args) |
Main method for testing
|
PathMap.PathMapRoot |
makeNewRoot(Expression exp) |
Make a new root node in the path map.
|
PathMap.PathMapRoot |
reduceToDownwardsAxes(PathMap.PathMapRoot root) |
Given a PathMapRoot, simplify the tree rooted at this node so that
it only contains downwards selections: specifically, so that the only axes
used are child, attribute, namespace, and descendant.
|
void |
registerPathForVariable(Binding binding,
PathMap.PathMapNodeSet nodeset) |
Register the path used when evaluating a given variable binding
|
public PathMap(Expression exp)
exp
- the expression whose PathMap is requiredpublic PathMap.PathMapRoot makeNewRoot(Expression exp)
exp
- the expression represented by this root nodepublic PathMap.PathMapRoot[] getPathMapRoots()
public void registerPathForVariable(Binding binding, PathMap.PathMapNodeSet nodeset)
binding
- the variable bindingnodeset
- the set of PathMap nodes reachable when evaluating that variablepublic PathMap.PathMapNodeSet getPathForVariable(Binding binding)
binding
- the variable bindingpublic PathMap.PathMapRoot getContextRoot()
java.lang.IllegalStateException
- if there is more than one path map root for the context documentpublic PathMap.PathMapRoot getRootForDocument(java.lang.String requiredUri)
requiredUri
- the literal argument we are looking forjava.lang.IllegalStateException
- if there is more than one path map root for the specified documentpublic PathMap.PathMapRoot reduceToDownwardsAxes(PathMap.PathMapRoot root)
root
- the root of the path to be simplifiedpublic void diagnosticDump(java.io.PrintStream out)
out
- the output stream to which the output will be writtenpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- Takes one argument, the XPath expression to be analyzedjava.lang.Exception