本文整理汇总了C#中ISparqlExpression.EffectiveBooleanValue方法的典型用法代码示例。如果您正苦于以下问题:C# ISparqlExpression.EffectiveBooleanValue方法的具体用法?C# ISparqlExpression.EffectiveBooleanValue怎么用?C# ISparqlExpression.EffectiveBooleanValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISparqlExpression
的用法示例。
在下文中一共展示了ISparqlExpression.EffectiveBooleanValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LeftJoin
/// <summary>
/// Does a Left Join of this Multiset to another Multiset where the Join is predicated on the given Expression
/// </summary>
/// <param name="other">Other Multiset</param>
/// <param name="expr">Expression</param>
/// <returns></returns>
public override BaseMultiset LeftJoin(BaseMultiset other, ISparqlExpression expr)
{
//If the Other is the Identity/Null Multiset the result is this Multiset
if (other is IdentityMultiset) return this;
if (other is NullMultiset) return this;
if (other.IsEmpty) return this;
Multiset joinedSet = new Multiset();
LeviathanLeftJoinBinder binder = new LeviathanLeftJoinBinder(joinedSet);
SparqlEvaluationContext subcontext = new SparqlEvaluationContext(binder);
//Find the First Variable from this Multiset which is in both Multisets
//If there is no Variable from this Multiset in the other Multiset then this
//should be a Join operation instead of a LeftJoin
List<String> joinVars = this._variables.Where(v => other.Variables.Contains(v)).ToList();
if (joinVars.Count == 0)
{
//Calculate a Product filtering as we go
foreach (ISet x in this.Sets)
{
bool standalone = false;
foreach (ISet y in other.Sets)
{
ISet z = x.Join(y);
try
{
joinedSet.Add(z);
if (!expr.EffectiveBooleanValue(subcontext, z.ID))
{
joinedSet.Remove(z.ID);
standalone = true;
}
}
catch
{
joinedSet.Remove(z.ID);
standalone = true;
}
}
if (standalone) joinedSet.Add(x);
}
}
else
{
foreach (ISet x in this.Sets)
{
IEnumerable<ISet> ys = other.Sets.Where(s => joinVars.All(v => x[v] == null || s[v] == null || x[v].Equals(s[v])));
//IEnumerable<ISet> ys = other.Sets.Where(s => s.IsCompatibleWith(x, joinVars));
bool standalone = false;
int i = 0;
foreach (ISet y in ys)
{
i++;
ISet z = x.Join(y);
try
{
joinedSet.Add(z);
if (!expr.EffectiveBooleanValue(subcontext, z.ID))
{
joinedSet.Remove(z.ID);
standalone = true;
}
}
catch
{
joinedSet.Remove(z.ID);
standalone = true;
}
}
if (standalone || i == 0) joinedSet.Add(x);
}
}
return joinedSet;
}