Class QueryTransformOps

java.lang.Object
org.apache.jena.sparql.syntax.syntaxtransform.QueryTransformOps

public class QueryTransformOps extends Object
Support for transformation of query abstract syntax.
  • 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.g AS ?var or used in VALUES).
      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 from Var variable to replacement Node. 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 replacement RDFNode (a Resource (or blank node) or a Literal).
    • transform

      public static Query transform(Query query, NodeTransform transform)
      Transform a query using a generic NodeTransform.
    • transform

      public static Query transform(Query query, ElementTransform transform)
    • transform

      public static Query transform(Query query, ElementTransform transform, ExprTransform exprTransform)
      Transform a query using ElementTransform and ExprTransform. It is the responsibility of these transforms to transform to a legal SPARQL query.
    • shallowCopy

      public static Query shallowCopy(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.