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

java.lang.Object
  extended by com.hp.hpl.jena.graph.query.Query

public class Query
extends java.lang.Object

The class of graph queries, plus some machinery (which should move) for implementing them.

Author:
hedgehog

Nested Class Summary
static class Query.UnboundVariableException
          Exception thrown when a query variable is discovered to be unbound.
 
Field Summary
static Node ANY
          A convenient synonym for Node.ANY, used in a match to match anything.
static TripleSorter dontSort
          Deprecated. - use TripleSorter.dontSort instead.
static Node O
          A query variable called "O".
static Node P
          A query variable called "P".
static Node S
          A query variable called "S".
static Node X
          A query variable called "X".
static Node Y
          A query variable called "Y".
static Node Z
          A query variable called "Z".
 
Constructor Summary
Query()
          Initialiser for Query; makes an empty Query [no matches, no constraints]
Query(Graph pattern)
          Initialiser for Query; makes a Query with its matches taken from pattern.
 
Method Summary
 Query addConstraint(Expression e)
           
 Query addMatch(Node s, Node p, Node o)
          Add an (S, P, O) match to the query's collection of match triples.
 Query addMatch(java.lang.String name, Node s, Node p, Node o)
          Add an (S, P, O) match triple to this query to match against the graph labelled with name.
 Query addMatch(Triple t)
          Add a triple to the query's collection of match triples.
 NamedGraphMap args()
           
 ExtendedIterator executeBindings(Graph g, java.util.List stages, Node[] results)
           
 ExtendedIterator executeBindings(Graph g, Node[] results)
           
 ExtendedIterator executeBindings(java.util.List outStages, NamedGraphMap args, Node[] nodes)
          the standard "default" implementation of executeBindings.
 ExtendedIterator executeBindings(NamedGraphMap args, Node[] nodes)
           
 ExpressionSet getConstraints()
           
 TripleSorter getSorter()
           
 NamedTripleBunches getTriples()
           
 int getVariableCount()
           
 void setTripleSorter(TripleSorter ts)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY

public static final Node ANY
A convenient synonym for Node.ANY, used in a match to match anything.


S

public static final Node S
A query variable called "S".


P

public static final Node P
A query variable called "P".


O

public static final Node O
A query variable called "O".


X

public static final Node X
A query variable called "X".


Y

public static final Node Y
A query variable called "Y".


Z

public static final Node Z
A query variable called "Z".


dontSort

public static final TripleSorter dontSort
Deprecated. - use TripleSorter.dontSort instead.
Constructor Detail

Query

public Query()
Initialiser for Query; makes an empty Query [no matches, no constraints]


Query

public Query(Graph pattern)
Initialiser for Query; makes a Query with its matches taken from pattern.

Parameters:
pattern - a Graph whose triples are used as match elements
Method Detail

addMatch

public Query addMatch(Node s,
                      Node p,
                      Node o)
Add an (S, P, O) match to the query's collection of match triples. Return this query for cascading.

Parameters:
s - the node to match the subject
p - the node to match the predicate
o - the node to match the object
Returns:
this Query, for cascading

addMatch

public Query addMatch(Triple t)
Add a triple to the query's collection of match triples. Return this query for cascading.

Parameters:
t - an (S, P, O) triple to add to the collection of matches
Returns:
this Query, for cascading

addMatch

public Query addMatch(java.lang.String name,
                      Node s,
                      Node p,
                      Node o)
Add an (S, P, O) match triple to this query to match against the graph labelled with name. Return this query for cascading.

Parameters:
name - the name that will identify the graph in the matching
s - the node to match the subject
p - the node to match the predicate
o - the node to match the object
Returns:
this Query, for cascading.

getConstraints

public ExpressionSet getConstraints()

addConstraint

public Query addConstraint(Expression e)

executeBindings

public ExtendedIterator executeBindings(Graph g,
                                        Node[] results)

executeBindings

public ExtendedIterator executeBindings(Graph g,
                                        java.util.List stages,
                                        Node[] results)

executeBindings

public ExtendedIterator executeBindings(NamedGraphMap args,
                                        Node[] nodes)

executeBindings

public ExtendedIterator executeBindings(java.util.List outStages,
                                        NamedGraphMap args,
                                        Node[] nodes)
the standard "default" implementation of executeBindings.


getTriples

public NamedTripleBunches getTriples()

args

public NamedGraphMap args()

getSorter

public TripleSorter getSorter()

setTripleSorter

public void setTripleSorter(TripleSorter ts)

getVariableCount

public int getVariableCount()


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