psychologyPillar 3 — Materialization (OWL 2 RL)
pgrdf.materialize(graph_id BIGINT, profile TEXT DEFAULT 'owl-rl') → JSONB runs forward-chaining inference (via the reasonable reasoner) over the named graph, and writes every entailed triple back to the same graph with is_inferred = TRUE. The profile argument selects the rule set — 'owl-rl' (default, full OWL 2 RL) or 'rdfs' (RDFS closures only). Both shipped in v0.5.0.
The call is idempotent: re-running drops previously inferred rows first and replaces them. The base graph is never touched.
Topics in this pillar
- info Mental model — how to think about materialization in pgRDF.
- description Worked example — subclass-chain walkthrough you can run in psql.
- psychology OWL 2 RL rule set — what the reasoner actually entails.
- settings Idempotence + operator safety — guarantees you can rely on for scheduled jobs.
- psychology Reasoning profile selector —
pgrdf.materialize(g, profile)—'owl-rl'+'rdfs', shipped v0.5.0.
At a glance
sql
SELECT pgrdf.materialize(100);
-- → {"base_triples": 3, "inferred_triples_written": 11, ...}auto_storiesTraining
Inference is shorter than the other pillars — it's one UDF with a deep semantic. The recommended path is short and linear:
- info Start with the Mental model — what
is_inferred = TRUEreally means and how materialised quads sit alongside base quads. - description Walk through the Worked example — copy-paste-runnable subclass-chain demo, ~20 lines of SQL.
- psychology Then the OWL 2 RL rule set — what the reasoner actually entails in practice (subclass closure, transitive properties, equivalence, inverse, sameAs).
- settings Finish with Idempotence + operator safety — the guarantees you need before scheduling materialisation as a cron job.
- psychology Then Reasoning profile selector — pick
'rdfs'instead of the default'owl-rl'when you want to bound per-graph materialization cost. Shipped v0.5.0.
Learn more
- school OWL 2 Profiles — RL — the W3C profile spec pgRDF implements.
- school OWL 2 RL/RDF Rules — the forward-chaining rules verbatim.
- code
reasonable— the Rust reasoner pgRDF wraps. - school Pascal Hitzler et al., Foundations of Semantic Web Technologies — chapters on OWL 2 RL.
- mic Audio companion — five episodes covering the inference pillar (see Training).