Methodology

How the TV Series Knowledge Graph is built, what data it uses, and where it breaks down.

Overview

TVKG is a semantic and graph-based search system over ~40,000 TV series sourced from Wikidata and Wikipedia. It combines vector similarity search with structural graph traversal to surface both thematically and relationally similar content.

Two search modes are available: semantic — nearest neighbours in embedding space — and hybrid, which blends semantic score with graph-structural signals like shared cast and production country.

Data sources

Series metadata (title, years, genres, countries, languages, cast, creators, directors) is extracted from Wikidata via SPARQL. English-language summaries are fetched from Wikipedia where available.

The Wikidata snapshot is periodically refreshed. Series without an English Wikipedia article will lack summaries; series with sparse Wikidata coverage may be missing genres, cast, or dates.

Node types in the graph: Series, Person, Genre, Country, Language, Work (source material). Edge types: ACTED_IN, CREATED, DIRECTED, HAS_GENRE, PRODUCED_IN, ORIGINAL_LANGUAGE, BASED_ON.

Embeddings & vector search

Each series is represented as a 384-dimensional dense vector produced by BAAI/bge-small-en-v1.5, a lightweight bi-encoder optimised for retrieval tasks. The input to the encoder is the concatenation of the series title and its Wikipedia summary. Series without a summary are encoded from the title alone.

Vectors are stored in Qdrant with scalar quantisation (INT8) and HNSW indexing (m=16, ef_construct=100). At query time the search string is embedded with the same model and the top-k nearest neighbours are retrieved by cosine distance.

Graph structure & traversal

The knowledge graph is stored in a property graph database. Each series node links to its cast, creators, directors, genres, countries of production, and original language. Source works (novels, comics, games) that a series is based on are also represented.

The graph API exposes depth-1 and depth-2 neighbourhood traversals. Depth-2 reveals co-workers: directors who share actors, series that share creators, etc. The force-directed layout used in the 2D graph fixes the focal node at the centre; node size scales with degree.

The explore view uses Cytoscape.js with fcose, dagre, circle, and concentric layouts and supports progressive graph expansion by double-clicking any series or person node.

Hybrid similarity

Hybrid mode combines the cosine similarity score from vector search with a structural score computed from shared cast and shared production countries. The structural component rewards series that share a significant fraction of actors or originate from the same country or language context.

Scores shown in search results are normalised to [0, 1]. In hybrid mode the breakdown is shown: semantic percentage plus shared actor and country counts. This makes the ranking interpretable rather than a black-box recommendation.

Limitations

Coverage: Wikidata coverage is uneven. Well-documented US and UK series have rich metadata; lesser-known international productions may have only a title and dates. Embedding quality degrades for series without summaries.

Cast completeness: Wikidata only lists cast members who have their own Wikidata items. Large ensemble casts are typically undercounted. Hybrid similarity based on shared actors underestimates overlap for such series.

Language: All summaries are English-language Wikipedia articles. Non-English series with no English Wikipedia presence may have poor semantic search quality.

Temporal freshness: The index is a snapshot and does not update in real time. Newly aired series will appear only after the next data refresh.

Technical stack

Frontend: Next.js 15 (App Router) · TypeScript · Tailwind CSS · react-force-graph-2d · Cytoscape.js

Vector store: Qdrant 1.9 with scalar quantisation and HNSW indexing

Embedding service: FastAPI + BAAI/bge-small-en-v1.5 via sentence-transformers, running on the same host

Infrastructure: Self-hosted VDS behind Caddy reverse proxy, Docker Compose, no third-party managed services