cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS Select AS (alias) and text-qualifying spaces

dhartford
Champ on-the-rise
Champ on-the-rise
Hey all,
I'm working through some scenarios with CMIS, and I ran into this scenario – not sure if this is CMIS spec oriented, or Alfresco impl, but hopefully at least raising it up unless someone else found a workaround:

Intent: Return the 'Display Name' as the alias for each return column.

String query1 = "SELECT " + propertyDefinition.getId(); //works

String query2 = "SELECT " + propertyDefinition.getId() + " AS '" + propertyDefinition.getDisplayName()+"' "; //surrounding with single quotes for displayname with spaces failing with errors.

String query3 = "SELECT " + propertyDefinition.getId() + " AS \"" + propertyDefinition.getDisplayName()+"\" "; //surrounding with double quotes for displaynames with spaces failing with errors.

String query4 = "SELECT " + queryFragment.append(propertyDefinition.getId() + " AS z_" + propertyDefinition.getLocalName(); //localName seems to always be a single word (no space).  Error with cmis:name's localname of 'name', so prefix with z_ worked around for demonstration purposes.

Summary: I do not seem to be able to provide column alias on the SELECT portion that contains spaces.

-Darren
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
That is correct. You cannot use a column alias that contains a space. According to the spec, a column alias must conform to the same rules as the query name. Here are the rules for query names as specified in the 1.1 draft:
All properties MUST supply a string queryName attribute which is used for query and filter operations on
object-types. This is an opaque string with limitations. This string SHOULD NOT contain any characters
that negatively interact with the BNF grammar.
The string MUST NOT contain:
• whitespace " "
• comma ","
• double quotes '"'
• single quotes "'"
• backslash "\"
• the period "."
• the open "(" or close ")" parenthesis characters

Jeff