private static void SourceFromPredicateInfo(PredicateIndicator p, PredicateInfo predicateInfo, ISOPrologWriter writer)
{
foreach (var knowledgeBaseEntry in predicateInfo.Entries)
{
var rule = (KnowledgeBaseRule)knowledgeBaseEntry;
var head = new Structure(p.Functor, rule.HeadArgs);
Structure structure;
if (rule.BodyGoals == null || rule.BodyGoals.Length == 0)
{
structure = head;
}
else
{
structure = new Structure(Symbol.Implication, head, Commafy(rule.BodyGoals));
}
writer.Write(structure);
writer.WriteString(".\n");
}
}