// The try covers setup as well as the displayed example. try { // Querying needs an allowed document and an absent user for FALSE explanations. const engine = keepEngine(await Engine.create({ profile: 'small' })) registerDocuments(engine) const ruleset = engine.loadInlineRuleset(documentDomain, 'reference-context', documentPolicy) const input = ruleset.edb() input.addFact('user', ['alice']) input.addFact('user', ['mallory']) input.addFact('owns', ['alice', 'roadmap.pdf']) /* API_REFERENCE_EXAMPLE */ } finally { // Engine.close cascades to every ruleset, input, session and result it owns. closeEngines() }