Class SparqlTupleExprRenderer
- java.lang.Object
-
- org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor<java.lang.Exception>
-
- org.eclipse.rdf4j.queryrender.BaseTupleExprRenderer
-
- org.eclipse.rdf4j.queryrender.sparql.SparqlTupleExprRenderer
-
- All Implemented Interfaces:
QueryModelVisitor<java.lang.Exception>
public final class SparqlTupleExprRenderer extends BaseTupleExprRenderer
Extends the BaseTupleExprRenderer to provide support for rendering tuple expressions as SPARQL queries.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<TupleExpr,Var>mContextsprivate intmIndentprivate java.lang.StringBuffermJoinBuffer-
Fields inherited from class org.eclipse.rdf4j.queryrender.BaseTupleExprRenderer
mDistinct, mExtensions, mLimit, mOffset, mOrdering, mProjection, mReduced
-
-
Constructor Summary
Constructors Constructor Description SparqlTupleExprRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidctxClose(TupleExpr theExpr)private voidctxOpen(TupleExpr theExpr)private java.lang.Stringindent()voidmeet(AggregateFunctionCall node)voidmeet(And node)voidmeet(ArbitraryLengthPath node)voidmeet(Bound node)voidmeet(Compare node)voidmeet(Datatype node)voidmeet(Difference theOp)voidmeet(Extension node)voidmeet(ExtensionElem node)voidmeet(Filter theFilter)voidmeet(FunctionCall node)voidmeet(If theOp)voidmeet(In node)voidmeet(Intersection theOp)voidmeet(IRIFunction node)voidmeet(IsBNode node)voidmeet(IsLiteral node)voidmeet(IsNumeric node)voidmeet(IsURI node)voidmeet(Join theJoin)voidmeet(Lang node)voidmeet(LangMatches node)voidmeet(LeftJoin theJoin)voidmeet(Or node)voidmeet(Regex node)voidmeet(SameTerm node)voidmeet(StatementPattern thePattern)voidmeet(Str node)voidmeet(Union theOp)voidmeet(ValueConstant node)voidmeet(Var node)java.lang.Stringrender(TupleExpr theExpr)Render the TupleExpr as a query or query fragment depending on what kind of TupleExpr it is(package private) java.lang.StringrenderPattern(StatementPattern thePattern)private java.lang.StringrenderTupleExpr(TupleExpr theExpr)Renders the tuple expression as a query string.protected java.lang.StringrenderValueExpr(ValueExpr theExpr)Render the given ValueExprvoidreset()Reset the state of the renderer-
Methods inherited from class org.eclipse.rdf4j.queryrender.BaseTupleExprRenderer
getExtensions, getLimit, getOffset, getOrdering, getProjection, isDistinct, isReduced, isSelect, isSPOElemList, meet, meet, meet, meet, meet, render, scrubVarName, toStatementPattern
-
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, meetBinaryTupleOperator, meetBinaryValueOperator, meetCompareSubQueryValueOperator, meetNAryValueOperator, meetNode, meetOther, meetSubQueryValueOperator, meetUnaryTupleOperator, meetUnaryValueOperator, meetUpdateExpr
-
-
-
-
Method Detail
-
reset
public void reset()
Reset the state of the renderer- Overrides:
resetin classBaseTupleExprRenderer
-
render
public 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- Specified by:
renderin classBaseTupleExprRenderer- 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
-
indent
private java.lang.String indent()
-
renderValueExpr
protected java.lang.String renderValueExpr(ValueExpr theExpr) throws java.lang.Exception
Render the given ValueExpr- Specified by:
renderValueExprin classBaseTupleExprRenderer- Parameters:
theExpr- the expr to render- Returns:
- the rendered expression
- Throws:
java.lang.Exception- if there is an error while rendering
-
ctxOpen
private void ctxOpen(TupleExpr theExpr)
-
ctxClose
private void ctxClose(TupleExpr theExpr)
-
meet
public void meet(Join theJoin) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(LeftJoin theJoin) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
renderTupleExpr
private java.lang.String renderTupleExpr(TupleExpr theExpr) throws java.lang.Exception
Renders the tuple expression as a query string. It creates a new SparqlTupleExprRenderer rather than reusing this one.- Parameters:
theExpr- the expr to render- Returns:
- the rendered expression
- Throws:
java.lang.Exception- if there is an error while rendering
-
meet
public void meet(Union theOp) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Difference theOp) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Intersection theOp) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Filter theFilter) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(StatementPattern thePattern) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classBaseTupleExprRenderer- Throws:
java.lang.Exception
-
meet
public void meet(Extension node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(ExtensionElem node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classBaseTupleExprRenderer- Throws:
java.lang.Exception
-
meet
public void meet(FunctionCall node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(AggregateFunctionCall node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(And node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Or node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Compare node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Bound node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(If theOp) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(In node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(SameTerm node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(IsURI node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(IsBNode node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(IsLiteral node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(IsNumeric node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Datatype node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(IRIFunction node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Str node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Regex node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Lang node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(LangMatches node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(ArbitraryLengthPath node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(ValueConstant node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
meet
public void meet(Var node) throws java.lang.Exception
- Specified by:
meetin interfaceQueryModelVisitor<java.lang.Exception>- Overrides:
meetin classAbstractQueryModelVisitor<java.lang.Exception>- Throws:
java.lang.Exception
-
renderPattern
java.lang.String renderPattern(StatementPattern thePattern) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-