Class BaseTupleExprRenderer

    • Field Detail

      • mExtensions

        protected java.util.Map<java.lang.String,​ValueExpr> mExtensions
        A map of the extensions specified in the query.
      • mProjection

        protected java.util.List<ProjectionElemList> mProjection
        The list of elements include in the projection of the query
      • mOrdering

        protected java.util.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 java.util.Map<java.lang.String,​ValueExpr> getExtensions()
      • getOrdering

        public java.util.List<OrderElem> getOrdering()
      • isDistinct

        public boolean isDistinct()
      • isReduced

        public boolean isReduced()
      • getLimit

        public long getLimit()
      • getOffset

        public long getOffset()
      • render

        public java.lang.String render​(ParsedQuery theQuery)
                                throws java.lang.Exception
        Render the ParsedQuery as a query string
        Parameters:
        theQuery - the parsed query to render
        Returns:
        the query object rendered in the query language syntax
        Throws:
        java.lang.Exception - if there is an error while rendering
      • render

        public abstract java.lang.String render​(TupleExpr theExpr)
                                         throws java.lang.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 query language syntax
        Throws:
        java.lang.Exception - if there is an error while rendering
      • renderValueExpr

        protected abstract java.lang.String renderValueExpr​(ValueExpr theExpr)
                                                     throws java.lang.Exception
        Render the given ValueExpr
        Parameters:
        theExpr - the expr to render
        Returns:
        the rendered expression
        Throws:
        java.lang.Exception - if there is an error while rendering
      • toStatementPattern

        public StatementPattern toStatementPattern​(ProjectionElemList theList)
                                            throws java.lang.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:
        java.lang.Exception - if there is an exception while rendering
      • scrubVarName

        public static java.lang.String scrubVarName​(java.lang.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
      • asValue

        private Value asValue​(ValueExpr theValue)
                       throws java.lang.Exception
        Return the ValueExpr as a Value if possible.
        Parameters:
        theValue - the ValueExpr to convert
        Returns:
        the expression as a Value, or null if it cannot be converted
        Throws:
        java.lang.Exception - if there is an error converting to a Value
      • 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