For the complete documentation index, see llms.txt. This page is also available as Markdown.

Validation checklist and examples

Validate RBlang output and use known-good patterns when writing knowledge maps.

Best practices

Always define elements in this order:

  1. Concepts

  2. Relationships

  3. Concept instances for string concepts

  4. Relationship instances and rules

Keep naming consistent:

  • Concepts in title case, such as Person or Product Category

  • Relationships in lowercase, such as has age or purchased product

  • Natural English names throughout

Keep the graph connected. Every concept should appear in at least one relationship.

Validation checklist

Use this checklist before you save or share generated RBlang.

  1. All concepts are defined before use.

  2. Only string, number, date, and truth are used.

  3. All relationship names are unique.

  4. Concept and relationship names read naturally.

  5. No concept instances exist for number, date, or truth concepts.

  6. Concepts use the right level of abstraction.

  7. Every referenced concept exists.

  8. Every referenced concept instance exists.

  9. Relationships are defined before facts and rules use them.

  10. Relationship subjects always reference string concepts.

  11. Primitive object values are used directly where needed.

  12. Rule variables stay consistent throughout the rule.

  13. Object values match the relationship object type.

  14. String literals in expressions use single quotes.

  15. Assignment uses the value attribute.

  16. Missing facts are tested with countRelationshipInstances().

  17. Rules work for the general case.

  18. Expressions use supported syntax only.

  19. Each required query has a matching relationship.

  20. Every concept is connected to the graph.

Example: age-based eligibility

Example: list aggregation with a missing fact check

Authoring pattern for LLMs

When generating RBlang, prefer this flow:

  1. Declare all concepts.

  2. Declare all relationships.

  3. Add string concept instances only.

  4. Add facts.

  5. Add rules last.

This reduces cross-reference errors and makes validation simpler.

Last updated