A Course Recommendation System Powered by Ontology and SPARQL

Streamline Your Academic Journey with Semantic Web

The Semantic AI-Driven Course Recommender is designed to simplify the process of selecting courses and majors for university students using semantic web technologies.

This innovative system leverages Description Logics (DLs) and SPARQL queries to provide tailored recommendations based on students’ credit requirements, preferences, and program constraints.

Visit the Project on GitHub

Features

  1. Ontology-Based Structure : Ontology is the backbone of the system. It defines relationships and hierarchies among courses, programs, and credits, enabling efficient query processing.
  2. SPARQL-Powered Querying : Students can retrieve recommendations using precise SPARQL queries, ensuring accurate and relevant course suggestions.
  3. Flexible Program Support : The system supports multiple programs under the ICT department, including master’s degrees requiring 48-49 credits with options for thesis, internship, or research.

Modeling the project structure

The class diagram illustrates the relationships between key entities in the course recommender system, including Student, Program, Course, and Credit. It highlights the associations like prerequisites, program-specific requirements, and credit allocations for a streamlined recommendation process.


Object and Data Properties


Instance Count and Instance Matrix


Competency Questions

Few sample Competency questions are shown below. For all the competency questions please visit the repository.

List all the course name, term, credit and program in AIT

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ns: <http://www.semanticweb.org/biraj/ontologies/2024/6/untitled-ontology-33#>

SELECT ?courseName ?term (STR(?credit) AS ?creditStr) ?program
WHERE {
  ?course rdf:type ns:Course .
  ?course rdfs:comment ?courseName .
  ?course ns:term ?term .
  ?course ns:credit ?credit .
  ?course (ns:isRequiredCourseOf|ns:isElectiveCourseOf) ?program .
}
ORDER BY ?term ?credit ?courseName

Each course has a ‘tag’ associated with them. Get all tags for each course.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ns: <http://www.semanticweb.org/biraj/ontologies/2024/6/untitled-ontology-33#>

SELECT ?tag (STR(COUNT(?course)) AS ?numberOfCourses)
WHERE {
  ?course rdf:type ns:Course .
  ?course ns:hasTag ?tag .
}
GROUP BY ?tag
ORDER BY DESC(?numberOfCourses)

For each of the tag, display the associated subjects.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ns: <http://www.semanticweb.org/biraj/ontologies/2024/6/untitled-ontology-33#>

SELECT ?tag (STR(COUNT(?course)) AS ?numberOfCoursesStr) (GROUP_CONCAT(?courseName; separator=", ") AS ?courses)
WHERE {
  ?course rdf:type ns:Course .
  ?course ns:hasTag ?tag .
  ?course rdfs:comment ?courseName .
}
GROUP BY ?tag
ORDER BY DESC(COUNT(?course))

Sunil just finished his August semester. He wants to take a course that is related to “environment” this January semester.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ns: <http://www.semanticweb.org/biraj/ontologies/2024/6/untitled-ontology-33#>

SELECT ?course ?program ?term ?creditStr (GROUP_CONCAT(DISTINCT ?allTags; separator=", ") AS ?tags)
WHERE {
  ?course rdf:type ns:Course .
  ?course ns:term ?term .
  ?course (ns:isRequiredCourseOf|ns:isElectiveCourseOf) ?program .
  ?course ns:credit ?credit .
  ?course ns:hasTag ?tag .
  FILTER (?term = "Jan" && REGEX(STR(?tag), "environment", "i"))
  ?course ns:hasTag ?allTags .
  BIND(STR(?credit) AS ?creditStr)
}
GROUP BY ?course ?program ?term ?creditStr

Rules for inferred view

Here, the classes ElectiveCourse and RequiredCourse are inferred from the Course class. We have used class restriction rules to infer them.Please check the ait.rdf file for more details.

The remaining classes are inferred by setting SWRL rules as follows :

#For ManagementCourses class
untitled-ontology-33:Course(?c) ^ untitled-ontology-33:hasTag(?c, "Management"^^rdf:PlainLiteral) -> untitled-ontology-33:ManagementCourses(?c)

#For IntrCourses class
untitled-ontology-33:Course(?c) ^ untitled-ontology-33:term(?c, "INTR"^^rdf:PlainLiteral) -> untitled-ontology-33:IntrCourses(?c) 

#For LessThanThreeCreditCourses class
untitled-ontology-33:Course(?c) ^ untitled-ontology-33:credit(?c, ?cr) ^ swrlb:lessThan(?cr, 3) -> untitled-ontology-33:LessThanThreeCreditCourses(?c)

#For ThreeCreditManagementJanCourses class:
untitled-ontology-33:Course(?c) ^ untitled-ontology-33:hasTag(?c, "Management"^^rdf:PlainLiteral) ^ untitled-ontology-33:term(?c, "Jan"^^rdf:PlainLiteral) ^ untitled-ontology-33:credit(?c, 3) -> untitled-ontology-33:ThreeCreditManagementJanCourses(?c)


Advantages of Using Protégé over SQL for This Project

  • Complex Relationships : Hierarchical Structures: The project involves hierarchical structures such as Programs, Departments, Schools, and Universities. Ontologies naturally support such structures with properties like isProgramOf, isDepartmentOf. For example: • Program1 isProgramOf Department1 • Department1 isDepartmentOf School1 • Inference: Using transitive properties, broader relationships can be inferred without explicitly stating them, reducing redundancy and ensuring consistency. For instance, if isProgramOf is marked as transitive, then: • From Program1 isProgramOf Department1 and Department1 isDepartmentOf School1, it can be inferred that Program1 isProgramOf School1.
  • Reasoning Capabilities : Automated Classification : Reasoners can automatically classify instances based on defined rules and properties. For example: • An instance of Course can be inferred to be an instance of EnvironmentCourses if it has the appropriate hasTag value set to “environment”. Validation Reasoners can validate the ontology and ensure that the data adheres to the defined constraints and rules, which is more powerful than traditional SQL constraints. For example: • A reasoner can enforce that each Student has at most one Faculty advisor using the functional property isAdviseeOf.
  • Rich Queries: SPARQL, the query language for RDF, allows for querying data based on the semantics captured in the ontology. This is more expressive than SQL for certain types of queries involving hierarchical relationships and inferred knowledge. For example: • Querying for all programs that are part of a university can leverage the transitive property of isProgramOf to include indirect relationships.
  • Interoperability and Data Integration : Linked Data: Ontologies facilitate linking and integrating data from diverse sources, which is particularly useful if the project needs to integrate with external datasets or systems. For example: • Data from different universities can be integrated if they use shared ontological standards, allowing for queries that span multiple institutions.
  • By leveraging these capabilities, Protégé provides a powerful and flexible platform for managing the complex, hierarchical, and interconnected data involved in this project, offering significant advantages over traditional SQL databases.

Future Work

  1. Add missing data (all instances of School,Department,Program,Courses)
  2. EnhanceTaggingSystem - ACMComputing Classification System or the Dublin Core Metadata Initiative to standardize tags.
  3. Link to External Data Source - Use federated queries to link the RDF data with external knowledge bases such as DBpedia, Wikidata etc
  4. Build a user-friendly web interface that allows students and administrators to execute SPARQL queries without needing deep technical knowledge.

Conclusion

Start exploring this cutting-edge system today to simplify your course selection process and achieve your academic goals!

Visit the Project on GitHub
Biraj Koirala
Software Engineer , Data Enthusiast

My research interests include machine learning, computer vision, remote sensing and teaching.