Formal Requirement Specification - People

Formal Requirement Specifications
For Student Curriculum Project Plan (SCPS)
Version 1.0
Submitted in partial fulfillment of the requirements for the degree of Master of Software
Engineering
Kevin Sung
CIS 895 – MSE Project
Kansas State University
1. Purpose........................................................................................................................ 4
2. References ................................................................................................................... 4
3. Specifications .............................................................................................................. 4
3.1. Classes..................................................................................................................... 4
3.1.1.
SCPS ................................................................................................................... 4
3.1.2.
PlanView ............................................................................................................. 4
3.1.3.
CourseView......................................................................................................... 4
3.1.4.
CoursePlan .......................................................................................................... 4
3.1.5.
AdminView ......................................................................................................... 5
3.1.6.
User ..................................................................................................................... 5
3.1.7.
Faculty................................................................................................................. 5
3.1.8.
Student ................................................................................................................ 5
3.1.9.
Administrator ...................................................................................................... 5
3.1.10. Course ................................................................................................................. 6
3.1.11. Transcript ............................................................................................................ 6
3.1.12. TranscriptEntry ................................................................................................... 6
3.2. Association .............................................................................................................. 7
3.2.1.
TranscriptDB....................................................................................................... 7
3.2.2.
TranscriptData..................................................................................................... 7
3.2.3.
Grade ................................................................................................................... 7
3.2.4.
Advising .............................................................................................................. 7
3.2.5.
PlanDb................................................................................................................. 7
3.2.6.
CourseTaken ....................................................................................................... 7
3.2.7.
PlanOwnerShip ................................................................................................... 8
3.2.8.
ViewPlan ............................................................................................................. 8
3.2.9.
ViewCourse......................................................................................................... 8
3.2.10. MainView ........................................................................................................... 8
3.2.11. OneView ............................................................................................................. 8
3.2.12. FutureCourse ....................................................................................................... 8
3.2.13. Utilizing .............................................................................................................. 8
3.2.14. Moderating .......................................................................................................... 9
3.2.15. CourseDb ............................................................................................................ 9
3.2.16. DbAdmin............................................................................................................. 9
3.2.17. ViewDb ............................................................................................................... 9
3.2.18. Prereq .................................................................................................................. 9
3.2.19. Administrating .................................................................................................... 9
3.2.20. CourseTranscipt ................................................................................................ 10
3.3. Constraints ............................................................................................................ 10
3.3.1.
Only the student, his or her advisor, and the system administrator can access
(the student’s) transcript. .................................................................................................. 10
3.3.2.
The student cannot have more than one transcript............................................ 10
3.3.3.
A course which has a C or above grade can be put on the course planning chart.
10
3.3.4.
The user has a unique User ID. ......................................................................... 10
3.3.5.
There are no circular prerequisites. ................................................................... 10
3.3.6.
The user could only save a maximum of three plans. ....................................... 10
3.3.7.
A course and a transcript entry cannot be on the plan at the same time if they
represent the same class. ................................................................................................... 10
3.3.8.
No duplicate course on the plan. ....................................................................... 11
3.3.9.
No duplicate TranscriptEntry on the plan. ........................................................ 11
3.3.10. There should be either a PlanView or CourseView shown to the user. ............ 11
3.3.11. Faculty who has no advisees cannot access the system. ................................... 11
3.3.12. A transcript entry must have a unique transcript ID. ........................................ 11
3.3.13. A transcript entry must match a course in the course database. ....................... 11
3.3.14. All users and administrators should have unique user names........................... 11
3.3.15. Each course should have an unique reference number. .................................... 12
3.4. Operation............................................................................................................... 12
3.4.1.
Administrators can only add courses which are not yet contained in the course
database. 12
3.4.2.
Administrators can only delete courses that are in the course database. .......... 12
4. Test code ................................................................................................................... 12
5. Appendix A ............................................................................................................... 14
1. Purpose
The purpose of this document is to identify formal requirement specifications of the Student
Curriculum Planning System. Specification will be defined with the UML/OCL language. Critical
requirements in the Vision Document and Class Diagram in Architecture Design are use to derive the
specifications. Furthermore, we use the UML-based Specification Environment (USE) tool to do the
type and syntax check to ensure correctness of the specifications.
2. References


Vision Document Version 1.1
Architecture Design Version 1.0
3. Specifications
3.1. Classes
3.1.1.
SCPS
This is the main interface of the system which mostly contains front end of the system.
class SCPS
operations
Login(userId:String,password:String):Boolean
end
3.1.2.
PlanView
This will be the Web form provided for the user to select whether to load, delete, or create a
course plan.
class PlanView
attributes
operations
CreatePlan(planName:String):Boolean
DeletePlan(planName:String):Boolean
LoadPlan(planName:String):Boolean
end
3.1.3.
CourseView
This will be the front end (Web form) for the loaded course plan.
class CourseView
attributes
operations
AddCourse(courseId:String, timeAvailable:String):Boolean
DropCourse(courseId:String):Boolean
GenerateReport():Boolean
SavePlan():Boolean
end
3.1.4.
CoursePlan
This is the class course plan which the user has currently created or stored.
class CoursePlan
attributes
planName:String
authorId:String
operations
FindCourse(courseId:String) : Course
CheckPrerequiste(courseId:String) : Boolean
end
3.1.5.
AdminView
This will be the front end (Web form) for administrator to add or delete course in the
courses database.
class AdminView
attributes
operations
AddCourse(courseName : String, courseId : String, timeAvailable : String) : Boolean
DropCourse(courseId : String) : Boolean
end
3.1.6.
User
This class represents the user of the system and is embedded with the main user functions
and log-in data.
class User
attributes
userId:String
password:String
operations
end
3.1.7.
Faculty
This class represents the faculty user of the system and is has embedded with faculty user
functions and faculty data.
class Faculty < User
attributes
facultyName:String
facultyId:String
end
3.1.8.
Student
This class represents the student user of the system. It has embedded the student user
functions and student data.
class Student < User
attributes
studentName:String
studentId:String
major:String
track:String
end
3.1.9.
Administrator
This class represents the administrator of the system and is embedded with administrator
functions and log-in data.
class Administrator
attributes
userName:String
password:String
operations
end
3.1.10. Course
This class represents a course entry in the SCPS database. All data in the entry is
categorized by the variables in this class.
class Course
attributes
referenceNumber:String
courseId:String
courseName:String
timeAvailable:String
isRequire:Boolean
csRequire:Boolean
techElective:Boolean
humanElective:Boolean
dbMgmtTrack:Boolean
isAnalystTrack:Boolean
misTrack:Boolean
appProgTrack:Boolean
commAnalystTrack:Boolean
operations
closure(s:Set(Course)):Set(Course)=
if s->includesAll(s.thePrereq->asSet) then s
else closure(s->union(s.thePrereq->asSet))
endif
reachableFromSelf():Set(Course)=closure(Set{self})
end
3.1.11. Transcript
This class represents a user’s entire transcript entry collection for in the SCPS database.
This student id is used to identify the transcript ownership.
class Transcript
attributes
studentId:String
end
3.1.12. TranscriptEntry
This class represents a transcript entry for a user. All data for a particular transcript is
captured here.
class TranscriptEntry
attributes
transcriptId:String
referenceNumber:String
grade:String
timeTaken:String
end
3.2. Association
3.2.1.
TranscriptDB
This association illustrates the SCPS saving an individual user transcript into its database.
association TranscriptDB between
SCPS[1] role transcriptDb
Transcript[*] role transcriptSaved
end
3.2.2.
TranscriptData
This association illustrates a transcript for an individual user as a collection of the transcript
entry, which holds the grade information for a particular course that has been taken in the
past.
association TranscriptData between
Transcript[1] role theTranscript
TranscriptEntry[*] role theTranscriptEntry
end
3.2.3.
Grade
This association establishes the ownership between a student and his or her transcript.
association Grade between
Transcript[1] role hasTranscript
Student[1] role transcriptOwner
end
3.2.4.
Advising
This association defines the relationship between the faculty advisor and his or her advisees.
association Advising between
Student[*] role advisee
Faculty[1] role advisor
end
3.2.5.
PlanDb
This association describes how the system stores individual user’s course plans in the
system.
association PlanDb between
SCPS[1] role planDb
CoursePlan[*] role planSaved
end
3.2.6.
CourseTaken
This association provides a link for a course plan to add a transcript entry to itself through
transcript collection.
association CourseTaken between
CoursePlan[*] role referneceIn
Transcript[1] role contains
end
3.2.7.
PlanOwnerShip
This association establishes ownership between the student and his or her course plans.
association PlanOwnership between
CoursePlan[0..3] role hasPlan
User[1] role planOwner
end
3.2.8.
ViewPlan
The association represents the interaction between the user and the main plan selection Web
form.
association ViewPlan between
User[0..1] role theUser
PlanView[0..1] role thePlanView
end
3.2.9.
ViewCourse
This association represents the interaction between the user and the course planning Web
form.
association ViewCourse between
User[0..1] role theUser
CourseView[0..1] role theCourseView
end
3.2.10. MainView
This association represents the link established between the course plan selection view and
the actual course plan.
association MainView between
PlanView[*] role thePlanView
CoursePlan[*] role theCoursePlan
end
3.2.11. OneView
This association represents the link established between the course planning Web form and
the actual course plan.
association OneView between
CourseView[0..1] role theCourseView
CoursePlan[0..1] role theCoursePlan
end
3.2.12. FutureCourse
This association provides a link for a course plan to add a course to itself.
association FutureCourse between
CoursePlan[*] role containIn
Course[*] role hasReference
end
3.2.13. Utilizing
This association defines the user’s ability to access the system.
association Utilizing between
User[0..*] role theUser
SCPS[1] role theSCPS
end
3.2.14. Moderating
This association depicts the ability of the administrator to control the user activity.
association Moderating between
Administrator[1..*] role theAdministrator
User[*] role theUser
end
3.2.15. CourseDb
This association shows how the system stores individual course information to its database.
association CourseDb between
SCPS[1] role courseDb
Course[*] role courseSaved
end
3.2.16. DbAdmin
This association represents the interaction between the main database administration view
and the adminiatrator.
association DbAdmin between
AdminView[1] role theAdminView
Administrator[1] role theAdministrator
end
3.2.17. ViewDb
This associaton is the link between the course in the database and the administration
interface.
association ViewDb between
AdminView[0..*] role theAdminView
Course[0..*] role theCourse
end
3.2.18. Prereq
This association establishes the prerequisite relationship between the courses.
association Prereq between
Course[0..1] role theCourse
Course[0..1] role thePrereq
end
3.2.19. Administrating
This association represents the administrating power of the administrators over the entire
system.
association Administrating between
Administrator[1..*] role theAdministrator
SCPS[1] role theSCPS
End
3.2.20. CourseTranscipt
This association describes how the transcript can reference back to a course in the database.
association CourseTranscript between
Course[1] role theCourse
TranscriptEntry[0..*] role theTranscriptEntry
end
3.3. Constraints
3.3.1.
Only the student, his or her advisor, and the system administrator can
access (the student’s) transcript.
context t:Transcript
inv Privacy:
Student.allInstances->forAll(s|t.transcriptOwner->includes(s) implies
t.studentId=s.studentId and t.transcriptOwner->size =1
and s.advisor=t.transcriptOwner.advisor and
Administrator.allInstances=t.transcriptDb.theAdministrator)
3.3.2.
The student cannot have more than one transcript.
Captured by the Grade association.
3.3.3.
A course which has a C or above grade can be put on the course planning
chart.
context te:TranscriptEntry
inv CAbove:
CoursePlan.allInstances->forAll(cp|(te.theTranscript.transcriptOwner=cp.planOwner
and cp.contains.theTranscriptEntry->includes(te)) implies (te.grade='A' or te.grade='B'
or te.grade= 'C'))
3.3.4.
The user has a unique User ID.
context User
inv uniqueId:
User.allInstances->forAll(u1,u2|u1<>u2 implies u1.userId<>u2.userId)
3.3.5.
There are no circular prerequisites.
context Course
inv noCircularPrereq:
Course.allInstances->forAll(c|c.reachableFromSelf()->excludes(self))
3.3.6.
The user could only save a maximum of three plans.
Capture by the PlanOwnerShip association.
3.3.7.
A course and a transcript entry cannot be on the plan at the same time if
they represent the same class.
context te:TranscriptEntry
inv noSameCourseInOnePlan:
CoursePlan.allInstances->
forAll(cp|te.theTranscript.transcriptOwner=cp.planOwner
and Set{te}=cp.contains.theTranscriptEntry
and Course.allInstances->forAll(c|cp.hasReference->includes(c) implies
c.referenceNumber<>te.referenceNumber))
3.3.8.
No duplicate course on the plan.
context cp:CoursePlan
inv uniqueCourseOnPlan:
Course.allInstances->forAll(c|cp.hasReference->includes(c) implies
cp.hasReference->intersection(Set{c})->size=1)
3.3.9.
No duplicate TranscriptEntry on the plan.
context cp:CoursePlan
inv uniqueTEOnPlan:
TranscriptEntry.allInstances->forAll
(te|te.theTranscript.transcriptOwner=cp.planOwner
and cp.contains.theTranscriptEntry->includes(te)
implies cp.contains.theTranscriptEntry->intersection(Set{te})->size=1)
3.3.10. There should be either a PlanView or CourseView shown to the user.
context User
inv onlyOneView:
User.allInstances->forAll(u|(u.thePlanView->size>0 implies
u.theCourseView->size=0)and (u.theCourseView->size>0 implies
u.thePlanView->size=0) and (u.theCourseView->size<2 and
u.thePlanView->size<2))
3.3.11. Faculty who has no advisees cannot access the system.
context f:Faculty
inv facultyAccess:
f.advisee->size=0 implies (f.thePlanView->size=0 and
f.theCourseView->size=0)
3.3.12. A transcript entry must have a unique transcript ID.
context te1:TranscriptEntry
inv uniqueTranscriptId:
TranscriptEntry.allInstances->forAll(te2|te1<>te2 implies
te1.transcriptId<>te2.transcriptId)
3.3.13. A transcript entry must match a course in the course database.
context te:TranscriptEntry
inv TranscriptInCourse:
Course.allInstances->exists(c|c.referenceNumber=te.referenceNumber)
3.3.14. All users and administrators should have unique user names.
context u:User
inv uniqueUserAdminUserId:
Administrator.allInstances->forAll(a|a.userId<>u.userId)
context u1:User
inv uniqueUserUserId:
User.allInstances->forAll(u2|((u1<>u2) implies
(u1.userId<>u2.userId)))
context a1:Administrator
inv uniqueAdminUserId:
Administrator.allInstances->forAll(a2|((a1<>a2) implies
(a1.userId<>a2.userId)))
3.3.15. Each course should have an unique reference number.
context c1:Course
inv uniqueReferenceNum:
Course.allInstances->forAll(c2|((c1<>c2) implies
(c1.referenceNumber<>c2.referenceNumber)))
3.4. Operation
3.4.1.
Administrators can only add courses which are not yet contained in the
course database.
context AdminView::AddCourse(courseName : String, courseId : String, timeAvailable :
String) : Boolean
pre Current: theCourse->forAll(c1,c2|c1<>c2 and
c1.referenceNumber<>c2.referenceNumber)
post Added: theCourse->forAll(c1,c2|c1<>c2 and
c1.referenceNumber<>c2.referenceNumber)
3.4.2.
Administrators can only delete courses that are in the course database.
context AdminView::DropCourse(referenceNum : Integer) : Boolean
pre Current: theCourse->exists(c|c.referenceNumber=referenceNum)
post Deleted: theCourse->forAll(c|c.referenceNumber<>referenceNum)
4. Test code
The following code will create the scenario where all invariant are violated to provide a test to the
formal specifications of the SCPS model.
!create scps:SCPS
!create coursePlan1:CoursePlan
!create coursePlan2:CoursePlan
!create faculty1:Faculty
!create faculty2:Faculty
!create student1:Student
!create student2:Student
!create admin1:Administrator
!create admin2:Administrator
!create course1:Course
!create course2:Course
!create transcript1:Transcript
!create transcript2:Transcript
!create transcriptEntry11:TranscriptEntry
!create transcriptEntry21:TranscriptEntry
!create courseView1: CourseView
!create courseView2: CourseView
!create planView1: PlanView
!create planView2: PlanView
!create planView3: PlanView
!create planView4: PlanView
!create adminView1: AdminView
!set coursePlan1.planName:='ABC'
!set coursePlan1.authorId:='384930403'
!set faculty1.facultyName:='John Doe'
!set faculty1.facultyId:='431431444'
!set faculty2.facultyName:='John Doe. Jr'
!set faculty2.facultyId:='431431441'
!set student1.studentName:='Jane Doe'
!set student1.studentId:='843941345'
!set student1.major:='CS'
!set student1.userId:='hotshot'
!set student1.password:='isfun'
!set student2.studentName:='Stephanie Lee'
!set student2.studentId:='847674445'
!set student2.major:='IS'
!set student2.track:='Application'
!set student2.userId:='hotshot'
!set student2.password:='Iloveflying'
!set admin1.userId:='hotshot'
!set admin1.password:='nooneknow'
!set admin2.userId:='hotshot'
!set admin2.password:='Iknow'
!set course1.courseId:='CIS300'
!set course1.courseName:='Programming'
!set course1.timeAvailable:='Fall'
!set course1.isRequire:=true
!set course1.csRequire:=true
!set course1.techElective:=false
!set course1.humanElective:=false
!set course1.dbMgmtTrack:=false
!set course1.isAnalystTrack:=false
!set course1.misTrack:=false
!set course1.commAnalystTrack:=false
!set course1.referenceNumber:='00003'
!set course2.courseId:='CIS200'
!set course2.courseName:='Fundamental'
!set course2.timeAvailable:='Fall'
!set course2.isRequire:=true
!set course2.csRequire:=true
!set course2.techElective:=false
!set course2.humanElective:=false
!set course2.dbMgmtTrack:=false
!set course2.isAnalystTrack:=false
!set course2.misTrack:=false
!set course2.commAnalystTrack:=false
!set course2.referenceNumber:='00003'
!set transcript1.studentId:='847674445'
!set transcript2.studentId:='843941345'
!set transcriptEntry11.transcriptId:='00001'
!set transcriptEntry11.referenceNumber:='00001'
!set transcriptEntry11.grade:='D'
!set transcriptEntry11.timeTaken:='Fall'
!set transcriptEntry21.transcriptId:='00001'
!set transcriptEntry21.referenceNumber:='00001'
!set transcriptEntry21.grade:='F'
!set transcriptEntry21.timeTaken:='Fall'
!insert (scps,transcript1) into TranscriptDB
!insert (scps,transcript2) into TranscriptDB
!insert (course1,course2) into Prereq
!insert (transcript1,transcriptEntry11) into TranscriptData
!insert (transcript1,transcriptEntry21) into TranscriptData
!insert (transcript1,student1) into Grade
!insert (transcript2,student2) into Grade
!insert (student1,faculty1) into Advising
!insert (student2,faculty1) into Advising
!insert (scps,coursePlan1) into PlanDb
!insert (scps,coursePlan2) into PlanDb
!insert (coursePlan1, transcript1) into CourseTaken
!insert (coursePlan2, transcript2) into CourseTaken
!insert (coursePlan1, student1) into PlanOwnership
!insert (coursePlan2, student2) into PlanOwnership
!insert (coursePlan1,course2) into FutureCourse
!insert (coursePlan2,course2) into FutureCourse
!insert (student1,scps) into Utilizing
!insert (student2,scps) into Utilizing
!insert (faculty1,scps) into Utilizing
!insert (faculty2,scps) into Utilizing
!insert (admin1,student1) into Moderating
!insert (admin1,student2) into Moderating
!insert (admin1,faculty1) into Moderating
!insert (admin1,faculty2) into Moderating
!insert (admin2,student1) into Moderating
!insert (admin2,student2) into Moderating
!insert (admin2,faculty1) into Moderating
!insert (admin2,faculty2) into Moderating
!insert (scps,course1) into CourseDb
!insert (scps,course2) into CourseDb
!insert (adminView1,course1) into ViewDb
!insert (adminView1,course2) into ViewDb
!insert (admin1,scps) into Administrating
!insert (admin2,scps) into Administrating
!insert (adminView1,admin1) into DbAdmin
!insert (student1, planView1) into ViewPlan
!insert (student2, planView2) into ViewPlan
!insert (faculty1, planView3) into ViewPlan
!insert (faculty2, planView4) into ViewPlan
!insert (planView1,coursePlan1) into MainView
!insert (planView2,coursePlan2) into MainView
!insert (planView3,coursePlan1) into MainView
!insert (planView3,coursePlan2) into MainView
!insert (student1, courseView1) into ViewCourse
!insert (student2, courseView2) into ViewCourse
!insert (courseView1,coursePlan1) into OneView
!insert (courseView2,coursePlan2) into OneView
!insert(course2, transcriptEntry11) into CourseTranscript
!insert(course2, transcriptEntry21) into CourseTranscript
5. Appendix A
model SCPS
--- CLASSES
--
class SCPS
operations
Login(userId:String,password:String):Boolean
end
class CourseView
attributes
operations
AddCourse(courseId:String, timeAvailable:String):Boolean
DropCourse(courseId:String):Boolean
GenerateReport():Boolean
SavePlan():Boolean
end
class PlanView
attributes
operations
CreatePlan(planName:String):Boolean
DeletePlan(planName:String):Boolean
LoadPlan(planName:String):Boolean
end
class CoursePlan
attributes
planName:String
authorId:String
operations
FindCourse(courseId:String) : Course
CheckPrerequiste(courseId:String) : Boolean
end
class User
attributes
userId:String
password:String
operations
end
class Faculty < User
attributes
facultyName:String
facultyId:String
end
class Student < User
attributes
studentName:String
studentId:String
major:String
track:String
end
class AdminView
attributes
operations
AddCourse(courseName : String, courseId : String, timeAvailable : String) : Boolean
DropCourse(referenceNum:Integer) : Boolean
end
class Administrator
attributes
userId:String
password:String
operations
end
class Course
attributes
referenceNumber:String
courseId:String
courseName:String
timeAvailable:String
isRequire:Boolean
csRequire:Boolean
techElective:Boolean
humanElective:Boolean
dbMgmtTrack:Boolean
isAnalystTrack:Boolean
misTrack:Boolean
appProgTrack:Boolean
commAnalystTrack:Boolean
operations
closure(s:Set(Course)):Set(Course)=
if s->includesAll(s.thePrereq->asSet) then s
else closure(s->union(s.thePrereq->asSet))
endif
reachableFromSelf():Set(Course)=closure(Set{self})
end
class Transcript
attributes
studentId:String
end
class TranscriptEntry
attributes
transcriptId:String
referenceNumber:String
grade:String
timeTaken:String
end
--- ASSOCIATIONS
-association TranscriptDB between
SCPS[1] role transcriptDb
Transcript[*] role transcriptSaved
end
association TranscriptData between
Transcript[1] role theTranscript
TranscriptEntry[*] role theTranscriptEntry
end
association Grade between
Transcript[1] role hasTranscript
Student[1] role transcriptOwner
end
association Advising between
Student[*] role advisee
Faculty[1] role advisor
end
association PlanDb between
SCPS[1] role planDb
CoursePlan[*] role planSaved
end
association CourseTaken between
CoursePlan[*] role referneceIn
Transcript[1] role contains
end
association PlanOwnership between
CoursePlan[0..3] role hasPlan
User[1] role planOwner
end
association ViewPlan between
User[0..1] role theUser
PlanView[0..1] role thePlanView
end
association ViewCourse between
User[0..1] role theUser
CourseView[0..1] role theCourseView
end
association MainView between
PlanView[*] role thePlanView
CoursePlan[*] role theCoursePlan
end
association OneView between
CourseView[0..1] role theCourseView
CoursePlan[0..1] role theCoursePlan
end
association FutureCourse between
CoursePlan[*] role containIn
Course[*] role hasReference
end
association Utilizing between
User[0..*] role theUser
SCPS[1] role theSCPS
end
association Moderating between
Administrator[1..*] role theAdministrator
User[*] role theUser
end
association CourseDb between
SCPS[1] role courseDb
Course[*] role courseSaved
end
association DbAdmin between
AdminView[0..1] role theAdminView
Administrator[1] role theAdministrator
end
association ViewDb between
AdminView[0..*] role theAdminView
Course[0..*] role theCourse
end
association Prereq between
Course[0..1] role theCourse
Course[0..*] role thePrereq
end
association Administrating between
Administrator[1..*] role theAdministrator
SCPS[1] role theSCPS
end
association CourseTranscript between
Course[1] role theCourse
TranscriptEntry[0..*] role theTranscriptEntry
end
--- CONSTRAINTS
-constraints
-- Privacy
-- Only the student, his or her advisor, and the system administrator can access his or her (the student) -- transcript.
context t:Transcript
inv Privacy:
Student.allInstances->forAll(s|t.transcriptOwner->includes(s) implies
t.studentId=s.studentId and t.transcriptOwner->size =1 and
s.advisor=t.transcriptOwner.advisor and
Administrator.allInstances=t.transcriptDb.theAdministrator)
-- Students cannot have more than one transcript.
-- Capture by the multiplicity.
-- A course which has a C or above grade can be put on the course planning chart.
context te:TranscriptEntry
inv CAbove:
CoursePlan.allInstances->forAll(cp|(te.theTranscript.transcriptOwner=cp.planOwner
and cp.contains.theTranscriptEntry->includes(te)) implies (te.grade='A' or te.grade='B' or
te.grade= 'C'))
-- A user has a unique user ID.
context User
inv uniqueId:
User.allInstances->forAll(u1,u2|u1<>u2 implies u1.userId<>u2.userId)
-- There are no circular prerequisites.
context Course
inv noCircularPrereq:
Course.allInstances->forAll(c|c.reachableFromSelf()->excludes(self))
-- A user can only has a maximum of three plans.
-- Capture by the multiplicity.
--A course and a transcript entry cannot be on the plan at the same time if they represent the same class.
context te:TranscriptEntry
inv noSameCourseInOnePlan:
CoursePlan.allInstances->forAll(cp|te.theTranscript.transcriptOwner=cp.planOwner
and Set{te}=cp.contains.theTranscriptEntry
and Course.allInstances->forAll(c|cp.hasReference->includes(c) implies
c.referenceNumber<>te.referenceNumber))
--No duplicate courses on the plan.
context cp:CoursePlan
inv uniqueCourseOnPlan:
Course.allInstances->forAll(c|cp.hasReference->includes(c) implies cp.hasReference->
intersection(Set{c})->size=1)
--No duplicate TranscriptEntry on the plan.
context cp:CoursePlan
inv uniqueTEOnPlan:
TranscriptEntry.allInstances->forAll(te|te.theTranscript.transcriptOwner=cp.planOwner
and cp.contains.theTranscriptEntry->includes(te)
implies cp.contains.theTranscriptEntry->intersection(Set{te})->size=1)
--All students should have a faculty advisor.
--enforce by the multiplicity.
--There should be either a PlanView or CourseView to show the user
context User
inv onlyOneView:
User.allInstances->forAll(u|(u.thePlanView->size>0 implies u.theCourseView->
size=0)and (u.theCourseView->size>0 implies u.thePlanView->size=0) and
(u.theCourseView->size<2 and u.thePlanView->size<2))
--Faculty who have no advisees cannot access the system.
context f:Faculty
inv facultyAccess:
f.advisee->size=0 implies (f.thePlanView->size=0 and f.theCourseView->size=0)
--A transcript entry must have a unique transcript ID.
context te1:TranscriptEntry
inv uniqueTranscriptId:
TranscriptEntry.allInstances->forAll(te2|te1<>te2 implies
te1.transcriptId<>te2.transcriptId)
--A transcript entry must match a course in the course database.
context te:TranscriptEntry
inv TranscriptInCourse:
Course.allInstances->exists(c|c.referenceNumber=te.referenceNumber)
--All users and administrators should have unique user names.
context u:User
inv uniqueUserAdminUserId:
Administrator.allInstances->forAll(a|a.userId<>u.userId)
context u1:User
inv uniqueUserUserId:
User.allInstances->forAll(u2|((u1<>u2) implies (u1.userId<>u2.userId)))
context a1:Administrator
inv uniqueAdminUserId:
Administrator.allInstances->forAll(a2|((a1<>a2) implies (a1.userId<>a2.userId)))
--All courses should have unique reference numbers.
context c1:Course
inv uniqueReferenceNum:
Course.allInstances->forAll(c2|((c1<>c2) implies
(c1.referenceNumber<>c2.referenceNumber)))
--- Operations
---Administrators can only add a course which is not yet contained in the course database.
context AdminView::AddCourse(courseName : String, courseId : String, timeAvailable : String) :
Boolean
pre Current: theCourse->forAll(c1,c2|c1<>c2 implies c1.referenceNumber<>c2.referenceNumber)
post Added: theCourse->forAll(c1,c2|c1<>c2 implies c1.referenceNumber<>c2.referenceNumber)
--Administrators can only delete a course that is in the course database.
context AdminView::DropCourse(referenceNum : String) : Boolean
pre Current: theCourse->exists(c|c.referenceNumber=referenceNum)
post Deleted: theCourse->forAll(c|c.referenceNumber<>referenceNum)