Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hp.hpl.jena.graph.query
Class QueryNode

    java.lang.Object
      com.hp.hpl.jena.graph.query.QueryNode

Direct Known Subclasses:
  QueryNode.Any, QueryNode.Bind, QueryNode.Bound, QueryNode.Fixed, QueryNode.JustBound

    public abstract class QueryNode

extends java.lang.Object

A QueryNode is a wrapped node that has been processed against some variable-binding map to discover (a) what kind of node it is and (b) what index in the binding map it has.

There are five sub-classes of QueryNode

- Fixed - a concrete node, with pseudo-index NO_INDEX
- Bind - a variable node's first, binding, appearance
- JustBound - a variable node's bound appearance in the same [triple] context as its binding appearance
- Bound - a variable node's bound appearance
- Any - Node.ANY (or, in principle, a free variable)

Author:
  hedgehog

Nested Class Summary
`static class` | `QueryNode.Any`
`static class` | `QueryNode.Bind`
`static class` | `QueryNode.Bound`
`static class` | `QueryNode.Fixed`
`static class` | `QueryNode.JustBound`
`class` | `QueryNode.MustNotMatchException` Internal exception to throw if, against all chance, something that shouldn't be involved in a match is.

Field Summary
`static QueryNodeFactory` | `factory`
`int` | `index` The index value allocated to this query node; NO_INDEX except for a variable node, in which case it is the allocated index in the domain object.
`static int` | `NO_INDEX` Fake index value to use when no index makes sense; we choose a value that will fail any array-bound check if it happens to be used anyway.
`Node` | `node` The Node value on which this QueryNode is based.

Method Summary
`static QueryNode` | `classify(QueryNodeFactory f, Mapping map, java.util.Set recent, Node n)` Answer a QueryNode that classifies the argument node `n`.
`Node` | `finder(Domain d)` Answer a Node value to use when this QueryValue is used to select objects in a Graph::find() operation; for concrete nodes, that very node, for variables their current value (ANY if not bound).
`boolean` | `isFrozen()` Answer true iff this node is "frozen", ie its value is fixed, when it is encountered; that is, it is not a Bind or JustBound node.
`boolean` | `match(Domain d, Node x)` Answer true iff this QueryNode matches, in the context of the binding Domain `d`, the node `x`.
`abstract boolean` | `matchOrBind(Domain d, Node x)` Optimisation: the action to be performed when matching a just-bound variable or binding a newly-bound variable, or nothing for any other kind of QueryNode.
`boolean` | `mustMatch()` Answer true iff this QueryNode must be used in a triple-match of its owning QueryTriple.
`java.lang.String` | `toString()` Return a handy string representation for debugging purposes.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### NO_INDEX

    public static final int NO_INDEX

  Fake index value to use when no index makes sense; we choose a value that will fail any array-bound check if it happens to be used anyway.

  See Also:
    Constant Field Values

### node

    public final Node node

  The Node value on which this QueryNode is based.

### index

    public final int index

  The index value allocated to this query node; NO_INDEX except for a variable node, in which case it is the allocated index in the domain object.

### factory

    public static final QueryNodeFactory factory

Method Detail

### toString

    public java.lang.String toString()

  Return a handy string representation for debugging purposes. Not for machine consumption.

  Overrides:
    `toString` in class `java.lang.Object`

### isFrozen

    public boolean isFrozen()

  Answer true iff this node is "frozen", ie its value is fixed, when it is encountered; that is, it is not a Bind or JustBound node.

### finder

    public Node finder(Domain d)

  Answer a Node value to use when this QueryValue is used to select objects in a Graph::find() operation; for concrete nodes, that very node, for variables their current value (ANY if not bound).

### mustMatch

    public boolean mustMatch()

  Answer true iff this QueryNode must be used in a triple-match of its owning QueryTriple.

### match

    public boolean match(Domain d,
                         Node x)

  Answer true iff this QueryNode matches, in the context of the binding Domain `d`, the node `x`.

### matchOrBind

    public abstract boolean matchOrBind(Domain d,
                                        Node x)

  Optimisation: the action to be performed when matching a just-bound variable or binding a newly-bound variable, or nothing for any other kind of QueryNode.

### classify

    public static QueryNode classify(QueryNodeFactory f,
                                     Mapping map,
                                     java.util.Set recent,
                                     Node n)

  Answer a QueryNode that classifies the argument node `n`. The factory `f` is used to create the different QueryNodes, allowing different classifiers to use their own subclasses of QueryNode if they wish. `map` is the variable-to-index map, and `recent` is the set of those variables "just" bound, ie, earlier in the same triple.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP