Package 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:
SparqlQueryRenderer
,SparqlTupleExprRenderer
Base class for rendering RDF4J query API objects into strings.
- Author:
- Michael Grove
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Whether or not the query is distinctA map of the extensions specified in the query.protected long
The limit of results for the query, or -1 for no limitprotected long
The query offset, or -1 for no offsetThe elements specified in the order by clause of the queryprotected List<ProjectionElemList>
The list of elements include in the projection of the queryprotected boolean
Whether or not the query is reduced -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getLimit()
long
boolean
boolean
protected boolean
isSelect()
Returns whether or not the results of scanning the query model indicates that this represents a select querystatic boolean
isSPOElemList
(ProjectionElemList theList) Return whether or not this projection looks like an spo binding for a construct queryvoid
void
meet
(ExtensionElem theExtensionElem) void
void
meet
(ProjectionElemList theProjectionElemList) void
void
void
meet
(StatementPattern theStatementPattern) abstract String
Render the TupleExpr as a query or query fragment depending on what kind of TupleExpr it isrender
(ParsedQuery theQuery) Render the ParsedQuery as a query stringprotected abstract String
renderValueExpr
(ValueExpr theExpr) Render the given ValueExprvoid
reset()
Reset the state of the rendererstatic String
scrubVarName
(String theName) Scrub any illegal characters out of the variable nametoStatementPattern
(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, meet, meetBinaryTupleOperator, meetBinaryValueOperator, meetCompareSubQueryValueOperator, meetNAryValueOperator, meetNode, meetOther, meetSubQueryValueOperator, meetUnaryTupleOperator, meetUnaryValueOperator, meetUpdateExpr
-
Field Details
-
mExtensions
A map of the extensions specified in the query. -
mProjection
The list of elements include in the projection of the query -
mOrdering
The elements specified in the order by clause of the query -
mDistinct
protected boolean mDistinctWhether or not the query is distinct -
mReduced
protected boolean mReducedWhether or not the query is reduced -
mLimit
protected long mLimitThe limit of results for the query, or -1 for no limit -
mOffset
protected long mOffsetThe query offset, or -1 for no offset
-
-
Constructor Details
-
BaseTupleExprRenderer
public BaseTupleExprRenderer()
-
-
Method Details
-
reset
public void reset()Reset the state of the renderer -
getExtensions
-
getProjection
-
getOrdering
-
isDistinct
public boolean isDistinct() -
isReduced
public boolean isReduced() -
getLimit
public long getLimit() -
getOffset
public long getOffset() -
render
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:
Exception
- if there is an error while rendering
-
render
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:
Exception
- if there is an error while rendering
-
renderValueExpr
Render the given ValueExpr- Parameters:
theExpr
- the expr to render- Returns:
- the rendered expression
- Throws:
Exception
- if there is an error while rendering
-
toStatementPattern
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
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
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
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<Exception>
- Overrides:
meet
in classAbstractQueryModelVisitor<Exception>
- Throws:
Exception
-