| 221 | } |
| 222 | |
| 223 | func (sc SimpleColumn) writeHeader(preds []ast.PredicateSym, predFactCount []int, w io.Writer) error { |
| 224 | // line 1. <number of predicates> |
| 225 | if _, err := fmt.Fprintf(w, "%d\n", len(preds)); err != nil { |
| 226 | return err |
| 227 | } |
| 228 | // line 1 + i. <predicate #i name> <arity> <num facts> |
| 229 | for i, p := range preds { |
| 230 | if _, err := fmt.Fprintf(w, "%s %d %d\n", p.Symbol, p.Arity, predFactCount[i]); err != nil { |
| 231 | return err |
| 232 | } |
| 233 | } |
| 234 | return nil |
| 235 | } |
| 236 | |
| 237 | // WriteTo writes contents of a fact store to the writer. It only |
| 238 | // calls the ListPredicates and GetFacts methods on the store. |