Reasoning profiles
pgrdf.materialize takes an optional profile argument that picks the rule set for that call:
pgrdf.materialize(
graph_id BIGINT,
profile TEXT DEFAULT 'owl-rl'
) → JSONB| Profile | Rule set |
|---|---|
'owl-rl' (default) | OWL 2 RL, described in OWL 2 RL rule set. |
'rdfs' | RDFS closures only: rdfs:subClassOf, rdfs:subPropertyOf, rdfs:domain, rdfs:range. A subset of 'owl-rl'; cheaper per graph. |
| anything else | Refuses with SQLSTATE 22023. There is no fallback. |
Examples
On the four-triple graph from the worked example (Alice and Bob as engineers, engineers ⊑ people ⊑ agents):
-- Default: OWL 2 RL.
SELECT pgrdf.materialize(pgrdf.graph_id('urn:example:people'));
-- {..., "profile": "owl-rl", "base_triples": 4, "inferred_triples_written": 13, ...}
-- RDFS closures only.
SELECT pgrdf.materialize(pgrdf.graph_id('urn:example:people'), 'rdfs');
-- {..., "profile": "rdfs", "base_triples": 4, "inferred_triples_written": 5,
-- "previous_inferred_dropped": 13, ...}
-- Unknown profile.
SELECT pgrdf.materialize(pgrdf.graph_id('urn:example:people'), 'bogus');
-- ERROR: 22023: materialize: unknown profile "bogus" (supported: 'owl-rl', 'rdfs')'rdfs' writes the five subclass consequences: ex:alice and ex:bob as ex:Person and ex:Agent, plus ex:Engineer rdfs:subClassOf ex:Agent. It skips the owl:Thing typing and OWL axiomatic triples that 'owl-rl' adds.
The profile field in the result echoes the rule set that ran. Each run replaces the previous run's inferred triples, whichever profile produced them: above, the 'rdfs' run dropped the 13 triples from the 'owl-rl' run. See Idempotence and scheduling.
Which one to use
'rdfs'when your queries and shapes only need the class and property hierarchy, and domain and range typing. It's the cheaper choice for pipelines that materialize many graphs, and one of the levers for keeping a right-sized graph inside the batch window.'owl-rl'when you rely on equivalent classes or properties, inverse, transitive or symmetric properties,owl:sameAs, or class restrictions such asowl:someValuesFrom.
Pick one profile per graph and use it consistently. Mixing profiles on the same graph swaps its whole inferred set on every run.