Validation checklist and examples
Validate RBlang output and use known-good patterns when writing knowledge maps.
Last updated
<?xml version="1.0" encoding="utf-8"?>
<rbl:kb xmlns:rbl="http://rbl.io/schema/RBLang">
<concept name="Person" type="string"/>
<concept name="Age" type="number"/>
<concept name="Is Eligible" type="truth"/>
<rel name="has age" subject="Person" object="Age"/>
<rel name="is eligible" subject="Person" object="Is Eligible"/>
<concinst name="John" type="Person"/>
<relinst type="has age" subject="John" object="25"/>
<relinst type="is eligible" object="true" cf="100" name="Eligible if 18+">
<condition rel="has age" subject="%S" object="%AGE"/>
<condition expression="%AGE is greater than or equal to 18"/>
</relinst>
</rbl:kb><concept name="Student" type="string"/>
<concept name="Score" type="number"/>
<concept name="Average" type="number"/>
<concept name="Has Data" type="truth"/>
<rel name="has score" subject="Student" object="Score" plural="true"/>
<rel name="has average" subject="Student" object="Average"/>
<rel name="has complete data" subject="Student" object="Has Data"/>
<relinst type="has average" cf="100" name="Calculate average">
<condition expression="countRelationshipInstances(%S, 'has score', *)" value="%COUNT"/>
<condition expression="%COUNT is greater than 0"/>
<condition expression="sumObjects(%S, 'has score', *)" value="%SUM"/>
<condition expression="%SUM / %COUNT" value="%O"/>
</relinst>
<relinst type="has complete data" object="false" cf="100" name="No scores recorded">
<condition expression="countRelationshipInstances(%S, 'has score', *) is equal to 0"/>
</relinst>