org.eclipse.rdf4j.queryrender

## Class BaseTupleExprRenderer

- java.lang.Object
- - org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor<Exception>
  - - org.eclipse.rdf4j.queryrender.BaseTupleExprRenderer

- All Implemented Interfaces:
    QueryModelVisitor<Exception>
  Direct Known Subclasses:
    SparqlTupleExprRenderer

      public abstract class BaseTupleExprRenderer
      extends AbstractQueryModelVisitor<Exception>

  Base class for rendering RDF4J query API objects into strings.

  Author:
    Michael Grove

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `mDistinct` Whether or not the query is distinct
    `protected Map<String,ValueExpr>` | `mExtensions` A map of the extensions specified in the query.
    `protected long` | `mLimit` The limit of results for the query, or -1 for no limit
    `protected long` | `mOffset` The query offset, or -1 for no offset
    `protected List<OrderElem>` | `mOrdering` The elements specified in the order by clause of the query
    `protected List<ProjectionElemList>` | `mProjection` The list of elements include in the projection of the query
    `protected boolean` | `mReduced` Whether or not the query is reduced

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseTupleExprRenderer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<String,ValueExpr>` | `getExtensions()`
    `long` | `getLimit()`
    `long` | `getOffset()`
    `List<OrderElem>` | `getOrdering()`
    `List<ProjectionElemList>` | `getProjection()`
    `boolean` | `isDistinct()`
    `boolean` | `isReduced()`
    `protected boolean` | `isSelect()` Returns whether or not the results of scanning the query model indicates that this represents a select query
    `static boolean` | `isSPOElemList(ProjectionElemList theList)` Return whether or not this projection looks like an spo binding for a construct query
    `void` | `meet(Distinct theDistinct)`
    `void` | `meet(ExtensionElem theExtensionElem)`
    `void` | `meet(OrderElem theOrderElem)`
    `void` | `meet(ProjectionElemList theProjectionElemList)`
    `void` | `meet(Reduced theReduced)`
    `void` | `meet(Slice theSlice)`
    `void` | `meet(StatementPattern theStatementPattern)`
    `String` | `render(ParsedQuery theQuery)` Render the ParsedQuery as a query string
    `abstract String` | `render(TupleExpr theExpr)` Render the TupleExpr as a query or query fragment depending on what kind of TupleExpr it is
    `protected abstract String` | `renderValueExpr(ValueExpr theExpr)` Render the given ValueExpr
    `void` | `reset()` Reset the state of the renderer
    `static String` | `scrubVarName(String theName)` Scrub any illegal characters out of the variable name
    `StatementPattern` | `toStatementPattern(ProjectionElemList theList)` Turn a ProjectionElemList for a construct query projection (three elements aliased as 'subject', 'predicate' and 'object' in that order) into a StatementPattern.

    - ### Methods inherited from class org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor

      `meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meetBinaryTupleOperator, meetBinaryValueOperator, meetCompareSubQueryValueOperator, meetNAryValueOperator, meetNode, meetOther, meetSubQueryValueOperator, meetUnaryTupleOperator, meetUnaryValueOperator, meetUpdateExpr`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### mExtensions

          protected Map<String,ValueExpr> mExtensions

      A map of the extensions specified in the query.

    - #### mProjection

          protected List<ProjectionElemList> mProjection

      The list of elements include in the projection of the query

    - #### mOrdering

          protected List<OrderElem> mOrdering

      The elements specified in the order by clause of the query

    - #### mDistinct

          protected boolean mDistinct

      Whether or not the query is distinct

    - #### mReduced

          protected boolean mReduced

      Whether or not the query is reduced

    - #### mLimit

          protected long mLimit

      The limit of results for the query, or -1 for no limit

    - #### mOffset

          protected long mOffset

      The query offset, or -1 for no offset

  - ### Constructor Detail

    - #### BaseTupleExprRenderer

          public BaseTupleExprRenderer()

  - ### Method Detail

    - #### reset

          public void reset()

      Reset the state of the renderer

    - #### getExtensions

          public Map<String,ValueExpr> getExtensions()

    - #### getProjection

          public List<ProjectionElemList> getProjection()

    - #### getOrdering

          public List<OrderElem> getOrdering()

    - #### isDistinct

          public boolean isDistinct()

    - #### isReduced

          public boolean isReduced()

    - #### getLimit

          public long getLimit()

    - #### getOffset

          public long getOffset()

    - #### render

          public String render(ParsedQuery theQuery)
                        throws Exception

      Render the ParsedQuery as a query string
      Parameters:
        `theQuery` - the parsed query to render
      Returns:
        the query object rendered in the serql syntax
      Throws:
        `Exception` - if there is an error while rendering

    - #### render

          public abstract String render(TupleExpr theExpr)
                                 throws Exception

      Render the TupleExpr as a query or query fragment depending on what kind of TupleExpr it is
      Parameters:
        `theExpr` - the expression to render
      Returns:
        the TupleExpr rendered in the serql syntax
      Throws:
        `Exception` - if there is an error while rendering

    - #### renderValueExpr

          protected abstract String renderValueExpr(ValueExpr theExpr)
                                             throws Exception

      Render the given ValueExpr
      Parameters:
        `theExpr` - the expr to render
      Returns:
        the rendered expression
      Throws:
        `Exception` - if there is an error while rendering

    - #### toStatementPattern

          public StatementPattern toStatementPattern(ProjectionElemList theList)
                                              throws Exception

      Turn a ProjectionElemList for a construct query projection (three elements aliased as 'subject', 'predicate' and 'object' in that order) into a StatementPattern.
      Parameters:
        `theList` - the elem list to render
      Returns:
        the elem list for a construct projection as a statement pattern
      Throws:
        `Exception` - if there is an exception while rendering

    - #### scrubVarName

          public static String scrubVarName(String theName)

      Scrub any illegal characters out of the variable name
      Parameters:
        `theName` - the potential variable name
      Returns:
        the name scrubbed of any illegal characters

    - #### isSelect

          protected boolean isSelect()

      Returns whether or not the results of scanning the query model indicates that this represents a select query
      Returns:
        true if its a select query, false if its a construct query

    - #### isSPOElemList

          public static boolean isSPOElemList(ProjectionElemList theList)

      Return whether or not this projection looks like an spo binding for a construct query
      Parameters:
        `theList` - the projection element list to inspect
      Returns:
        true if it has the format of a spo construct projection element, false otherwise

    - #### meet

          public void meet(StatementPattern theStatementPattern)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

    - #### meet

          public void meet(Slice theSlice)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

    - #### meet

          public void meet(ExtensionElem theExtensionElem)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

    - #### meet

          public void meet(ProjectionElemList theProjectionElemList)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

    - #### meet

          public void meet(OrderElem theOrderElem)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

    - #### meet

          public void meet(Distinct theDistinct)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

    - #### meet

          public void meet(Reduced theReduced)
                    throws Exception

      Specified by:
        `meet` in interface `QueryModelVisitor<Exception>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<Exception>`
      Throws:
        `Exception`

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.