org.d2rq.lang
Class Microsyntax

java.lang.Object
  extended by org.d2rq.lang.Microsyntax

public class Microsyntax
extends Object

Static methods for handling various microsyntaxes used in the D2RQ mapping language.

Author:
Richard Cyganiak (richard@cyganiak.de)

Method Summary
static ColumnName createColumn(String p1, String p2, String p3)
          Assumes schema, table, column names without quotes or escape characters.
static AliasDeclaration parseAlias(String expression)
          Parses a SQL "foo AS bar" expression (for d2rq:alias).
static ColumnName parseColumn(String s)
          Parses a column in [Schema.]Table.Column notation.
static List<ColumnName> parseColumnList(String commaSeparated)
          Parses a comma-separated list of column names, e.g., for bNodeIdColumns
static Expression parseSQLExpression(String expression, DataType.GenericType dataType)
          Parses a SQL expression, such as "table1.foo > 0", and returns a corresponding Expression.
static TableName parseTable(String s)
          Constructs a table name from a fully qualified name in [[catalog.]schema.]table notation.
static String toString(ColumnName column)
          Returns a [schema.]table.column string representation.
static String toString(TableName tableName)
          Returns a [schema.]table string representation.
static String toString(TableName tableName, Identifier column)
          Returns a [schema.]table.column string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseColumnList

public static List<ColumnName> parseColumnList(String commaSeparated)
Parses a comma-separated list of column names, e.g., for bNodeIdColumns


parseTable

public static TableName parseTable(String s)
Constructs a table name from a fully qualified name in [[catalog.]schema.]table notation. Delimiters may not be used.


toString

public static String toString(TableName tableName)
Returns a [schema.]table string representation. No quoting or escaping. Suitable for use in D2RQ mapping files, but not for SQL.


toString

public static String toString(TableName tableName,
                              Identifier column)
Returns a [schema.]table.column string representation. No quoting or escaping. Suitable for use in D2RQ mapping files, but not for SQL.


toString

public static String toString(ColumnName column)
Returns a [schema.]table.column string representation. No quoting or escaping. Suitable for use in D2RQ mapping files, but not for SQL.


parseColumn

public static ColumnName parseColumn(String s)
Parses a column in [Schema.]Table.Column notation. Allows no quotes or escaping. Allows no catalog. Assumes case sensitive. Must be qualified with a table name.


parseSQLExpression

public static Expression parseSQLExpression(String expression,
                                            DataType.GenericType dataType)
Parses a SQL expression, such as "table1.foo > 0", and returns a corresponding Expression. Column names must be qualified with table (and optional schema), and must be given without quotes or escapes. Some effort is being made to avoid misidentifying columns inside string literals, but it's safest to write the expression so that it doesn't contain anything looking like a qualified column name elsewhere.


createColumn

public static ColumnName createColumn(String p1,
                                      String p2,
                                      String p3)
Assumes schema, table, column names without quotes or escape characters. Will yield a reference to column "p1"."p2"."p3" in standard SQL, with p1 and p2 optional.


parseAlias

public static AliasDeclaration parseAlias(String expression)
Parses a SQL "foo AS bar" expression (for d2rq:alias).