ISSUE-32 (curly braces in joinCondition): Remove the use of curly braces in joinCondition [R2RML]

ISSUE-32 (curly braces in joinCondition): Remove the use of curly braces in joinCondition [R2RML]

Raised by: David McNeil
On product: R2RML

Section of the R2RML draft describes rr:joinCondition syntax as:

"Case-sensitive column names must be enclosed within curly braces. Also, the column names specified must follow either "child." or "parent.""

The use of curly braces here does not seem helpful and in fact from an implementation perspective we see it as harmful.

1) It diverges from the rest of the R2RML spec which follows section 1.3 "In places where SQL expressions are allowed, these MUST conform to Core SQL 2008."

2) Leaving off the curly braces allows the joinCondition to be parsed as SQL (rather than requiring either a parser for a custom grammar, or a pre-processing step that removes the curly braces).

3) The usage of curly braces in joinCondition seems particularly odd since they are used to delimit the column names, but the column names are not what needs to be changed. It is the table names that need to be changed in order to execute the SQL.

I suspect that the motivation for introducing the curly braces is to avoid parsing the joinCondition (i.e. "just do a search and replace"), but this is not a generally correct approach (e.g. the SQL query could include "{x}" in a string literal). If an implementor wants to do search and replace then they could just do search and replace on "child." and "parent." One could argue that this is more likely to give a wrong answer than using curly braces, but it is just an odds game, they are both incorrect solutions in general. Also note that the "search and replace" solution is severely hampered by the fact that the curly braces are around the column identifier rather than the table identifier.

A correct solution to processing the joinCondition requires parsing the joinCondition. Using a standard grammar for the joinCondition means a standard parser can be used to parse it. Therefore, we suggest changing the spec to remove the use of curly braces in joinCondition.

NOTE: This discussion is based on the premise described in that the joinCondition can include arbitrarily complex SQL expressions, not just the simple "child.{x} = parent.{x}".

Received on Thursday, 10 March 2011 16:41:04 UTC