Ejemplo n.º 1
0
        public void BindSelectVariables()
        {
            IsBound = true;

            if (SelectBuilder != null)
            {
                bool hasAggregate = SelectedVariables.Any(v => v.IsAggregate);

                foreach (SparqlVariable v in SelectedVariables)
                {
                    if (CoalescedVariables.ContainsKey(v))
                    {
                        SparqlExpression defaultValue = CoalescedVariables[v];

                        SelectBuilder.And(e => e.Coalesce(e.Variable(v.Name), defaultValue)).As(v.Name + '_');
                    }
                    else
                    {
                        SelectBuilder.And(v);
                    }

                    if (hasAggregate && !v.IsAggregate)
                    {
#if !NET35
                        SelectBuilder.GroupBy(v.Name);
#else
                        QueryBuilder.GroupBy(v.Name);
#endif
                    }
                }

                if (hasAggregate && !IsRoot)
                {
#if !NET35
                    SelectBuilder.Distinct();
#else
                    QueryBuilder.Distinct();
#endif
                }
            }
        }