private static IEnumerable <Pair <PrimitiveValue, SubstitutionSet> > CountPropertyCalculator(KB kb, Name perspective, IDictionary <string, Name> args, IEnumerable <SubstitutionSet> constraints)
{
var arg = args["x"];
var set = kb.AskPossibleProperties(arg, perspective, constraints).ToList();
PrimitiveValue count = set.Count;
IEnumerable <SubstitutionSet> sets;
if (set.Count == 0)
{
sets = constraints;
}
else
{
sets = set.SelectMany(s => s.Item2).Distinct();
}
foreach (var d in sets)
{
yield return(Tuples.Create(count, d));
}
}