org.openanzo.server.repository.query.predicates
Class TextLikePredicate

java.lang.Object
  extended by org.openanzo.server.repository.query.predicates.TextLikePredicate
All Implemented Interfaces:
FunctionalPredicate

public class TextLikePredicate
extends java.lang.Object
implements FunctionalPredicate

Special predicate that allows one to use a SQL like query to match literal values.

  • Example: SELECT ?S WHERE {?s 'test%'}
  • Author:
    Matthew Roy ( mroy@cambridgesemantics.com )

    Constructor Summary
    TextLikePredicate()
               
     
    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 FunctionalPredicate.setFunctionalTriplePattern(TriplePattern).
     java.lang.String getTextQuery()
              Get the query text
     Variable getVariable()
              Get the variable
     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()
               
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    TextLikePredicate

    public TextLikePredicate()
    Method Detail

    initialize

    public void initialize(QueryInformation qi)
    Specified by:
    initialize in interface FunctionalPredicate
    Parameters:
    qi - Information on the current query executing

    canBindGraphVariables

    public boolean canBindGraphVariables()
    Specified by:
    canBindGraphVariables in interface FunctionalPredicate
    Returns:
    true if this FP will handle binding graph variables.

    getVariable

    public Variable getVariable()
    Get the variable

    Returns:
    the variable

    getTextQuery

    public java.lang.String getTextQuery()
    Get the query text

    Returns:
    the textMatch

    generateSolutions

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

    Specified by:
    generateSolutions in interface FunctionalPredicate
    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

    handlesTriplePattern

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

    Specified by:
    handlesTriplePattern in interface FunctionalPredicate
    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

    setFunctionalTriplePattern

    public void setFunctionalTriplePattern(TriplePattern pattern)
                                    throws FunctionalPredicateInvocationException
    Description copied from interface: FunctionalPredicate
    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.

    Specified by:
    setFunctionalTriplePattern in interface FunctionalPredicate
    Parameters:
    pattern - the triple pattern which contains the functional predicate
    Throws:
    FunctionalPredicateInvocationException

    usesDataFromGraphs

    public boolean usesDataFromGraphs()
    Specified by:
    usesDataFromGraphs in interface FunctionalPredicate
    Returns:
    true if this FP needs to examine graphs to get at data

    getCost

    public double getCost(NodeCostModel costModel)
    Specified by:
    getCost in interface FunctionalPredicate
    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.

    getFunctionalTriplePattern

    public TriplePattern getFunctionalTriplePattern()
    Description copied from interface: FunctionalPredicate
    Accessor for the triple pattern set with FunctionalPredicate.setFunctionalTriplePattern(TriplePattern).

    Specified by:
    getFunctionalTriplePattern in interface FunctionalPredicate
    Returns:
    The TriplePattern that contains this functional predicate.


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