sdgco:assertion
sdgco:assertion is the required check of a coherence rule: a SPARQL SELECT, held as a string literal. It runs against the document's canonical RDF, and each returned row is one violation — an empty result is a pass.
A SELECT (rather than an ASK) is deliberate: a row can bind where the violation is, which a later editor integration anchors to a source range. The projection is a closed vocabulary: only the reserved variables below may be projected — projecting any other variable is an authoring-time warning, and the engine ignores unknown columns. (Closed also means the set can grow backwards-compatibly in later versions.)
?this— the document anchor. When projected, every row carries the document as its fallback anchor.?node— a node anchor; per row, it takes priority over?this.?predicate— together with?node, narrows the anchor to the quads(node, predicate, *).?object— together with?nodeand?predicate, pinpoints the exact quad(node, predicate, object).?message— per-row human text; falls back to the rule'ssdgco:descriptionwhen unbound.
Each row's anchor is the most specific bound combination in that row: (node, predicate, object), then (node, predicate), then node, then the document (?this projected, or nothing bound at all). A degenerate combination — say ?object bound without ?predicate — falls back to the next valid level.
Before the query runs, ?this is substituted position-aware: occurrences in the projection are rewritten to (<documentIRI> AS ?this) — a bare IRI cannot appear in a SELECT projection, so the rewrite is what makes ?this legal to project — while occurrences in the query patterns become the document IRI itself. The document's @prefix declarations are prepended (inline PREFIX lines override on conflict). An optional sdgco:condition can gate whether the assertion runs at all.
Usage
- Domain: a
sdgco:Rule. Range: a string literal holding a SPARQLSELECT. - Required; exactly one per rule; authored in a
@ruleblock as a triple-quotedassertion.