Overview
SWRL — When DL Alone Can't Say It
Horn-like rules layered on OWL — and the decidability you give up.
Why it matters
SWRL fills genuine DL gaps (arithmetic, role composition limits) but undecidable in the general case. Reach for SPARQL CONSTRUCT or SHACL-AF first; SWRL only when you've ruled them out.
Going deeper
A decision tree for 'should I write a SWRL rule?':
- Can the inference be expressed with OWL property characteristics (transitive, inverse, chain axioms, role composition)? If yes → use OWL.
- Can it be expressed as a SPARQL CONSTRUCT run periodically as an ETL step? If yes → use CONSTRUCT — it's the industry default for derived triples.
- Is the rule a validation (must hold), not an inference (might hold)? If yes → use SHACL with
sh:rule(SHACL-AF) — keeps you in the CWA validation lane. - Do you genuinely need DL-aware Horn rules at query time (e.g. arithmetic over inferred values, role-composition past OWL 2's safety conditions)? Only now reach for SWRL — and confine it to a small, audited module.
SWRL keeps decidability only for DL-safe rules (variables bound to named individuals). Most production SWRL stays DL-safe on purpose; the moment you allow free variables over arbitrary individuals you've left the decidable fragment.