Python V1 · Deprecated

Rulesets

Rulesets in the Python V1 binding.

The Python V1 rulesets reference continues the Python V1 overview.

Ruleset loading

CODE
ruleset = engine.load_inline_ruleset(
    'document_access', 'doc.main',
    'allow(User, Document) :- owns(User, Document).\n')

load_inline_ruleset(domain, ruleset_id, source) compiles the Datalog rules in source — the .dl program text, e.g. 'allow(User, Document) :- owns(User, Document).' — against the predicates declared for domain, and returns a Ruleset. Raises MaelysDatalogError (see Diagnostics) on a parse or validation failure — no lengthBytesUTF8 bookkeeping to get right, Python strings already carry their own length. The source accepts the full policy source language, including the bounded or disjunction in rule bodies.