For anyone who finds it hard to parse the query results
The results returned by queries run on the fact base of the Inference engine are pretty hard to parse, mainly because they are not evenly structured like a regular RDBMS-backed row set. This is because each result (equivalent to a row) can contain a variable number of facts (equivalent to a variable number of columns).
The following code fragment hopefully demonstrates how to make sense of a query result set:
public static void DumpResult(IList<IList<Fact>> qrs) {
int i = 0;
Console.WriteLine("-(Query Results) -");
foreach(IList<Fact> facts in qrs) {
i++;
Console.WriteLine(" (Result #{0})", i);
foreach(Fact fact in facts) Console.WriteLine(" {0}", fact);
}
Console.WriteLine("-(End Results)-\n");
}