🧠 Knowledge Modelling & Ontologies 1

Lecture 4 Interactive Learning Companion

🌳 Ontology Explorer

Load a sample ontology to explore its classes, properties, and axioms. See how ontologies structure domain knowledge.

// Select an ontology above to explore

Select an example ontology to see its structure

📚 Remember: An ontology is a formal, explicit specification of a shared conceptualisation. It contains classes, properties, individuals, and axioms.

❓ Competency Questions Lab

Write competency questions for a domain, then analyse what classes, properties, and constraints your ontology needs. CQs define what your ontology must be able to answer.

Ontology Requirements:

Add competency questions above and click "Analyse Requirements"
💡 Tip: Good CQs range from simple lookups ("Which courses does X teach?") to complex reasoning ("What sequence of courses must be completed for graduation?"). A well-designed ontology should handle both. From CQs, you can extract the classes, properties, and constraints your ontology needs.

🧩 Ontology Design Patterns

Explore common Content Ontology Design Patterns (Content ODPs). Each pattern solves a recurring modelling problem.

🔗 Part-Whole

Represent entities and their constituent parts.

CQs:
• What is this entity part of?
• What are the parts of this entity?
ex:Engine ex:isPartOf ex:Car . ex:Wheel ex:isPartOf ex:Car . ex:isPartOf rdf:type rdf:Property . # isPartOf is transitive: if A partOf B and B partOf C → A partOf C

👤 Agent-Role

An agent plays a role in a specific context or time.

CQs:
• What role does this agent play?
• In which context does the agent act?
ex:Alice ex:playsRole _:r1 . _:r1 rdf:type ex:TeacherRole . _:r1 ex:inContext ex:CS101_Spring2026 . # Separates identity from roles

📅 Time-Indexed Situation

Represent facts that are true at specific times.

CQs:
• When was this fact true?
• What was the situation at time T?
_:sit1 rdf:type ex:Enrollment . _:sit1 ex:hasStudent ex:Alice . _:sit1 ex:hasCourse ex:CS101 . _:sit1 ex:atTime "2026-02-01"^^xsd:date .

📊 Classification

Classify entities into categories using a controlled vocabulary.

CQs:
• What category does this entity belong to?
• What entities belong to this category?
ex:Fido rdf:type ex:Dog . ex:Dog rdfs:subClassOf ex:Mammal . ex:Mammal rdfs:subClassOf ex:Animal . # Fido is inferred to be a Mammal and Animal

🔄 N-ary Relation

Represent relationships involving more than two entities.

CQs:
• Who prescribed which drug at what dosage?
• What was the grade for student X in course Y?
# Grade is an n-ary relation between student, course, value _:g1 rdf:type ex:Grade . _:g1 ex:student ex:Alice . _:g1 ex:course ex:CS101 . _:g1 ex:value "A"^^xsd:string .

📋 Collection Entity

Model collections where membership matters.

CQs:
• What things are in this collection?
• Which collection does this belong to?
ex:CS_Department rdf:type ex:Department . ex:Alice ex:memberOf ex:CS_Department . ex:Bob ex:memberOf ex:CS_Department . ex:memberOf rdfs:domain ex:Person . ex:memberOf rdfs:range ex:Collection .
🌐 Explore more: Visit ontologydesignpatterns.org for a comprehensive catalogue of ODPs with documentation, examples, and reusable building blocks.

🏗️ Ontology Builder

Build an ontology step by step: define classes, properties, and axioms. See the generated Turtle output.

Generated Turtle:

@prefix ex: <http://example.org/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . # Add classes and properties above!

🎮 Ontology Modelling Game

Test your knowledge of ontology concepts, design patterns, and modelling decisions!

Score: 0
Question 1 / 8

Press "Start Game" to begin!

📝 Lecture 4 Quiz

Test your understanding of knowledge modelling and ontologies!

1. What is an ontology in computer science?
A database schema
A formal, explicit specification of a shared conceptualisation
A programming language
A type of neural network
1 / 10

📋 Ontology Engineering Cheat Sheet

Quick reference for ontology concepts, patterns, and tools.

📖 Key Definitions

Ontology: A formal, explicit specification of a shared conceptualisation (Studer et al., 1998)
Competency Question: A natural language question the ontology-based KB should answer
ODP: Ontology Design Pattern — a reusable solution to a common modelling problem
Content ODP: Domain-dependent pattern with competency questions and a reusable building block
OntoClean: Methodology using meta-properties (rigidity, identity, unity) to validate taxonomies

🔄 XD Methodology Steps

1. Collect requirements as Competency Questions
2. Match CQs to existing ODPs in repositories
3. Reuse & specialise ODPs for your domain
4. Integrate ODP modules into the ontology
5. Test by verifying CQs can be answered from the ontology

🧩 Common Design Patterns

Part-Whole: Entities and their parts (transitive)
Agent-Role: Agents playing time/context-dependent roles
N-ary Relation: Relations involving 3+ participants
Classification: Taxonomic hierarchies with subClassOf
Time-Indexed: Facts valid at specific times
Collection Entity: Groups/collections with membership

📊 Visual Notations

VOWL: Graph-oriented, designed for ontologies. Blue circles = classes, arrows = properties. Preferred by users.
UML: Familiar but limited for formal ontologies. Good for initial brainstorming. Open-world mismatch.
OWLGrEd: Extended UML profile with ontology-specific constructs.
Protege OntoGraf: Built-in visualisation for exploring ontologies.

🛠️ Tools & Resources

Protege — protege.stanford.edu WebVOWL — vowl.visualdataweb.org ODP Portal — ontologydesignpatterns.org RDF Playground — rdfplayground.dcc.uchile.cl

⚠️ Common Pitfalls

❌ Building from scratch instead of reusing ODPs
❌ Not writing CQs before modelling
❌ Confusing UML closed-world with ontology open-world assumption
❌ Making Student a subclass of Course (OntoClean violation)
❌ Forgetting rdfs:label and rdfs:comment annotations
❌ Anti-rigid class as superclass of rigid class