Module org.apache.jena.arq
Class QueryTransformOps
java.lang.Object
org.apache.jena.sparql.syntax.syntaxtransform.QueryTransformOps
Support for transformation of query abstract syntax.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic QueryqueryReplaceVars(Query query, Map<String, ? extends org.apache.jena.rdf.model.RDFNode> substitutions) Transform a query based on a mapping from variable name to replacementRDFNode(aResource(or blank node) or aLiteral).static QueryreplaceVars(Query query, Map<Var, ? extends org.apache.jena.graph.Node> substitutions) Transform a query based on a mapping fromVarvariable to replacementNode.static QueryshallowCopy(Query query) Return a new query object with copies of prefixes, base and dataset description and shares patterns and results clause (SELECT query) with the original.static QuerysyntaxSubstitute(Query input, Map<Var, ? extends org.apache.jena.graph.Node> substitutions) Replace variables in a query by RDF terms.static Querytransform(Query query, NodeTransform transform) Transform a query using a generic NodeTransform.static Querytransform(Query query, ElementTransform transform) static Querytransform(Query query, ElementTransform transform, ExprTransform exprTransform) Transform a query usingElementTransformandExprTransform.
-
Constructor Details
-
QueryTransformOps
public QueryTransformOps()
-
-
Method Details
-
syntaxSubstitute
public static Query syntaxSubstitute(Query input, Map<Var, ? extends org.apache.jena.graph.Node> substitutions) Replace variables in a query by RDF terms. The replacements are added to the return queries SELECT clause if the query is a SELECT query.- Throws:
QueryScopeException- if the query contains variables used in a way that does not allow substitution (.e.gAS ?varor used inVALUES).- See Also:
-
replaceVars
public static Query replaceVars(Query query, Map<Var, ? extends org.apache.jena.graph.Node> substitutions) Transform a query based on a mapping fromVarvariable to replacementNode. The replacement can be a constant or another variable.To change the query to record the substitutions made, use
syntaxSubstitute(Query,Map).- Throws:
QueryScopeException- if the query contains variables used in a way that does not allow constant substitution.
-
queryReplaceVars
public static Query queryReplaceVars(Query query, Map<String, ? extends org.apache.jena.rdf.model.RDFNode> substitutions) Transform a query based on a mapping from variable name to replacementRDFNode(aResource(or blank node) or aLiteral). -
transform
Transform a query using a generic NodeTransform. -
transform
-
transform
Transform a query usingElementTransformandExprTransform. It is the responsibility of these transforms to transform to a legal SPARQL query. -
shallowCopy
Return a new query object with copies of prefixes, base and dataset description and shares patterns and results clause (SELECT query) with the original.
-