Phase I — Domain Analysis
Before building, understand the movie domain thoroughly.
- Analyze movie domain entities
- Identify classes and properties
- Explore existing vocabularies
- Map concepts to RDF
Entities
Movie, Person, Director, Actor, Genre, Studio
Relationships
directedBy, starring, hasGenre, producedBy
Attributes
title, releaseDate, runtime, budget, rating
Vocabularies
schema.org, DBpedia, FOAF, Wikidata
Why Reuse Vocabularies?
- Enables interoperability with other datasets
- Provides established semantics
- Allows federated queries
- Follows Linked Data best practices
Exercise — Domain Mapping
- A movie can have multiple actors — what property type is this?
- A director directs movies — should this be functional?
- How would you model the "sequel of" relationship?
Phase II — Design Ontology
Create a formal ontology using RDFS and OWL.
Complete the Ontology
- Add
:Directorand:Actoras subclasses of:Person - Add
:Genreclass - Define
:directedBy,:starring,:hasGenreproperties - Add domain/range constraints
- Make
:directedByfunctional with inverse
Phase III — Query DBpedia
Query real Linked Data from DBpedia.
About DBpedia
DBpedia extracts structured data from Wikipedia. It contains millions of entities including movies, people, and places — all available as Linked Data.
Exercise
- Find all movies released in 2023
- Get the top 10 highest-budget films
- Find movies sharing actors with "Inception"
Phase IV — Build Dataset
Create instance data and link to external sources.
Linking to External Data
Use owl:sameAs to link your entities to DBpedia and Wikidata for seamless data integration across the Linked Data cloud.
Extend the Dataset
- Add 2 more movies with all properties
- Add a new actor who appears in multiple films
- Add
owl:sameAslinks to DBpedia
Phase V — Reasoning
Understand how reasoners derive new knowledge.
Subclass Transitivity
If A ⊆ B and B ⊆ C, then A ⊆ C
:Director rdfs:subClassOf :Person . :nolan a :Director . # → :nolan a :Person
Domain Inference
If P has domain C, x P y → x ∈ C
:directedBy rdfs:domain :Movie . :inception :directedBy :nolan . # → :inception a :Movie
Range Inference
If P has range C, x P y → y ∈ C
:directedBy rdfs:range :Director . :inception :directedBy :nolan . # → :nolan a :Director
Inverse Properties
If P inverseOf Q, x P y → y Q x
:directedBy owl:inverseOf :directed . :inception :directedBy :nolan . # → :nolan :directed :inception
Open World Assumption
In Semantic Web, missing data is unknown, not false. This differs fundamentally from traditional databases.
- Missing information ≠ Non-existence
- Use
owl:complementOffor explicit negation - Use SPARQL
NOT EXISTSfor closed-world queries
| Asserted Fact | Rule | Inferred Fact |
|---|---|---|
:nolan a :Director | rdfs:subClassOf | :nolan a :Person |
:inception :directedBy :nolan | owl:inverseOf | :nolan :directed :inception |
:inception :starring :dicaprio | rdfs:range | :dicaprio a :Actor |
Reasoning Practice
- What's inferred if
:Studio rdfs:subClassOf :Organization? - If
:hasSequelis transitive, and A hasSequel B, B hasSequel C — what's inferred? - How would you detect someone who is both a Director and Actor?
Phase VI — SPARQL Analytics
Write advanced analytical SPARQL queries.
SPARQL Analytics Features
Aggregates
COUNT, SUM, AVG, MIN, MAX, GROUP_CONCAT
Grouping
GROUP BY, HAVING for filtering groups
Subqueries
Nested SELECT for complex logic
Path Queries
Property paths: *, +, ?, |, / operators
Write Queries
- Find the director with the highest average movie rating
- List actors who have worked with multiple directors
- Calculate total budget per genre per year
Phase VII — Visualization
Build an interactive knowledge graph visualization.
Congratulations!
You've completed the hands-on project. You now have practical experience with:
- Designing ontologies with RDFS and OWL
- Querying real Linked Data from DBpedia
- Creating and validating RDF datasets
- Understanding semantic reasoning and inference
- Writing analytical SPARQL queries
- Visualizing knowledge graphs