#### MatView #1 #Original (stored in the system) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_1 ; lubm:faculty_department ?dept ; lubm:student_student ?stud ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?stud ?dept (COUNT(?co) AS ?coCount) WHERE{ ?prof lubm:teacherOf ?co . ?prof lubm:worksFor ?dept . ?stud lubm:takesCourse ?co . ?prof rdf:type lubm:Faculty . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . ?dept rdf:type lubm:Department . BIND(IRI(CONCAT('http://', STRAFTER(str(?dept), 'http://'), STRAFTER(str(?stud), 'http://'))) as ?id) } GROUP BY ?id ?stud ?dept } #Schema-based (rewritten to include all information) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_1 ; lubm:faculty_department ?dept ; lubm:student_student ?stud ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?stud ?dept (COUNT(?co) AS ?coCount) WHERE{ { SELECT ?stud ?dept ?co WHERE{ ?prof lubm:teacherOf ?co . ?prof lubm:worksFor ?dept . ?stud lubm:takesCourse ?co . ?prof rdf:type lubm:Faculty . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . ?dept rdf:type lubm:Department . } } UNION { SELECT ?stud ?dept ?co WHERE{ ?co lubm:offeringDepartment ?dept . ?stud lubm:takesCourse ?co . ?dept rdf:type lubm:Department . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . } } BIND(IRI(CONCAT('http://', STRAFTER(str(?dept), 'http://'), STRAFTER(str(?stud), 'http://'))) as ?id) } GROUP BY ?id ?stud ?dept } #### MatView #2 #Original (stored in the system) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_2 ; lubm:faculty_faculty ?prof ; lubm:student_student ?stud ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?stud ?prof (COUNT(?co) AS ?coCount) WHERE{ ?prof lubm:teacherOf ?co . ?stud lubm:takesCourse ?co . ?prof rdf:type lubm:Faculty . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . BIND(IRI(CONCAT('http://', STRAFTER(str(?prof), 'http://'), STRAFTER(str(?stud), 'http://'))) as ?id) } GROUP BY ?id ?stud ?prof } #Schema-based (rewritten to include all information) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_2 ; lubm:faculty_faculty ?prof ; lubm:student_student ?stud ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?stud ?prof (COUNT(?co) AS ?coCount) WHERE{ ?prof lubm:teacherOf ?co . ?stud lubm:takesCourse ?co . ?prof rdf:type lubm:Faculty . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . BIND(IRI(CONCAT('http://', STRAFTER(str(?prof), 'http://'), STRAFTER(str(?stud), 'http://'))) as ?id) } GROUP BY ?id ?stud ?prof } #### MatView #3 #Original (stored in the system) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_3 ; lubm:teacher ?prof ; lubm:studentdepartment ?dept ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?dept ?prof (COUNT(?co) AS ?coCount) WHERE{ ?prof lubm:teacherOf ?co . ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?dept . ?prof rdf:type lubm:Faculty . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . ?dept rdf:type lubm:Department . BIND(IRI(CONCAT('http://', STRAFTER(str(?prof), 'http://'), STRAFTER(str(?dept), 'http://'))) as ?id) } GROUP BY ?id ?dept ?prof } #Schema-based (rewritten to include all information) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_3 ; lubm:teacher ?prof ; lubm:studentdepartment ?dept ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?dept ?prof (COUNT(?co) AS ?coCount) WHERE{ ?prof lubm:teacherOf ?co . ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?dept . ?prof rdf:type lubm:Faculty . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . ?dept rdf:type lubm:Department . BIND(IRI(CONCAT('http://', STRAFTER(str(?prof), 'http://'), STRAFTER(str(?dept), 'http://'))) as ?id) } GROUP BY ?id ?dept ?prof } #### MatView #4 #Original (stored in the system) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_4 ; lubm:faculty_department ?profdept ; lubm:student_department ?stdept ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?stdept ?profdept (COUNT(?co) AS ?coCount) WHERE { ?prof lubm:teacherOf ?co . ?prof rdf:type lubm:Faculty . ?prof lubm:worksFor ?profdept . ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?stdept . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . ?profdept rdf:type lubm:Department . ?stdept rdf:type lubm:Department . BIND(IRI(CONCAT('http://', STRAFTER(str(?profdept), 'http://'), STRAFTER(str(?stdept), 'http://'))) as ?id) } GROUP BY ?id ?stdept ?profdept } #Schema-based (rewritten to include all information) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_4 ; lubm:faculty_department ?profdept ; lubm:student_department ?stdept ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?stdept ?profdept (COUNT(?co) AS ?coCount) WHERE { { SELECT ?stdept ?profdept ?co WHERE { ?prof lubm:teacherOf ?co . ?prof rdf:type lubm:Faculty . ?prof lubm:worksFor ?profdept . ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?stdept . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . ?profdept rdf:type lubm:Department . ?stdept rdf:type lubm:Department . } } UNION { SELECT ?stdept ?profdept ?co WHERE { ?co lubm:offeringDepartment ?profdept . ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?stdept . ?profdept rdf:type lubm:Department . ?stdept rdf:type lubm:Department . ?stud rdf:type lubm:Student . ?co rdf:type lubm:Course . } } BIND(IRI(CONCAT('http://', STRAFTER(str(?profdept), 'http://'), STRAFTER(str(?stdept), 'http://'))) as ?id) } GROUP BY ?id ?stdept ?profdept } #### MatView #5 #Original (stored in the system) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_5 ; lubm:teacherdept ?profdept ; lubm:coursetype ?cotype ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?cotype ?profdept (COUNT(?co) AS ?coCount) WHERE{ ?prof lubm:teacherOf ?co . ?prof lubm:worksFor ?profdept . ?prof rdf:type lubm:Faculty . ?profdept rdf:type lubm:Department . ?co rdf:type lubm:Course . BIND(IRI(CONCAT('http://', STRAFTER(str(?profdept), 'http://'), STRAFTER(str(?cotype), 'http://'))) as ?id) } GROUP BY ?id ?cotype ?profdept } #Schema-based (rewritten to include all information) view PREFIX lubm: PREFIX rdf: PREFIX qb: CONSTRUCT { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_5 ; lubm:teacherdept ?profdept ; lubm:coursetype ?cotype ; lubm:coursecount ?coCount . } WHERE{ SELECT ?id ?cotype ?profdept (COUNT(?co) AS ?coCount) WHERE{ { SELECT ?cotype ?profdept ?co WHERE { ?prof lubm:teacherOf ?co . ?prof lubm:worksFor ?profdept . ?prof rdf:type lubm:Faculty . ?profdept rdf:type lubm:Department . ?co rdf:type lubm:Course . } } UNION { SELECT ?cotype ?profdept ?co WHERE { ?co lubm:offeringDepartment ?profdept . ?profdept rdf:type lubm:Department . ?co rdf:type lubm:Course . } } BIND(IRI(CONCAT('http://', STRAFTER(str(?profdept), 'http://'), STRAFTER(str(?cotype), 'http://'))) as ?id) } GROUP BY ?id ?cotype ?profdept } #### MatView #6 #Original (stored in the system) view PREFIX lubm: PREFIX rdf: PREFIX qb: INSERT { GRAPH { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_6 ; lubm:studentdept ?stdept ; lubm:coursetype ?cotype ; lubm:coursecount ?coCount . } } WHERE{ SELECT ?id ?cotype ?stdept (COUNT(?co) AS ?coCount) WHERE{ ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?stdept . ?stud rdf:type lubm:Student . ?stdept rdf:type lubm:Department . ?co rdf:type lubm:Course . BIND(IRI(CONCAT('http://', STRAFTER(str(?stdept), 'http://'), STRAFTER(str(?cotype), 'http://'))) as ?id) } GROUP BY ?id ?cotype ?stdept } #Schema-based (rewritten to include all information) view PREFIX lubm: PREFIX rdf: PREFIX qb: INSERT { GRAPH { ?id a qb:Observation ; qb:dataSet lubm:dataset-aggview_6 ; lubm:studentdept ?stdept ; lubm:coursetype ?cotype ; lubm:coursecount ?coCount . } } WHERE{ SELECT ?id ?cotype ?stdept (COUNT(?co) AS ?coCount) WHERE{ ?stud lubm:takesCourse ?co . ?stud lubm:memberOf ?stdept . ?stud rdf:type lubm:Student . ?stdept rdf:type lubm:Department . ?co rdf:type lubm:Course . BIND(IRI(CONCAT('http://', STRAFTER(str(?stdept), 'http://'), STRAFTER(str(?cotype), 'http://'))) as ?id) } GROUP BY ?id ?cotype ?stdept }