CNL Syntax Guide
Controlled Natural Language (CNL) is the core syntax used in NodeBook to express knowledge in a structured yet readable way. This guide explains the syntax rules and provides examples for different difficulty levels.
What is CNL?
CNL is a simplified, structured form of natural language that allows you to express complex relationships in a way that's both human-readable and machine-processable. It combines the clarity of natural language with the precision of formal logic.
Basic Syntax Elements
Relations
Relations connect nodes to show how they relate to each other.
Syntax: <relation_name> target_node
Examples:
Attributes
Attributes describe properties of nodes.
Syntax: has attribute_name: value
Examples:
Adverbs (Advanced/Expert Levels)
Adverbs modify relations to add detail about how, when, or to what extent something happens.
Syntax: ++adverb++ <relation> target
Examples:
Quantifiers (Advanced/Expert Levels)
Quantifiers specify the amount or scope of a relation.
Syntax: quantifier <relation> target
Common quantifiers: all, some, many, few, most, none
Examples:
Modality (Expert Level Only)
Modality expresses uncertainty, possibility, or necessity.
Syntax: [modality] <relation> target or has attribute: value [modality]
Common modalities: [possible], [necessary], [likely], [certain], [uncertain]
Examples:
Complex Structures
Multiple Relations
You can express multiple relations for the same node:
Nested Structures
For complex relationships, you can nest structures:
Conditional Statements
Express conditional relationships:
Difficulty Level Examples
Easy Level
At the easy level, focus on basic relations and attributes:
Moderate Level
Add adjectives (qualifiers) to provide more detail:
red heart <pumps> oxygenated blood
large vessels <carry> nutrients
small capillaries <exchange> gases
Advanced Level
Include adverbs and quantifiers for precision:
heart ++efficiently++ <pumps> blood
all vessels <carry> oxygen
some blood ++quickly++ <flows> through arteries
Expert Level
Use all features including modality for sophisticated expressions:
heart [likely] ++efficiently++ <pumps> blood
all vessels [necessary] <carry> oxygen
some blood [possible] ++quickly++ <flows> through arteries
heart has temperature: 37 degrees [likely]
Best Practices
Clarity
- Use clear, descriptive relation names
- Be specific about what you're describing
- Avoid ambiguous terms
Consistency
- Use consistent naming conventions
- Apply similar patterns across related concepts
- Maintain logical relationships
Completeness
- Include all relevant attributes
- Specify relationships clearly
- Add context where helpful
Accuracy
- Verify your knowledge before expressing it
- Use appropriate quantifiers and modalities
- Check that relationships make logical sense
Common Patterns
Part-Whole Relationships
Cause-Effect Relationships
Property Relationships
Process Relationships
Tips for Writing CNL
- Start Simple: Begin with basic relations and add complexity gradually
- Be Specific: Use precise terms rather than vague ones
- Check Logic: Ensure your relationships make logical sense
- Use Examples: Look at existing CNL in your graph for patterns
- Test Understanding: Try reading your CNL aloud to see if it makes sense
Common Mistakes to Avoid
- Inconsistent naming: Use the same terms for the same concepts
- Missing context: Include enough detail to be clear
- Over-complication: Don't add unnecessary complexity
- Logical errors: Ensure relationships are logically sound
- Ambiguous references: Be clear about what you're referring to
Getting Help with CNL
- Use the parse button (when available) to validate your syntax
- Check the CNL view to see how your knowledge is structured
- Look at examples in existing graphs
- Start with simple patterns and build up complexity
- Ask for help if you're unsure about syntax
Remember: CNL is designed to be readable and logical. If your CNL doesn't make sense when you read it, it probably needs to be revised!