edu.utdallas.paged.graph.query
Class PagedSimpleQueryHandler

java.lang.Object
  extended by edu.utdallas.paged.graph.query.PagedSimpleQueryHandler
All Implemented Interfaces:
com.hp.hpl.jena.graph.query.QueryHandler

public class PagedSimpleQueryHandler
extends java.lang.Object
implements com.hp.hpl.jena.graph.query.QueryHandler

A class that is used to query the underlying graph for this model

Author:
vaibhav

Constructor Summary
PagedSimpleQueryHandler(com.hp.hpl.jena.graph.Graph graph, edu.utdallas.paged.mem.PagedGraphTripleStore store)
          Constructor
 
Method Summary
 boolean containsNode(com.hp.hpl.jena.graph.Node n)
           
static com.hp.hpl.jena.util.iterator.ExtendedIterator objectsFor(com.hp.hpl.jena.graph.Graph g, com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node p, edu.utdallas.paged.mem.PagedGraphTripleStore store)
          Method to find objects given the the graph, node s, node p, and the triple store
 com.hp.hpl.jena.util.iterator.ExtendedIterator objectsFor(com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node p)
          Method to find objects given the the node s and node p
 com.hp.hpl.jena.graph.query.Stage patternStage(com.hp.hpl.jena.graph.query.Mapping map, com.hp.hpl.jena.graph.query.ExpressionSet constraints, com.hp.hpl.jena.graph.Triple[] t)
          Method to create a pattern stage for the given query
static com.hp.hpl.jena.util.iterator.ExtendedIterator predicatesFor(com.hp.hpl.jena.graph.Graph g, com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node o, edu.utdallas.paged.mem.PagedGraphTripleStore store)
          Method to find predicates given the the graph, node s, node o, and the triple store
 com.hp.hpl.jena.util.iterator.ExtendedIterator predicatesFor(com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node o)
          Method to find predicates given the the node s and node o
 com.hp.hpl.jena.graph.query.BindingQueryPlan prepareBindings(com.hp.hpl.jena.graph.query.Query q, com.hp.hpl.jena.graph.Node[] variables)
          Method to create the bindings given the set of nodes and the query
 com.hp.hpl.jena.graph.query.TreeQueryPlan prepareTree(com.hp.hpl.jena.graph.Graph pattern)
          Method to generate a query tree plan
static com.hp.hpl.jena.util.iterator.ExtendedIterator subjectsFor(com.hp.hpl.jena.graph.Graph g, com.hp.hpl.jena.graph.Node p, com.hp.hpl.jena.graph.Node o, edu.utdallas.paged.mem.PagedGraphTripleStore store)
          Method to find subjects given the the graph, node p, node o, and the triple store
 com.hp.hpl.jena.util.iterator.ExtendedIterator subjectsFor(com.hp.hpl.jena.graph.Node p, com.hp.hpl.jena.graph.Node o)
          Method to find subjects given the the node p and node o
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagedSimpleQueryHandler

public PagedSimpleQueryHandler(com.hp.hpl.jena.graph.Graph graph,
                               edu.utdallas.paged.mem.PagedGraphTripleStore store)
Constructor

Parameters:
graph - - the graph this handler is working for
store - - the triple store this handler is working for
Method Detail

patternStage

public com.hp.hpl.jena.graph.query.Stage patternStage(com.hp.hpl.jena.graph.query.Mapping map,
                                                      com.hp.hpl.jena.graph.query.ExpressionSet constraints,
                                                      com.hp.hpl.jena.graph.Triple[] t)
Method to create a pattern stage for the given query

Specified by:
patternStage in interface com.hp.hpl.jena.graph.query.QueryHandler
Parameters:
map - - the mapping
constraints - - the set of constraints
t - - the array of triple patterns we are looking for
Returns:
a Stage instance

prepareBindings

public com.hp.hpl.jena.graph.query.BindingQueryPlan prepareBindings(com.hp.hpl.jena.graph.query.Query q,
                                                                    com.hp.hpl.jena.graph.Node[] variables)
Method to create the bindings given the set of nodes and the query

Specified by:
prepareBindings in interface com.hp.hpl.jena.graph.query.QueryHandler
Parameters:
q - - the SPARQL query
variables - - the set of nodes
Returns:
a binding query plan

prepareTree

public com.hp.hpl.jena.graph.query.TreeQueryPlan prepareTree(com.hp.hpl.jena.graph.Graph pattern)
Method to generate a query tree plan

Specified by:
prepareTree in interface com.hp.hpl.jena.graph.query.QueryHandler
Parameters:
pattern - - the pattern as a graph
Returns:
a tree query plan

objectsFor

public com.hp.hpl.jena.util.iterator.ExtendedIterator objectsFor(com.hp.hpl.jena.graph.Node s,
                                                                 com.hp.hpl.jena.graph.Node p)
Method to find objects given the the node s and node p

Specified by:
objectsFor in interface com.hp.hpl.jena.graph.query.QueryHandler
Parameters:
s - - the subject node
p - - the predicate node
Returns:
a null iterator or an iterator that contains the object nodes

subjectsFor

public com.hp.hpl.jena.util.iterator.ExtendedIterator subjectsFor(com.hp.hpl.jena.graph.Node p,
                                                                  com.hp.hpl.jena.graph.Node o)
Method to find subjects given the the node p and node o

Specified by:
subjectsFor in interface com.hp.hpl.jena.graph.query.QueryHandler
Parameters:
p - - the predicate node
o - - the object node
Returns:
a null iterator or an iterator that contains the subject nodes

predicatesFor

public com.hp.hpl.jena.util.iterator.ExtendedIterator predicatesFor(com.hp.hpl.jena.graph.Node s,
                                                                    com.hp.hpl.jena.graph.Node o)
Method to find predicates given the the node s and node o

Specified by:
predicatesFor in interface com.hp.hpl.jena.graph.query.QueryHandler
Parameters:
s - - the subject node
o - - the object node
Returns:
a null iterator or an iterator that contains the predicate nodes

objectsFor

public static com.hp.hpl.jena.util.iterator.ExtendedIterator objectsFor(com.hp.hpl.jena.graph.Graph g,
                                                                        com.hp.hpl.jena.graph.Node s,
                                                                        com.hp.hpl.jena.graph.Node p,
                                                                        edu.utdallas.paged.mem.PagedGraphTripleStore store)
Method to find objects given the the graph, node s, node p, and the triple store

Parameters:
g - - the graph we want to search
s - - the subject node
p - - the predicate node
store - - the triple store for the graph
Returns:
a null iterator or an iterator that contains the object nodes

subjectsFor

public static com.hp.hpl.jena.util.iterator.ExtendedIterator subjectsFor(com.hp.hpl.jena.graph.Graph g,
                                                                         com.hp.hpl.jena.graph.Node p,
                                                                         com.hp.hpl.jena.graph.Node o,
                                                                         edu.utdallas.paged.mem.PagedGraphTripleStore store)
Method to find subjects given the the graph, node p, node o, and the triple store

Parameters:
g - - the graph we want to search
p - - the predicate node
o - - the object node
store - - the triple store for the graph
Returns:
a null iterator or an iterator that contains the subject nodes

predicatesFor

public static com.hp.hpl.jena.util.iterator.ExtendedIterator predicatesFor(com.hp.hpl.jena.graph.Graph g,
                                                                           com.hp.hpl.jena.graph.Node s,
                                                                           com.hp.hpl.jena.graph.Node o,
                                                                           edu.utdallas.paged.mem.PagedGraphTripleStore store)
Method to find predicates given the the graph, node s, node o, and the triple store

Parameters:
g - - the graph we want to search
s - - the subject node
o - - the object node
store - - the triple store for the graph
Returns:
a null iterator or an iterator that contains the predicate nodes

containsNode

public boolean containsNode(com.hp.hpl.jena.graph.Node n)
Specified by:
containsNode in interface com.hp.hpl.jena.graph.query.QueryHandler
See Also:
SimpleQueryHandler.containsNode(Node)