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

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

public class GraphQuery
extends Object

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

Author:
hedgehog

Nested Class Summary
static class GraphQuery.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 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
GraphQuery()
          Initialiser for Query; makes an empty Query [no matches, no constraints]
GraphQuery(Graph pattern)
          Initialiser for Query; makes a Query with its matches taken from pattern.
 
Method Summary
 GraphQuery addConstraint(Expression e)
           
 GraphQuery addMatch(Node s, Node p, Node o)
          Add an (S, P, O) match to the query's collection of match triples.
 GraphQuery addMatch(Triple t)
          Add a triple to the query's collection of match triples.
 NamedGraphMap args()
           
 com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(Graph g, List<Stage> stages, Node[] results)
           
 com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(Graph g, Node[] results)
           
 com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(List<Stage> outStages, NamedGraphMap args, Node[] nodes)
          the standard "default" implementation of executeBindings.
 com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(NamedGraphMap args, Node[] nodes)
           
 ExpressionSet getConstraints()
           
 List<Triple> getPattern()
          Answer a list of the triples that have been added to this query.
 TripleSorter getSorter()
           
 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".

Constructor Detail

GraphQuery

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


GraphQuery

public GraphQuery(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 GraphQuery 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 GraphQuery 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

getPattern

public List<Triple> getPattern()
Answer a list of the triples that have been added to this query. (Note: ignores "named triples").

Returns:
List

getConstraints

public ExpressionSet getConstraints()

addConstraint

public GraphQuery addConstraint(Expression e)

executeBindings

public com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(Graph g,
                                                                              Node[] results)

executeBindings

public com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(Graph g,
                                                                              List<Stage> stages,
                                                                              Node[] results)

executeBindings

public com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(NamedGraphMap args,
                                                                              Node[] nodes)

executeBindings

public com.hp.hpl.jena.util.iterator.ExtendedIterator<Domain> executeBindings(List<Stage> outStages,
                                                                              NamedGraphMap args,
                                                                              Node[] nodes)
the standard "default" implementation of executeBindings.


args

public NamedGraphMap args()

getSorter

public TripleSorter getSorter()

setTripleSorter

public void setTripleSorter(TripleSorter ts)

getVariableCount

public int getVariableCount()


Licenced under the Apache License, Version 2.0