// The try covers setup as well as the displayed example. try { // Page reference context; document-access declarations from Full program. const engine = keepEngine(await Engine.create({ profile: 'small' })) engine.registerDomain('documents', [ Predicate.edb('user', 1), Predicate.edb('owns', 2), Predicate.edb('blocked', 1), Predicate.idbQuery('allow', 2), ], []) const ruleset = engine.loadInlineRuleset('documents', 'reference-context', 'allow(User, Doc) :- owns(User, Doc), not(blocked(User)).') /* API_REFERENCE_EXAMPLE */ } finally { // Engine.close cascades to every ruleset, input, session and result it owns. closeEngines() }