com.hp.hpl.jena.graph.query
Class Element

java.lang.Object
  extended by com.hp.hpl.jena.graph.query.Element
Direct Known Subclasses:
Bind, Bound, Fixed

public abstract class Element
extends Object

An Element of a matching triple. Elements have associated indexes, their place in the Domain storing the matching values. Subclasses represent constants, binding occurances of variables, and bound instances of variables.

Author:
hedgehog

Field Summary
static Element ANY
          The constant ANY matches anything and binds nothing
 
Method Summary
abstract  Node asNodeMatch(Domain d)
          Answer a Node suitable as a pattern-match element in a TripleMatch approximating this Element.
 int getIndex()
          Answer this Element's index in the Domains it is compiled for.
abstract  boolean match(Domain d, Node x)
          Answer true if this Element matches x given the bindings in d.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY

public static final Element ANY
The constant ANY matches anything and binds nothing

Method Detail

getIndex

public int getIndex()
Answer this Element's index in the Domains it is compiled for.


match

public abstract boolean match(Domain d,
                              Node x)
Answer true if this Element matches x given the bindings in d. May side-effect d by (re)binding if this element is a variable.

Parameters:
d - the variable bindings to read/update for variables
x - the value to match
Returns:
true if the match succeeded

asNodeMatch

public abstract Node asNodeMatch(Domain d)
Answer a Node suitable as a pattern-match element in a TripleMatch approximating this Element. Thus Bind elements map to null (or Node.ANY).

Parameters:
d - the domain holding the variable bindings
Returns:
the matched value (null if none, ie binding occurance or ANY)

toString

public String toString()
Overrides:
toString in class Object


Licenced under the Apache License, Version 2.0