Class WhereHandler

    • Constructor Detail

      • WhereHandler

        public WhereHandler​(Query query)
        Constructor.
        Parameters:
        query - The query to manipulate.
      • WhereHandler

        public WhereHandler()
        Creates a where handler with a new query.
    • Method Detail

      • getQueryPattern

        public Element getQueryPattern()
        Get the query pattern from this where handler.
        Returns:
        the query pattern
      • getQuery

        public Query getQuery()
        Returns:
        The query this where handler is using.
      • addAll

        public void addAll​(WhereHandler whereHandler)
        Add all where attributes from the Where Handler argument.
        Parameters:
        whereHandler - The Where Handler to copy from.
      • getElement

        public Element getElement()
        Get the base element from the where clause. If the clause does not contain an element return the element group, otherwise return the enclosed element.
        Returns:
        the base element.
      • getClause

        public ElementGroup getClause()
        Get the element group for the clause. if The element group is not set, create and set it. Public for ExprFactory use.
        Returns:
        The element group.
      • addWhere

        public void addWhere​(TriplePath t)
                      throws java.lang.IllegalArgumentException
        Add the triple path to the where clause
        Parameters:
        t - The triple path to add.
        Throws:
        java.lang.IllegalArgumentException - If the triple path is not a valid triple path for a where clause.
      • addWhere

        public void addWhere​(ValuesHandler values)
                      throws java.lang.IllegalArgumentException
        Add the triple path to the where clause
        Parameters:
        values - The values to add to this where clause.
        Throws:
        java.lang.IllegalArgumentException - If the triple path is not a valid triple path for a where clause.
      • addOptional

        public void addOptional​(TriplePath t)
                         throws java.lang.IllegalArgumentException
        Add an optional triple to the where clause
        Parameters:
        t - The triple path to add.
        Throws:
        java.lang.IllegalArgumentException - If the triple is not a valid triple for a where clause.
      • addOptional

        public void addOptional​(WhereHandler whereHandler)
        Add the contents of a where handler as an optional statement.
        Parameters:
        whereHandler - The where handler to use as the optional statement.
      • addFilter

        public void addFilter​(java.lang.String expression)
                       throws ParseException
        Add an expression string as a filter.
        Parameters:
        expression - The expression string to add.
        Throws:
        ParseException - If the expression can not be parsed.
      • addFilter

        public void addFilter​(Expr expr)
        add an expression as a filter.
        Parameters:
        expr - The expression to add.
      • addSubQuery

        public void addSubQuery​(AbstractQueryBuilder<?> subQuery)
        Add a subquery to the where clause.
        Parameters:
        subQuery - The sub query to add.
      • makeSubQuery

        public ElementSubQuery makeSubQuery​(AbstractQueryBuilder<?> subQuery)
        Convert a subquery into a subquery element.
        Parameters:
        subQuery - The sub query to convert
        Returns:
        THe converted element.
      • addUnion

        public void addUnion​(AbstractQueryBuilder<?> subQuery)
        Add a union to the where clause.
        Parameters:
        subQuery - The subquery to add as the union.
      • addGraph

        public void addGraph​(Node graph,
                             WhereHandler subQuery)
        Add a graph to the where clause.
        Parameters:
        graph - The name of the graph.
        subQuery - The where handler that defines the graph.
      • addGraph

        public void addGraph​(Node graph,
                             TriplePath subQuery)
        Add a graph to the where clause. Short hand for graph { s, p, o }
        Parameters:
        graph - The name of the graph.
        subQuery - A triple path to add to the graph.
      • addBind

        public void addBind​(Expr expr,
                            Var var)
        Add a binding to the where clause.
        Parameters:
        expr - The expression to bind.
        var - The variable to bind it to.
      • addBind

        public void addBind​(java.lang.String expression,
                            Var var)
                     throws ParseException
        Add a binding to the where clause.
        Parameters:
        expression - The expression to bind.
        var - The variable to bind it to.
        Throws:
        ParseException
      • setVars

        public void setVars​(java.util.Map<Var,​Node> values)
        Description copied from interface: Handler
        Set the values for variables managed by the handler implementation. This method is called by the builder to set values handled by this Handler implementation.
        Specified by:
        setVars in interface Handler
        Parameters:
        values - The map of variable to node value.
      • build

        public void build()
        Description copied from interface: Handler
        Called by the build process for this handler to perform any adjustments to the query before the build completes. The adjustments are made after setVars() has been called.
        Specified by:
        build in interface Handler
      • list

        public Node list​(java.lang.Object... objs)
        Create a list node from a list of objects as per RDF Collections. http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#collections
        Parameters:
        objs - the list of objects for the list.
        Returns:
        the first blank node in the list.
      • addMinus

        public void addMinus​(AbstractQueryBuilder<?> qb)
        Add a minus operation to the where clause. The prolog will be updated with the prefixes from the abstract query builder.
        Parameters:
        qb - the abstract builder that defines the data to subtract.
      • addValueVar

        public void addValueVar​(PrefixMapping prefixMapping,
                                java.lang.Object var)
      • addValueVar

        public void addValueVar​(PrefixMapping prefixMapping,
                                java.lang.Object var,
                                java.lang.Object... objects)
      • addValueVars

        public <K extends java.util.Collection<?>> void addValueVars​(PrefixMapping prefixMapping,
                                                                     java.util.Map<?,​K> dataTable)
      • addValueRow

        public void addValueRow​(PrefixMapping prefixMapping,
                                java.lang.Object... values)
      • addValueRow

        public void addValueRow​(PrefixMapping prefixMapping,
                                java.util.Collection<?> values)
      • getValuesVars

        public java.util.List<Var> getValuesVars()
      • getValuesMap

        public java.util.Map<Var,​java.util.List<Node>> getValuesMap()
      • clearValues

        public void clearValues()