Search code examples
protegeprotege4

How to use Qualified Number Restrictions in Protege for OWL


I have the following two English sentences

(1) Each student has to follow some courses and, specifically, undergraduate students can follow only undergraduate courses but postgraduate students can follow postgraduate courses and up to two undergraduate courses.

(2) Each student can have only a single mark for each course.

I have created an ontology in Protege tool but I don't know how to pass the qualified restriction "up to two" or exactly one "single".

What I have done so far:

First I created four classes "Undergraduate Courses", "Undergraduate Student", "Postgraduate Courses", "Postgraduate Student" and an ObjectProperty named followCourse. Based on the first (1) English sentence, Undergraduate students can follow only undergraduate courses. However, Postgraduate students can also have postgraduate courses and some undergraduate courses. Thus, I have written to following for Postgraduate Student class:

followCourse some Postgraduate_Courses or Undergraduate_Courses. I am not sure that I satisfy the threshold up to two (≤2) courses because some in description logic is at least one (screenshot 1).

For the second sentence about "single mark" I have added the following in Undergraduate_courses and Postgraduate_courses classes:

hasMark max 1 where hasMark is a DataProperty for Curriculum class (screenshot 2).

I believe the hasMark max 1 is wrong in this case because with that expression I typically say that I can't have the same course with two marks for two separate students. This is wrong because two students could have taken the same course and have separate marks.

(screenshot 1) enter image description here

(screenshot 2) enter image description here


Solution

  • Sentence 1

    As for sentence 1 your are correct regarding using max 2 Undergraduate_Courses.

    However, watch out for

    isFollowedBy some Undergraduate_Student or Postgraduate_Student.

    As you have it, it means

    (isFollowedBy some Undergraduate_Student) or (Postgraduate_Student)

    but what you really want is

    isFollowedBy some (Undergraduate_Student or Postgraduate_Student).

    Also, for Undergraduate_Student you specify followCourse only Undergraduate_Course which will correctly ensure that undergraduate students can only take undergraduate courses. However, as is, it will allow for undergraduate students that take zero undergraduate courses. Thus, to force undergraduate students to take at least 1 undergraduate course you have to change the statement as follows:

    followCourse only Undergraduate_Course and followCourse some Undergraduate_Course.

    Sentence 2

    Here it is probably best to introduce a new concept, say StudentCourseMark which is used to link a single student, a single course and a single mark. Assuming you have the object properties hasStudent and hasCourse and data property hasMark you can define StudentCourseMark as the subclass of

    hasStudent exactly 1 Student and 
      hasCourse exactly 1 Course and 
      hasMark exactly 1 xsd:integer
    

    However, this can still allow for the possibility that you can have 2 different individuals of StudentCourseMark that have the same student and course, but different marks. To avoid this you can add a key on student and course for StudentCourseMark:

    HasKey: 
        hasCourse, 
        hasStudent