Read an ODRL policy as sentences

PROSE: Prose Rendering for ODRL Semantic Representation. ds-prose-rs reads an ODRL JSON-LD policy and writes it as plain-language sentences that say who may, must not or must do what, and under which conditions. It is a Rust library with a Yew component, a WebAssembly bridge, and an Angular component. It does not decide whether an action is allowed, and it ships no stylesheet for the rendered sentences.

A policy and its sentences #

The policy below is a fixture of the repository. The sentences under it are the renderer's output for that policy, stored in site/content/examples/offer.html. A Rust test renders the policy again on every cargo test and fails if the stored output is stale. The page styles them with the example stylesheet from the CSS hooks pages.

Input #

{
  "@context": "http://www.w3.org/ns/odrl.jsonld",
  "@type": "Offer",
  "uid": "http://example.com/policy:1010",
  "profile": "http://example.com/odrl:profile:01",
  "assigner": "http://example.com/org:abc",
  "permission": [{
    "target": "http://example.com/asset:9898.movie",
    "action": "display",
    "constraint": [{
      "leftOperand": "dateTime",
      "operator": "lt",
      "rightOperand": { "@value": "2026-12-31", "@type": "xsd:date" }
    }],
    "duty": [{
      "action": "attribute",
      "target": "http://example.com/asset:9898.movie"
    }]
  }]
}

Rendered #

Offer http://example.com/policy:1010

An offer made by abc.

  • Written to the profile http://example.com/odrl:profile:01.
  1. Anyone may display 9898.movie, as permitted by the assigner abc.

    Applies only if:

    • the date and time are before the start of 2026-12-31

    Duties to fulfil before this permission can be exercised:

    • The assignee must attribute 9898.movie, as required by the assigner abc.

Where to go #

Install #

cargo add prose-yew
npm install @ds-labs/prose-angular

Where it runs #

PackageVersionWhat it exposes
prose-yew (crate)0.5.1OdrlProse, OdrlProseView, ProseGlossary, ProseProblems, the editor hooks and BASE_CSS.
@ds-labs/prose-wasm (npm)0.5.1ProseHandle for the read-only renderer, ProseValidator, validate, rules, and the ds-prose-validate command. No editor.
@ds-labs/prose-angular (npm)0.5.1The ds-odrl-prose component and ProseValidatorService. Read-only, client-side only.