prefix rdf: prefix ub: prefix rdfs: # lubm01-update.ru - Transfer all students of course 0 from undergraduate students to graduate students DELETE {?X rdf:type ub:UndergraduateStudent .} INSERT {?X rdf:type ub:GraduateStudent . } WHERE { ?X ub:takesCourse . } prefix rdf: prefix ub: prefix rdfs: # lubm01a-update.ru - Slight variation of update lubm01: Transfer all students of course 0 to graduate students DELETE {?X rdf:type ub:Student .} INSERT {?X rdf:type ub:GraduateStudent . } WHERE { ?X ub:takesCourse . } prefix rdf: prefix ub: prefix rdfs: # lubm02-update.ru - Professor 11 moves to Department1 of university1 and takes along all of her students. # (note that worksFor is a subProperty of memberOf, so also the memberOf of relation for Prof 1 should be deleted for semantics where the effects are removed). DELETE { ub:worksFor ?Y . ?Z ub:memberOf ?Y . } INSERT { ub:headOf . ?Z ub:memberOf . } WHERE { ub:worksFor ?Y . ?Y rdf:type ub:Department . ?Z ub:advisor . ?Z rdf:type ub:GraduateStudent . ?Z ub:memberOf ?Y . } prefix rdf: prefix ub: prefix rdfs: # lubm03-update.ru - auto-register all graduate student to all of the courses taught by their advisor. INSERT {?X ub:takesCourse ?W .} WHERE { ?X rdf:type ub:GraduateStudent . ?Z ub:teacherOf ?W . ?X ub:advisor ?Z . } prefix rdf: prefix ub: prefix rdfs: # lubm04-update.ru - Enforce the policy that a student can only have 1 undergraduate degree per University and may not re-register as an undergrad student if she/he already has # any degree from that university. Additionally, mark all the students with a degree as alumni. DELETE {?X rdf:type ub:UndergraduateStudent .} INSERT {?Y ub:hasAlumnus ?X.} WHERE { {} OPTIONAL {?X ub:undergraduateDegreeFrom ?Y . } OPTIONAL {?X ub:mastersDegreeFrom ?Y . } OPTIONAL {?X ub:doctoralDegreeFrom ?Y . } } prefix rdf: prefix ub: prefix rdfs: # lubm04a-update.ru - variant of Query lubm04 which uses UNION instead of OPTIONAL # Enforce the policy that a student can only have 1 undergraduate degree per University and may not re-register as an undergrad student if she/he already has # any degree from that university. Additionally, mark all the students with a degree as alumni. DELETE {?X rdf:type ub:UndergraduateStudent .} INSERT {?Y ub:hasAlumnus ?X.} WHERE { {?X ub:undergraduateDegreeFrom ?Y . } UNION {?X ub:mastersDegreeFrom ?Y . } UNION {?X ub:doctoralDegreeFrom ?Y . } } prefix rdf: prefix ub: prefix rdfs: # lubm05-update.ru - Intuition: Assistant Professor 0 got some funding and wants to employ all her # not already employed iundergraduate co-authors as graduate students ;-) DELETE {?Y rdf:type ub:UndergraduateStudent . } INSERT {?Y rdf:type ub:GraduateStudent . ?Y ub:advisor . ?Y ub:worksFor ?Z .} WHERE { ?X ub:publicationAuthor . ?X ub:publicationAuthor ?Y . FILTER NOT EXISTS {?Y rdf:type ub:Employee . } ub:worksFor ?Z . }