org.openanzo.glitter.query
Interface FunctionalPredicate

All Known Implementing Classes:
TextLikePredicate, TextLikePredicate, TextMatchPredicate

public interface FunctionalPredicate

A FunctionalPredicate is a URI that generates bindings/solutions to a query in a different fashion from the standard graph-pattern matching.

Author:
lee

Method Summary
 boolean canBindGraphVariables()
           
 SolutionSet generateSolutions(IRIReference namedGraph, Variable namedGraphVariable, SolutionSet bindingConstraints)
          Requests that solutions be generated against the default graph, a particular named graph, or spanning the named graphs (with a named graph variable).
 double getCost(NodeCostModel costModel)
           
 TriplePattern getFunctionalTriplePattern()
          Accessor for the triple pattern set with setFunctionalTriplePattern(TriplePattern).
 boolean handlesTriplePattern(TriplePattern pattern)
          After setFunctionalTriplePattern has been called, this method is called once for every triple pattern in the functional triple pattern's basic graph pattern (BGP).
 void initialize(QueryInformation qi)
           
 void setFunctionalTriplePattern(TriplePattern pattern)
          This is the first method invoked on a FunctionalPredicate.
 boolean usesDataFromGraphs()
           
 

Method Detail

initialize

void initialize(QueryInformation qi)
Parameters:
qi - Information on the current query executing

canBindGraphVariables

boolean canBindGraphVariables()
Returns:
true if this FP will handle binding graph variables.

usesDataFromGraphs

boolean usesDataFromGraphs()
Returns:
true if this FP needs to examine graphs to get at data

setFunctionalTriplePattern

void setFunctionalTriplePattern(TriplePattern pattern)
                                throws FunctionalPredicateInvocationException
This is the first method invoked on a FunctionalPredicate. It sets the triple pattern which contains the functional predicate. The FunctionalPredicate implementation should save this information; it can also throw a FunctionalPredicateInvocationException if it does not wish to handle this triple pattern (for example, if it can not handle subject variables and this is a ?s ex:pred ?o triple pattern.

Parameters:
pattern - the triple pattern which contains the functional predicate
Throws:
FunctionalPredicateInvocationException

getFunctionalTriplePattern

TriplePattern getFunctionalTriplePattern()
Accessor for the triple pattern set with setFunctionalTriplePattern(TriplePattern).

Returns:
The TriplePattern that contains this functional predicate.

handlesTriplePattern

boolean handlesTriplePattern(TriplePattern pattern)
                             throws FunctionalPredicateInvocationException
After setFunctionalTriplePattern has been called, this method is called once for every triple pattern in the functional triple pattern's basic graph pattern (BGP).

Parameters:
pattern - A triple pattern from the same BGP that the functional triple pattern came from.
Returns:
true if this FunctionalPredicate will handle (and generate bindings for) this triple pattern; false otherwise.
Throws:
FunctionalPredicateInvocationException

generateSolutions

SolutionSet generateSolutions(IRIReference namedGraph,
                              Variable namedGraphVariable,
                              SolutionSet bindingConstraints)
                              throws GlitterException
Requests that solutions be generated against the default graph, a particular named graph, or spanning the named graphs (with a named graph variable).

Parameters:
namedGraph - If not null, the named graph to use for generating bindings
namedGraphVariable - If not null, the functional predicate should generate solutions that bind this variable to the appropriate graph IRI for each solution generated.
bindingConstraints - Existing constraints on variables. This FunctionalPredicate can assume that the engine will conjoin the solutions it returns with these constraints. (And so can eliminate any solutions that would not add to a result set, if it wishes.)
Returns:
A SolutionSet from generating bindings using the logic of this functional predicate.
Throws:
GlitterException

getCost

double getCost(NodeCostModel costModel)
Parameters:
costModel - The cost model being used to generate an execution plan. This functional predicate can investigate the cost of various other types of nodes using this supplied cost model in order to generate its own estimate.
Returns:
An estimated cost of evaluating this functional-predicate node.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.