/// <summary>
        /// Formats a SPARQL ORDER BY Clause
        /// </summary>
        /// <param name="orderBy">ORDER BY Clause</param>
        /// <returns></returns>
        protected virtual String FormatOrderBy(ISparqlOrderBy orderBy)
        {
            StringBuilder output = new StringBuilder();

            if (orderBy.Descending)
            {
                output.Append("DESC(");
                output.Append(this.FormatExpression(orderBy.Expression));
                output.Append(')');
            }
            else 
            {
                output.Append("ASC(");
                output.Append(this.FormatExpression(orderBy.Expression));
                output.Append(')');
            }

            if (orderBy.Child != null)
            {
                output.Append(' ');
                output.Append(this.FormatOrderBy(orderBy.Child));
            }

            return output.ToString();
        }
Example #2
0
 /// <summary>
 /// Creates a new Order By clause
 /// </summary>
 /// <param name="pattern">Pattern</param>
 /// <param name="ordering">Ordering</param>
 public OrderBy(ISparqlAlgebra pattern, ISparqlOrderBy ordering)
 {
     this._pattern = pattern;
     this._ordering = ordering;
 }