← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · updated 7d
← Back to glossary

Competency Questions

Knowledge Engineering Intermediate
debt(d8/e7/b5/t6)
d8 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'silent in production' (d8). detection_hints.automated is no; missing or unexecuted competency questions are invisible until consumers hit gaps in the ontology. Regex hints only find them if written, not their absence.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor' (e7). quick_fix sounds simple but retrofitting CQs onto an existing ontology means re-scoping classes/properties across the model, adding SPARQL/Cypher regression suites, and often reworking structure that traces to no question.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). applies_to spans library/backend/data-platform; CQs become a standing requirements-and-test discipline that every ontology change must satisfy, but they don't dictate system shape.

t6 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t6). Per misconception, developers treat CQs as informal post-hoc wishlists rather than executable pre-design specs, contradicting how requirements/tests work elsewhere; slightly below t7 because the misuse degrades quality rather than breaking outright.

About DEBT scoring →

Also Known As

cqs ontology requirements competency queries

TL;DR

Natural-language queries that specify what a knowledge graph or ontology must be able to answer, used to scope and validate the model.

Explanation

Competency questions are the requirements artefact of ontology and knowledge graph engineering. They are natural-language questions - 'Which suppliers ship parts to plants in the EU?', 'What drugs interact with warfarin and were approved after 2015?' - that the finished knowledge base is expected to answer correctly. Introduced as a core practice in the METHONTOLOGY and later NeOn ontology-engineering methods, they play the same role that user stories or acceptance criteria play in application development: they turn a vague ambition ('model the pharmaceutical domain') into a concrete, testable specification.

Good competency questions are written before modelling begins and are revisited whenever scope changes. Each question names the entities, relationships, and constraints it exercises, which directly reveals what classes, properties, and axioms the ontology must include. If a question cannot be expressed as a SPARQL, Cypher, or SHACL query over the current model, either the model is incomplete or the question is out of scope - both outcomes are useful. Teams typically maintain a numbered list of questions with expected answer shapes (a single value, a set, a boolean) and translate each into an executable query that becomes a regression test for the graph.

Competency questions also constrain over-modelling. A common failure mode in ontology work is to encode every distinction the domain expert can articulate, producing a sprawling model that no consumer needs. Requiring every class and property to trace back to at least one competency question keeps the ontology grounded in actual use. Conversely, when downstream applications discover a query they cannot answer, the missing capability is captured as a new competency question, extending the model in a disciplined way rather than ad hoc.

The practice fails when questions are too vague to translate ('tell me about our customers'), when they are written after the ontology to rationalise existing choices, or when they are never run as automated queries and drift out of sync with the model. Treated as living, executable specifications they anchor an ontology to real information needs and give the team a clear signal for when the model is done, complete, or over-built.

Common Misconception

People treat competency questions as informal wishlist items to jot down after modelling. In reality they are executable specifications written before and during design, translated into concrete queries that regression-test whether the ontology can actually answer them.

Why It Matters

Without competency questions ontologies drift toward either under-coverage (missing the joins consumers need) or over-modelling (encoding distinctions nobody queries), and there is no objective signal for when the model is done. They anchor the ontology to real information needs and make completeness testable.

Common Mistakes

  • Writing vague questions like 'tell me about customers' that cannot be translated into a concrete query or answer shape.
  • Producing competency questions after the ontology is built, so they rationalise existing choices instead of driving design.
  • Never turning questions into executable SPARQL or Cypher tests, letting the model drift out of sync with its stated requirements.
  • Modelling classes and properties that trace back to no competency question, inflating the ontology with unused structure.
  • Failing to specify the expected answer shape (single value, set, boolean), making it unclear when a question is satisfied.

Avoid When

  • The ontology is a throwaway sketch or exploratory prototype where formal requirements would slow discovery.
  • The domain is trivially small and every stakeholder already agrees on the handful of queries needed.
  • There is no plan to ever query the model programmatically, making executable questions pointless.
  • Requirements change so rapidly that maintaining a stable question set costs more than it saves.

When To Use

  • Scoping a new ontology or knowledge graph so the model targets real information needs.
  • Validating that an existing knowledge base can answer the queries its consumers depend on.
  • Preventing over-modelling by requiring every class and property to trace to at least one question.
  • Onboarding downstream teams by giving them a concrete, tested catalogue of what the graph can answer.

Code Examples

✗ Vulnerable
# Vague, untestable 'competency questions' scribbled after the fact
competency_questions = [
    "tell me about our products",
    "customer information",
    "anything interesting about orders",
]

# No expected answer shape, no query, no way to know if the ontology satisfies them.
# The team ends up modelling every attribute the domain expert mentions,
# then discovering months later that key joins are missing.
def validate_ontology(graph):
    return True  # nothing to check against
✓ Fixed
# Competency questions as executable specifications with expected answer shapes
competency_questions = [
    {
        "id": "CQ-01",
        "nl": "Which suppliers ship parts to plants in the EU?",
        "shape": "set<Supplier>",
        "sparql": """
            PREFIX : <http://example.org/supply#>
            SELECT DISTINCT ?supplier WHERE {
                ?supplier a :Supplier ; :shipsTo ?plant .
                ?plant :locatedIn/:inRegion :EU .
            }
        """,
    },
    {
        "id": "CQ-02",
        "nl": "Is part P-42 dual-sourced?",
        "shape": "boolean",
        "sparql": "ASK { ?s1 :supplies :P-42 . ?s2 :supplies :P-42 . FILTER(?s1 != ?s2) }",
    },
]

def validate_ontology(graph):
    # Each CQ becomes a regression test: the query must parse and return
    # a result of the expected shape against the reference dataset.
    for cq in competency_questions:
        result = graph.query(cq["sparql"])
        assert result is not None, f"{cq['id']} failed: {cq['nl']}"

Added 16 Sep 2026
Views 20
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 4 pings W 1 ping T 0 pings F 2 pings S 1 ping S 1 ping M 1 ping T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Google 3 Applebot 2 Ahrefs 1 PetalBot 1 Unknown AI 1 Bing 1 SEMrush 1
crawler 10
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
Write each requirement as a concrete natural-language question with an expected answer shape, translate it to SPARQL or Cypher, and run the queries as regression tests against the ontology.
📦 Applies To
library backend data-platform
🔗 Prerequisites
🔍 Detection Hints
competency[_-]?question|\bCQ-\d+\b|ASK\s*\{|PREFIX\s+\w+:\s*<
Auto-detectable: ✗ No
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: Medium Context: File Tests: Update


✓ schema.org compliant