Beispiel #1
0
 public void Where(MemberExpression member, SparqlVariable v)
 {
     if (CoalescedVariables.ContainsKey(v))
     {
         // If the member may be unbound, we create an optional binding.
         BuildMemberAccessOptional(member);
     }
     else
     {
         // Otherwise we create a normal binding.
         BuildMemberAccess(member);
     }
 }
Beispiel #2
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
                }
            }
        }