Skip to content
Ravindu Weerasinghe
Go back

AI Career Domain Ontology – Semantic Web and Knowledge Graph

Semantic web technologies — OWL, RDF, SPARQL, knowledge graphs — sit in an interesting corner of AI that most practitioners don’t engage with. They predate the deep learning era and come from a different intellectual tradition: formal logic and knowledge representation. This project was an exercise in that tradition, applied to a domain I found meaningful: mapping out the AI field itself.

The ontology

The domain model captures:

The ontology is authored in RDF/XML format (ai-ontology.rdf) and loaded into a local GraphDB instance. SPARQL competency questions are defined up front and tested against the populated graph.

The application

A Streamlit app connects live to the GraphDB SPARQL endpoint. Users can run the predefined competency queries, explore the graph structure, and interact with a local Ollama model (llama3.2:1b) for natural language querying — the LLM translates plain English questions into SPARQL and interprets the results.

A reload_ontology.py utility handles clearing and reloading the graph data cleanly during development, which was useful for iterating on the ontology schema.

Stack

Reflection

Formal ontology design forces a kind of precision that machine learning doesn’t require. Every relationship needs a name, a direction, and a formal type. Every instance needs to fit cleanly into the class hierarchy. That discipline produces a knowledge base that’s queryable in ways a document corpus or a vector store isn’t — you can ask “which roles require both Python and statistics?” and get a precise, reproducible answer grounded in defined relationships.

The limitation, of course, is that someone has to maintain it. Ontologies don’t learn from data. But for stable domains with well-understood structure, that’s a feature rather than a bug.


View the project on:

Previous Project
Hybrid Book Recommender System
Next Project
Type II Diabetes Risk Prediction – Published Research