------------------------------------------------------------------------------------------
-- START FUNCTION: do_reasoning_all

CREATE OR REPLACE FUNCTION do_reasoning_all() RETURNS integer AS $$
DECLARE
    rows_nr integer;
    delta_old_size integer;
    total_tuples integer;
BEGIN
    total_tuples := 0;

    ----------------------------------------
    ---- COMPONENT 0
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Schedule>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#listedCourse>(?X,?X1) .
    INSERT INTO "dbrdf_Schedule"(s) SELECT DISTINCT t0.s FROM "dbrdf_listedCourse" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Schedule" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 1
    ----------------------------------------

    -- Prepare temporary tables for recursive rules

    delta_old_size := 0;

    CREATE LOCAL TEMPORARY TABLE "dbrdf_subOrganizationOf_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_subOrganizationOf_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_subOrganizationOf" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_subOrganizationOf_delta_old" ON "dbrdf_subOrganizationOf_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_subOrganizationOf_delta_old" ON "dbrdf_subOrganizationOf_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_subOrganizationOf_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_subOrganizationOf_old" ON "dbrdf_subOrganizationOf_old"(s, o); CREATE INDEX "IDX_1_dbrdf_subOrganizationOf_old" ON "dbrdf_subOrganizationOf_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_subOrganizationOf_delta_new"(s integer, o integer) ON COMMIT DROP;

    -- Iterate recursive rules

    WHILE delta_old_size <> 0 LOOP
        delta_old_size := 0;

        -- Evaluate seminaive rules

        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf$delta_new>(?X,?Z) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf$delta_old>(?X,?Y), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf>(?Y,?Z) .
        INSERT INTO "dbrdf_subOrganizationOf_delta_new"(s, o) SELECT t0.s, t1.o FROM "dbrdf_subOrganizationOf_delta_old" t0, "dbrdf_subOrganizationOf" t1 WHERE t0.o = t1.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_subOrganizationOf" ex WHERE ex.s = t0.s AND ex.o = t1.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf$delta_new>(?X,?Z) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf>(?X,?Y), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf$delta_old>(?Y,?Z) .
        INSERT INTO "dbrdf_subOrganizationOf_delta_new"(s, o) SELECT t0.s, t1.o FROM "dbrdf_subOrganizationOf" t0, "dbrdf_subOrganizationOf_delta_old" t1 WHERE t0.o = t1.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_subOrganizationOf" ex WHERE ex.s = t0.s AND ex.o = t1.o);


        -- Propagate $delta_new

        INSERT INTO "dbrdf_subOrganizationOf_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_subOrganizationOf_delta_old" t0;
        INSERT INTO "dbrdf_subOrganizationOf"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_subOrganizationOf_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_subOrganizationOf_delta_old";
        INSERT INTO "dbrdf_subOrganizationOf_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_subOrganizationOf_delta_new" t0;
        TRUNCATE TABLE "dbrdf_subOrganizationOf_delta_new";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 2
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR2>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI2>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#GraduateStudent>(?X) .
    INSERT INTO "dbrdf_NR2"(s, o) SELECT DISTINCT t0.s, 26425 FROM "dbrdf_GraduateStudent" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR2" ex WHERE ex.s = t0.s AND ex.o = 26425);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 3
    ---- DEPENDS ON: 2
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#GraduateCourse>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR2>(?X,?X1) .
    INSERT INTO "dbrdf_GraduateCourse"(s) SELECT DISTINCT t0.o FROM "dbrdf_NR2" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_GraduateCourse" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 4
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR7>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI7>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ResearchAssistant>(?X) .
    INSERT INTO "dbrdf_NR7"(s, o) SELECT DISTINCT t0.s, 26426 FROM "dbrdf_ResearchAssistant" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR7" ex WHERE ex.s = t0.s AND ex.o = 26426);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 5
    ---- DEPENDS ON: 4
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ResearchGroup>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#researchProject>(?X,?X1) .
    INSERT INTO "dbrdf_ResearchGroup"(s) SELECT DISTINCT t0.s FROM "dbrdf_researchProject" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_ResearchGroup" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ResearchGroup>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR7>(?X,?X1) .
    INSERT INTO "dbrdf_ResearchGroup"(s) SELECT DISTINCT t0.o FROM "dbrdf_NR7" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_ResearchGroup" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 6
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Research>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#researchProject>(?X,?X1) .
    INSERT INTO "dbrdf_Research"(s) SELECT DISTINCT t0.o FROM "dbrdf_researchProject" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Research" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Research>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#publicationResearch>(?X,?X1) .
    INSERT INTO "dbrdf_Research"(s) SELECT DISTINCT t0.o FROM "dbrdf_publicationResearch" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Research" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 7
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Article>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ConferencePaper>(?X) .
    INSERT INTO "dbrdf_Article"(s) SELECT t0.s FROM "dbrdf_ConferencePaper" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Article" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Article>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#JournalArticle>(?X) .
    INSERT INTO "dbrdf_Article"(s) SELECT t0.s FROM "dbrdf_JournalArticle" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Article" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Article>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TechnicalReport>(?X) .
    INSERT INTO "dbrdf_Article"(s) SELECT t0.s FROM "dbrdf_TechnicalReport" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Article" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 8
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Software>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#softwareVersion>(?X,?X1) .
    INSERT INTO "dbrdf_Software"(s) SELECT DISTINCT t0.s FROM "dbrdf_softwareVersion" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Software" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Software>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#softwareDocumentation>(?X,?X1) .
    INSERT INTO "dbrdf_Software"(s) SELECT DISTINCT t0.s FROM "dbrdf_softwareDocumentation" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Software" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 9
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#doctoralDegreeFrom>(?X,?Y) .
    INSERT INTO "dbrdf_degreeFrom"(s, o) SELECT t0.s, t0.o FROM "dbrdf_doctoralDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_degreeFrom" ex WHERE ex.s = t0.s AND ex.o = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#mastersDegreeFrom>(?X,?Y) .
    INSERT INTO "dbrdf_degreeFrom"(s, o) SELECT t0.s, t0.o FROM "dbrdf_mastersDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_degreeFrom" ex WHERE ex.s = t0.s AND ex.o = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#undergraduateDegreeFrom>(?X,?Y) .
    INSERT INTO "dbrdf_degreeFrom"(s, o) SELECT t0.s, t0.o FROM "dbrdf_undergraduateDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_degreeFrom" ex WHERE ex.s = t0.s AND ex.o = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- Prepare temporary tables for recursive rules

    delta_old_size := 0;

    CREATE LOCAL TEMPORARY TABLE "dbrdf_degreeFrom_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_degreeFrom_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_degreeFrom" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_degreeFrom_delta_old" ON "dbrdf_degreeFrom_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_degreeFrom_delta_old" ON "dbrdf_degreeFrom_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_degreeFrom_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_hasAlumnus_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_hasAlumnus_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_hasAlumnus" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_hasAlumnus_delta_old" ON "dbrdf_hasAlumnus_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_hasAlumnus_delta_old" ON "dbrdf_hasAlumnus_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_hasAlumnus_delta_new"(s integer, o integer) ON COMMIT DROP;

    -- Iterate recursive rules

    WHILE delta_old_size <> 0 LOOP
        delta_old_size := 0;

        -- Evaluate seminaive rules

        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#hasAlumnus$delta_old>(?Y,?X) .
        INSERT INTO "dbrdf_degreeFrom_delta_new"(s, o) SELECT t0.o, t0.s FROM "dbrdf_hasAlumnus_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_degreeFrom" ex WHERE ex.s = t0.o AND ex.o = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#hasAlumnus$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom$delta_old>(?Y,?X) .
        INSERT INTO "dbrdf_hasAlumnus_delta_new"(s, o) SELECT t0.o, t0.s FROM "dbrdf_degreeFrom_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_hasAlumnus" ex WHERE ex.s = t0.o AND ex.o = t0.s);


        -- Propagate $delta_new

        INSERT INTO "dbrdf_degreeFrom"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_degreeFrom_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_degreeFrom_delta_old";
        INSERT INTO "dbrdf_degreeFrom_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_degreeFrom_delta_new" t0;
        TRUNCATE TABLE "dbrdf_degreeFrom_delta_new";

        INSERT INTO "dbrdf_hasAlumnus"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_hasAlumnus_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_hasAlumnus_delta_old";
        INSERT INTO "dbrdf_hasAlumnus_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_hasAlumnus_delta_new" t0;
        TRUNCATE TABLE "dbrdf_hasAlumnus_delta_new";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 10
    ---- DEPENDS ON: 9
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#University>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#hasAlumnus>(?X,?X1) .
    INSERT INTO "dbrdf_University"(s) SELECT DISTINCT t0.s FROM "dbrdf_hasAlumnus" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_University" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#University>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#mastersDegreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_University"(s) SELECT DISTINCT t0.o FROM "dbrdf_mastersDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_University" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#University>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_University"(s) SELECT DISTINCT t0.o FROM "dbrdf_degreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_University" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#University>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#doctoralDegreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_University"(s) SELECT DISTINCT t0.o FROM "dbrdf_doctoralDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_University" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#University>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#undergraduateDegreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_University"(s) SELECT DISTINCT t0.o FROM "dbrdf_undergraduateDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_University" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 11
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#AdministrativeStaff>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#SystemsStaff>(?X) .
    INSERT INTO "dbrdf_AdministrativeStaff"(s) SELECT t0.s FROM "dbrdf_SystemsStaff" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_AdministrativeStaff" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#AdministrativeStaff>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ClericalStaff>(?X) .
    INSERT INTO "dbrdf_AdministrativeStaff"(s) SELECT t0.s FROM "dbrdf_ClericalStaff" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_AdministrativeStaff" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 12
    ---- DEPENDS ON: 8, 7
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Software>(?X) .
    INSERT INTO "dbrdf_Publication"(s) SELECT t0.s FROM "dbrdf_Software" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#publicationResearch>(?X,?X1) .
    INSERT INTO "dbrdf_Publication"(s) SELECT DISTINCT t0.s FROM "dbrdf_publicationResearch" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#publicationDate>(?X,?X1) .
    INSERT INTO "dbrdf_Publication"(s) SELECT DISTINCT t0.s FROM "dbrdf_publicationDate" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#orgPublication>(?X,?X1) .
    INSERT INTO "dbrdf_Publication"(s) SELECT DISTINCT t0.o FROM "dbrdf_orgPublication" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Manual>(?X) .
    INSERT INTO "dbrdf_Publication"(s) SELECT t0.s FROM "dbrdf_Manual" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Specification>(?X) .
    INSERT INTO "dbrdf_Publication"(s) SELECT t0.s FROM "dbrdf_Specification" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#softwareDocumentation>(?X,?X1) .
    INSERT INTO "dbrdf_Publication"(s) SELECT DISTINCT t0.o FROM "dbrdf_softwareDocumentation" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Article>(?X) .
    INSERT INTO "dbrdf_Publication"(s) SELECT t0.s FROM "dbrdf_Article" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Book>(?X) .
    INSERT INTO "dbrdf_Publication"(s) SELECT t0.s FROM "dbrdf_Book" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#publicationAuthor>(?X,?X1) .
    INSERT INTO "dbrdf_Publication"(s) SELECT DISTINCT t0.s FROM "dbrdf_publicationAuthor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Publication>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#UnofficialPublication>(?X) .
    INSERT INTO "dbrdf_Publication"(s) SELECT t0.s FROM "dbrdf_UnofficialPublication" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Publication" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 13
    ---- DEPENDS ON: 9, 4, 10, 3, 1, 11, 2, 5
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR2>(?X,?Y) .
    INSERT INTO "dbrdf_takesCourse"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR2" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_takesCourse" ex WHERE ex.s = t0.s AND ex.o = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Faculty>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#PostDoc>(?X) .
    INSERT INTO "dbrdf_Faculty"(s) SELECT t0.s FROM "dbrdf_PostDoc" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Faculty" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Faculty>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Lecturer>(?X) .
    INSERT INTO "dbrdf_Faculty"(s) SELECT t0.s FROM "dbrdf_Lecturer" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Faculty" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Faculty>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf>(?X,?X1) .
    INSERT INTO "dbrdf_Faculty"(s) SELECT DISTINCT t0.s FROM "dbrdf_teacherOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Faculty" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#AssistantProfessor>(?X) .
    INSERT INTO "dbrdf_Professor"(s) SELECT t0.s FROM "dbrdf_AssistantProfessor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#tenured>(?X,?X1) .
    INSERT INTO "dbrdf_Professor"(s) SELECT DISTINCT t0.s FROM "dbrdf_tenured" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor>(?X,?X1) .
    INSERT INTO "dbrdf_Professor"(s) SELECT DISTINCT t0.o FROM "dbrdf_advisor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#AssociateProfessor>(?X) .
    INSERT INTO "dbrdf_Professor"(s) SELECT t0.s FROM "dbrdf_AssociateProfessor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#FullProfessor>(?X) .
    INSERT INTO "dbrdf_Professor"(s) SELECT t0.s FROM "dbrdf_FullProfessor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#VisitingProfessor>(?X) .
    INSERT INTO "dbrdf_Professor"(s) SELECT t0.s FROM "dbrdf_VisitingProfessor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#orgPublication>(?X,?X1) .
    INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.s FROM "dbrdf_orgPublication" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Institute>(?X) .
    INSERT INTO "dbrdf_Organization"(s) SELECT t0.s FROM "dbrdf_Institute" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#University>(?X) .
    INSERT INTO "dbrdf_Organization"(s) SELECT t0.s FROM "dbrdf_University" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf>(?X,?X1) .
    INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.o FROM "dbrdf_subOrganizationOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#affiliatedOrganizationOf>(?X,?X1) .
    INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.s FROM "dbrdf_affiliatedOrganizationOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#affiliatedOrganizationOf>(?X,?X1) .
    INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.o FROM "dbrdf_affiliatedOrganizationOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ResearchGroup>(?X) .
    INSERT INTO "dbrdf_Organization"(s) SELECT t0.s FROM "dbrdf_ResearchGroup" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#affiliateOf>(?X,?X1) .
    INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.s FROM "dbrdf_affiliateOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#subOrganizationOf>(?X,?X1) .
    INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.s FROM "dbrdf_subOrganizationOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#AdministrativeStaff>(?X) .
    INSERT INTO "dbrdf_Employee"(s) SELECT t0.s FROM "dbrdf_AdministrativeStaff" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Employee" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR7>(?X,?Y) .
    INSERT INTO "dbrdf_worksFor"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR7" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_worksFor" ex WHERE ex.s = t0.s AND ex.o = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#hasAlumnus>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.o FROM "dbrdf_hasAlumnus" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#affiliateOf>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.o FROM "dbrdf_affiliateOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_advisor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#doctoralDegreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_doctoralDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#GraduateStudent>(?X) .
    INSERT INTO "dbrdf_Person"(s) SELECT t0.s FROM "dbrdf_GraduateStudent" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#ResearchAssistant>(?X) .
    INSERT INTO "dbrdf_Person"(s) SELECT t0.s FROM "dbrdf_ResearchAssistant" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#emailAddress>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_emailAddress" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#title>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_title" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#age>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_age" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#degreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_degreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#telephone>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_telephone" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#publicationAuthor>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.o FROM "dbrdf_publicationAuthor" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#undergraduateDegreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_undergraduateDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#mastersDegreeFrom>(?X,?X1) .
    INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_mastersDegreeFrom" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Student>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#UndergraduateStudent>(?X) .
    INSERT INTO "dbrdf_Student"(s) SELECT t0.s FROM "dbrdf_UndergraduateStudent" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Student" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf>(?X,?X1) .
    INSERT INTO "dbrdf_Course"(s) SELECT DISTINCT t0.o FROM "dbrdf_teacherOf" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Course" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#GraduateCourse>(?X) .
    INSERT INTO "dbrdf_Course"(s) SELECT t0.s FROM "dbrdf_GraduateCourse" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Course" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#listedCourse>(?X,?X1) .
    INSERT INTO "dbrdf_Course"(s) SELECT DISTINCT t0.o FROM "dbrdf_listedCourse" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Course" ex WHERE ex.s = t0.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- Prepare temporary tables for recursive rules

    delta_old_size := 0;

    CREATE LOCAL TEMPORARY TABLE "dbrdf_takesCourse_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_takesCourse_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_takesCourse" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_takesCourse_delta_old" ON "dbrdf_takesCourse_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_takesCourse_delta_old" ON "dbrdf_takesCourse_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_takesCourse_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_takesCourse_old" ON "dbrdf_takesCourse_old"(s, o); CREATE INDEX "IDX_1_dbrdf_takesCourse_old" ON "dbrdf_takesCourse_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_takesCourse_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR5_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_NR5_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR5" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_NR5_delta_old" ON "dbrdf_NR5_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_NR5_delta_old" ON "dbrdf_NR5_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR5_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR4_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_NR4_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR4" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_NR4_delta_old" ON "dbrdf_NR4_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_NR4_delta_old" ON "dbrdf_NR4_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR4_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_TeachingAssistant_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_TeachingAssistant_delta_old"(s) SELECT t0.s FROM "dbrdf_TeachingAssistant" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_TeachingAssistant_delta_old" ON "dbrdf_TeachingAssistant_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_TeachingAssistant_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Department_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Department_delta_old"(s) SELECT t0.s FROM "dbrdf_Department" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Department_delta_old" ON "dbrdf_Department_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Department_old"(s integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_Department_old" ON "dbrdf_Department_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Department_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_College_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_College_delta_old"(s) SELECT t0.s FROM "dbrdf_College" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_College_delta_old" ON "dbrdf_College_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_College_old"(s integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_College_old" ON "dbrdf_College_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_College_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR3_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_NR3_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR3" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_NR3_delta_old" ON "dbrdf_NR3_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_NR3_delta_old" ON "dbrdf_NR3_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR3_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Faculty_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Faculty_delta_old"(s) SELECT t0.s FROM "dbrdf_Faculty" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Faculty_delta_old" ON "dbrdf_Faculty_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Faculty_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Professor_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Professor_delta_old"(s) SELECT t0.s FROM "dbrdf_Professor" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Professor_delta_old" ON "dbrdf_Professor_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Professor_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Dean_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Dean_delta_old"(s) SELECT t0.s FROM "dbrdf_Dean" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Dean_delta_old" ON "dbrdf_Dean_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Dean_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Program_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Program_delta_old"(s) SELECT t0.s FROM "dbrdf_Program" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Program_delta_old" ON "dbrdf_Program_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Program_old"(s integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_Program_old" ON "dbrdf_Program_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Program_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR0_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_NR0_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR0" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_NR0_delta_old" ON "dbrdf_NR0_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_NR0_delta_old" ON "dbrdf_NR0_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR0_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Director_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Director_delta_old"(s) SELECT t0.s FROM "dbrdf_Director" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Director_delta_old" ON "dbrdf_Director_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Director_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_member_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_member_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_member" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_member_delta_old" ON "dbrdf_member_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_member_delta_old" ON "dbrdf_member_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_member_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_memberOf_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_memberOf_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_memberOf" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_memberOf_delta_old" ON "dbrdf_memberOf_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_memberOf_delta_old" ON "dbrdf_memberOf_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_memberOf_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Organization_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Organization_delta_old"(s) SELECT t0.s FROM "dbrdf_Organization" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Organization_delta_old" ON "dbrdf_Organization_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Organization_old"(s integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_Organization_old" ON "dbrdf_Organization_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Organization_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR1_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_NR1_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR1" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_NR1_delta_old" ON "dbrdf_NR1_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_NR1_delta_old" ON "dbrdf_NR1_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR1_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Employee_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Employee_delta_old"(s) SELECT t0.s FROM "dbrdf_Employee" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Employee_delta_old" ON "dbrdf_Employee_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Employee_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_worksFor_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_worksFor_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_worksFor" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_worksFor_delta_old" ON "dbrdf_worksFor_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_worksFor_delta_old" ON "dbrdf_worksFor_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_worksFor_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_worksFor_old" ON "dbrdf_worksFor_old"(s, o); CREATE INDEX "IDX_1_dbrdf_worksFor_old" ON "dbrdf_worksFor_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_worksFor_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_headOf_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_headOf_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_headOf" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_headOf_delta_old" ON "dbrdf_headOf_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_headOf_delta_old" ON "dbrdf_headOf_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_headOf_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_headOf_old" ON "dbrdf_headOf_old"(s, o); CREATE INDEX "IDX_1_dbrdf_headOf_old" ON "dbrdf_headOf_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_headOf_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR6_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_NR6_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR6" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_NR6_delta_old" ON "dbrdf_NR6_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_NR6_delta_old" ON "dbrdf_NR6_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_NR6_delta_new"(s integer, o integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Chair_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Chair_delta_old"(s) SELECT t0.s FROM "dbrdf_Chair" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Chair_delta_old" ON "dbrdf_Chair_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Chair_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Person_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Person_delta_old"(s) SELECT t0.s FROM "dbrdf_Person" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Person_delta_old" ON "dbrdf_Person_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Person_old"(s integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_Person_old" ON "dbrdf_Person_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Person_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Student_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Student_delta_old"(s) SELECT t0.s FROM "dbrdf_Student" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Student_delta_old" ON "dbrdf_Student_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Student_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Course_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Course_delta_old"(s) SELECT t0.s FROM "dbrdf_Course" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_Course_delta_old" ON "dbrdf_Course_delta_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Course_old"(s integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_Course_old" ON "dbrdf_Course_old"(s);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_Course_delta_new"(s integer) ON COMMIT DROP;
    CREATE LOCAL TEMPORARY TABLE "dbrdf_teachingAssistantOf_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_teachingAssistantOf_delta_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_teachingAssistantOf" t0;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_teachingAssistantOf_delta_old" ON "dbrdf_teachingAssistantOf_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_teachingAssistantOf_delta_old" ON "dbrdf_teachingAssistantOf_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_teachingAssistantOf_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_teachingAssistantOf_old" ON "dbrdf_teachingAssistantOf_old"(s, o); CREATE INDEX "IDX_1_dbrdf_teachingAssistantOf_old" ON "dbrdf_teachingAssistantOf_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_teachingAssistantOf_delta_new"(s integer, o integer) ON COMMIT DROP;

    -- Iterate recursive rules

    WHILE delta_old_size <> 0 LOOP
        delta_old_size := 0;

        -- Evaluate seminaive rules

        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR5$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_takesCourse_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR5_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_takesCourse" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR5$delta_new>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI5>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Student$delta_old>(?X) .
        INSERT INTO "dbrdf_NR5_delta_new"(s, o) SELECT t0.s, 26427 FROM "dbrdf_Student_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR5" ex WHERE ex.s = t0.s AND ex.o = 26427);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR4$delta_new>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI4>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant$delta_old>(?X) .
        INSERT INTO "dbrdf_NR4_delta_new"(s, o) SELECT t0.s, 26428 FROM "dbrdf_TeachingAssistant_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR4" ex WHERE ex.s = t0.s AND ex.o = 26428);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_old>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X1) .
        INSERT INTO "dbrdf_TeachingAssistant_delta_new"(s) SELECT t0.s FROM "dbrdf_Person_delta_old" t0, "dbrdf_teachingAssistantOf" t1, "dbrdf_Course" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_TeachingAssistant" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf$delta_old>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X1) .
        INSERT INTO "dbrdf_TeachingAssistant_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_teachingAssistantOf_delta_old" t1, "dbrdf_Course" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_TeachingAssistant" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course$delta_old>(?X1) .
        INSERT INTO "dbrdf_TeachingAssistant_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_teachingAssistantOf" t1, "dbrdf_Course_delta_old" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_TeachingAssistant" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_TeachingAssistant_delta_new"(s) SELECT t0.s FROM "dbrdf_teachingAssistantOf_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_TeachingAssistant" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Department$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR6$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Department_delta_new"(s) SELECT t0.o FROM "dbrdf_NR6_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Department" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#College$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR3$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_College_delta_new"(s) SELECT t0.o FROM "dbrdf_NR3_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_College" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR3$delta_new>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI3>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Dean$delta_old>(?X) .
        INSERT INTO "dbrdf_NR3_delta_new"(s, o) SELECT t0.s, 26429 FROM "dbrdf_Dean_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR3" ex WHERE ex.s = t0.s AND ex.o = 26429);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Faculty$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor$delta_old>(?X) .
        INSERT INTO "dbrdf_Faculty_delta_new"(s) SELECT t0.s FROM "dbrdf_Professor_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Faculty" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Dean$delta_old>(?X) .
        INSERT INTO "dbrdf_Professor_delta_new"(s) SELECT t0.s FROM "dbrdf_Dean_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Professor$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Chair$delta_old>(?X) .
        INSERT INTO "dbrdf_Professor_delta_new"(s) SELECT t0.s FROM "dbrdf_Chair_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Professor" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Dean$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_old>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#College>(?X1) .
        INSERT INTO "dbrdf_Dean_delta_new"(s) SELECT t0.s FROM "dbrdf_headOf_delta_old" t0, "dbrdf_College" t1 WHERE t0.o = t1.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Dean" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Dean$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#College$delta_old>(?X1) .
        INSERT INTO "dbrdf_Dean_delta_new"(s) SELECT t0.s FROM "dbrdf_headOf" t0, "dbrdf_College_delta_old" t1 WHERE t0.o = t1.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Dean" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Program$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR0$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Program_delta_new"(s) SELECT t0.o FROM "dbrdf_NR0_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Program" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR0$delta_new>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI0>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Director$delta_old>(?X) .
        INSERT INTO "dbrdf_NR0_delta_new"(s, o) SELECT t0.s, 26430 FROM "dbrdf_Director_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR0" ex WHERE ex.s = t0.s AND ex.o = 26430);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Director$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_old>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Program>(?X1) .
        INSERT INTO "dbrdf_Director_delta_new"(s) SELECT t0.s FROM "dbrdf_Person_delta_old" t0, "dbrdf_headOf" t1, "dbrdf_Program" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Director" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Director$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_old>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Program>(?X1) .
        INSERT INTO "dbrdf_Director_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_headOf_delta_old" t1, "dbrdf_Program" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Director" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Director$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Program$delta_old>(?X1) .
        INSERT INTO "dbrdf_Director_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_headOf" t1, "dbrdf_Program_delta_old" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Director" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#member$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#memberOf$delta_old>(?Y,?X) .
        INSERT INTO "dbrdf_member_delta_new"(s, o) SELECT t0.o, t0.s FROM "dbrdf_memberOf_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_member" ex WHERE ex.s = t0.o AND ex.o = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#memberOf$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#member$delta_old>(?Y,?X) .
        INSERT INTO "dbrdf_memberOf_delta_new"(s, o) SELECT t0.o, t0.s FROM "dbrdf_member_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_memberOf" ex WHERE ex.s = t0.o AND ex.o = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#memberOf$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_memberOf_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_worksFor_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_memberOf" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#member$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Organization_delta_new"(s) SELECT t0.s FROM "dbrdf_member_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Program$delta_old>(?X) .
        INSERT INTO "dbrdf_Organization_delta_new"(s) SELECT t0.s FROM "dbrdf_Program_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR1$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Organization_delta_new"(s) SELECT t0.o FROM "dbrdf_NR1_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Department$delta_old>(?X) .
        INSERT INTO "dbrdf_Organization_delta_new"(s) SELECT t0.s FROM "dbrdf_Department_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#College$delta_old>(?X) .
        INSERT INTO "dbrdf_Organization_delta_new"(s) SELECT t0.s FROM "dbrdf_College_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Organization" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR1$delta_new>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI1>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee$delta_old>(?X) .
        INSERT INTO "dbrdf_NR1_delta_new"(s, o) SELECT t0.s, 26431 FROM "dbrdf_Employee_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR1" ex WHERE ex.s = t0.s AND ex.o = 26431);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Faculty$delta_old>(?X) .
        INSERT INTO "dbrdf_Employee_delta_new"(s) SELECT t0.s FROM "dbrdf_Faculty_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Employee" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_old>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X1) .
        INSERT INTO "dbrdf_Employee_delta_new"(s) SELECT t0.s FROM "dbrdf_Person_delta_old" t0, "dbrdf_worksFor" t1, "dbrdf_Organization" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Employee" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor$delta_old>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization>(?X1) .
        INSERT INTO "dbrdf_Employee_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_worksFor_delta_old" t1, "dbrdf_Organization" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Employee" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Organization$delta_old>(?X1) .
        INSERT INTO "dbrdf_Employee_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_worksFor" t1, "dbrdf_Organization_delta_old" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Employee" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_worksFor_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_headOf_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_worksFor" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR1$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_worksFor_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR1_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_worksFor" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR6$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_headOf_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR6_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_headOf" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR3$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_headOf_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR3_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_headOf" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR0$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_headOf_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR0_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_headOf" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR6$delta_new>(?X,<http://swat.cse.lehigh.edu/onto/univ-bench.owl#NI6>) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Chair$delta_old>(?X) .
        INSERT INTO "dbrdf_NR6_delta_new"(s, o) SELECT t0.s, 26432 FROM "dbrdf_Chair_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_NR6" ex WHERE ex.s = t0.s AND ex.o = 26432);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Chair$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_old>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Department>(?X1) .
        INSERT INTO "dbrdf_Chair_delta_new"(s) SELECT t0.s FROM "dbrdf_Person_delta_old" t0, "dbrdf_headOf" t1, "dbrdf_Department" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Chair" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Chair$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf$delta_old>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Department>(?X1) .
        INSERT INTO "dbrdf_Chair_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_headOf_delta_old" t1, "dbrdf_Department" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Chair" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Chair$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Department$delta_old>(?X1) .
        INSERT INTO "dbrdf_Chair_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_headOf" t1, "dbrdf_Department_delta_old" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Chair" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#member$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Person_delta_new"(s) SELECT t0.o FROM "dbrdf_member_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Employee$delta_old>(?X) .
        INSERT INTO "dbrdf_Person_delta_new"(s) SELECT t0.s FROM "dbrdf_Employee_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Director$delta_old>(?X) .
        INSERT INTO "dbrdf_Person_delta_new"(s) SELECT t0.s FROM "dbrdf_Director_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Student$delta_old>(?X) .
        INSERT INTO "dbrdf_Person_delta_new"(s) SELECT t0.s FROM "dbrdf_Student_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Chair$delta_old>(?X) .
        INSERT INTO "dbrdf_Person_delta_new"(s) SELECT t0.s FROM "dbrdf_Chair_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant$delta_old>(?X) .
        INSERT INTO "dbrdf_Person_delta_new"(s) SELECT t0.s FROM "dbrdf_TeachingAssistant_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Person" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Student$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person$delta_old>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X1) .
        INSERT INTO "dbrdf_Student_delta_new"(s) SELECT t0.s FROM "dbrdf_Person_delta_old" t0, "dbrdf_takesCourse" t1, "dbrdf_Course" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Student" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Student$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse$delta_old>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X1) .
        INSERT INTO "dbrdf_Student_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_takesCourse_delta_old" t1, "dbrdf_Course" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Student" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Student$delta_new>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person>(?X), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course$delta_old>(?X1) .
        INSERT INTO "dbrdf_Student_delta_new"(s) SELECT t0.s FROM "dbrdf_Person" t0, "dbrdf_takesCourse" t1, "dbrdf_Course_delta_old" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND NOT EXISTS (SELECT 1 FROM "dbrdf_Student" ex WHERE ex.s = t0.s);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Course_delta_new"(s) SELECT t0.o FROM "dbrdf_teachingAssistantOf_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Course" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR4$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Course_delta_new"(s) SELECT t0.o FROM "dbrdf_NR4_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Course" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course$delta_new>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR5$delta_old>(?X,?X1) .
        INSERT INTO "dbrdf_Course_delta_new"(s) SELECT t0.o FROM "dbrdf_NR5_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Course" ex WHERE ex.s = t0.o);


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#NR4$delta_old>(?X,?Y) .
        INSERT INTO "dbrdf_teachingAssistantOf_delta_new"(s, o) SELECT t0.s, t0.o FROM "dbrdf_NR4_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_teachingAssistantOf" ex WHERE ex.s = t0.s AND ex.o = t0.o);


        -- Propagate $delta_new

        INSERT INTO "dbrdf_takesCourse_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_takesCourse_delta_old" t0;
        INSERT INTO "dbrdf_takesCourse"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_takesCourse_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_takesCourse_delta_old";
        INSERT INTO "dbrdf_takesCourse_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_takesCourse_delta_new" t0;
        TRUNCATE TABLE "dbrdf_takesCourse_delta_new";

        INSERT INTO "dbrdf_NR5"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR5_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_NR5_delta_old";
        INSERT INTO "dbrdf_NR5_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR5_delta_new" t0;
        TRUNCATE TABLE "dbrdf_NR5_delta_new";

        INSERT INTO "dbrdf_NR4"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR4_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_NR4_delta_old";
        INSERT INTO "dbrdf_NR4_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR4_delta_new" t0;
        TRUNCATE TABLE "dbrdf_NR4_delta_new";

        INSERT INTO "dbrdf_TeachingAssistant"(s) SELECT DISTINCT t0.s FROM "dbrdf_TeachingAssistant_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_TeachingAssistant_delta_old";
        INSERT INTO "dbrdf_TeachingAssistant_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_TeachingAssistant_delta_new" t0;
        TRUNCATE TABLE "dbrdf_TeachingAssistant_delta_new";

        INSERT INTO "dbrdf_Department_old"(s) SELECT t0.s FROM "dbrdf_Department_delta_old" t0;
        INSERT INTO "dbrdf_Department"(s) SELECT DISTINCT t0.s FROM "dbrdf_Department_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Department_delta_old";
        INSERT INTO "dbrdf_Department_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Department_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Department_delta_new";

        INSERT INTO "dbrdf_College_old"(s) SELECT t0.s FROM "dbrdf_College_delta_old" t0;
        INSERT INTO "dbrdf_College"(s) SELECT DISTINCT t0.s FROM "dbrdf_College_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_College_delta_old";
        INSERT INTO "dbrdf_College_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_College_delta_new" t0;
        TRUNCATE TABLE "dbrdf_College_delta_new";

        INSERT INTO "dbrdf_NR3"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR3_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_NR3_delta_old";
        INSERT INTO "dbrdf_NR3_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR3_delta_new" t0;
        TRUNCATE TABLE "dbrdf_NR3_delta_new";

        INSERT INTO "dbrdf_Faculty"(s) SELECT DISTINCT t0.s FROM "dbrdf_Faculty_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Faculty_delta_old";
        INSERT INTO "dbrdf_Faculty_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Faculty_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Faculty_delta_new";

        INSERT INTO "dbrdf_Professor"(s) SELECT DISTINCT t0.s FROM "dbrdf_Professor_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Professor_delta_old";
        INSERT INTO "dbrdf_Professor_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Professor_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Professor_delta_new";

        INSERT INTO "dbrdf_Dean"(s) SELECT DISTINCT t0.s FROM "dbrdf_Dean_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Dean_delta_old";
        INSERT INTO "dbrdf_Dean_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Dean_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Dean_delta_new";

        INSERT INTO "dbrdf_Program_old"(s) SELECT t0.s FROM "dbrdf_Program_delta_old" t0;
        INSERT INTO "dbrdf_Program"(s) SELECT DISTINCT t0.s FROM "dbrdf_Program_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Program_delta_old";
        INSERT INTO "dbrdf_Program_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Program_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Program_delta_new";

        INSERT INTO "dbrdf_NR0"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR0_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_NR0_delta_old";
        INSERT INTO "dbrdf_NR0_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR0_delta_new" t0;
        TRUNCATE TABLE "dbrdf_NR0_delta_new";

        INSERT INTO "dbrdf_Director"(s) SELECT DISTINCT t0.s FROM "dbrdf_Director_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Director_delta_old";
        INSERT INTO "dbrdf_Director_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Director_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Director_delta_new";

        INSERT INTO "dbrdf_member"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_member_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_member_delta_old";
        INSERT INTO "dbrdf_member_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_member_delta_new" t0;
        TRUNCATE TABLE "dbrdf_member_delta_new";

        INSERT INTO "dbrdf_memberOf"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_memberOf_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_memberOf_delta_old";
        INSERT INTO "dbrdf_memberOf_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_memberOf_delta_new" t0;
        TRUNCATE TABLE "dbrdf_memberOf_delta_new";

        INSERT INTO "dbrdf_Organization_old"(s) SELECT t0.s FROM "dbrdf_Organization_delta_old" t0;
        INSERT INTO "dbrdf_Organization"(s) SELECT DISTINCT t0.s FROM "dbrdf_Organization_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Organization_delta_old";
        INSERT INTO "dbrdf_Organization_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Organization_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Organization_delta_new";

        INSERT INTO "dbrdf_NR1"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR1_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_NR1_delta_old";
        INSERT INTO "dbrdf_NR1_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR1_delta_new" t0;
        TRUNCATE TABLE "dbrdf_NR1_delta_new";

        INSERT INTO "dbrdf_Employee"(s) SELECT DISTINCT t0.s FROM "dbrdf_Employee_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Employee_delta_old";
        INSERT INTO "dbrdf_Employee_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Employee_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Employee_delta_new";

        INSERT INTO "dbrdf_worksFor_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_worksFor_delta_old" t0;
        INSERT INTO "dbrdf_worksFor"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_worksFor_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_worksFor_delta_old";
        INSERT INTO "dbrdf_worksFor_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_worksFor_delta_new" t0;
        TRUNCATE TABLE "dbrdf_worksFor_delta_new";

        INSERT INTO "dbrdf_headOf_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_headOf_delta_old" t0;
        INSERT INTO "dbrdf_headOf"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_headOf_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_headOf_delta_old";
        INSERT INTO "dbrdf_headOf_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_headOf_delta_new" t0;
        TRUNCATE TABLE "dbrdf_headOf_delta_new";

        INSERT INTO "dbrdf_NR6"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR6_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_NR6_delta_old";
        INSERT INTO "dbrdf_NR6_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_NR6_delta_new" t0;
        TRUNCATE TABLE "dbrdf_NR6_delta_new";

        INSERT INTO "dbrdf_Chair"(s) SELECT DISTINCT t0.s FROM "dbrdf_Chair_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Chair_delta_old";
        INSERT INTO "dbrdf_Chair_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Chair_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Chair_delta_new";

        INSERT INTO "dbrdf_Person_old"(s) SELECT t0.s FROM "dbrdf_Person_delta_old" t0;
        INSERT INTO "dbrdf_Person"(s) SELECT DISTINCT t0.s FROM "dbrdf_Person_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Person_delta_old";
        INSERT INTO "dbrdf_Person_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Person_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Person_delta_new";

        INSERT INTO "dbrdf_Student"(s) SELECT DISTINCT t0.s FROM "dbrdf_Student_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Student_delta_old";
        INSERT INTO "dbrdf_Student_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Student_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Student_delta_new";

        INSERT INTO "dbrdf_Course_old"(s) SELECT t0.s FROM "dbrdf_Course_delta_old" t0;
        INSERT INTO "dbrdf_Course"(s) SELECT DISTINCT t0.s FROM "dbrdf_Course_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_Course_delta_old";
        INSERT INTO "dbrdf_Course_delta_old"(s) SELECT DISTINCT t0.s FROM "dbrdf_Course_delta_new" t0;
        TRUNCATE TABLE "dbrdf_Course_delta_new";

        INSERT INTO "dbrdf_teachingAssistantOf_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_teachingAssistantOf_delta_old" t0;
        INSERT INTO "dbrdf_teachingAssistantOf"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_teachingAssistantOf_delta_new" t0;
        GET DIAGNOSTICS rows_nr = ROW_COUNT;
        total_tuples := total_tuples + rows_nr;
        delta_old_size := delta_old_size + rows_nr;
        TRUNCATE TABLE "dbrdf_teachingAssistantOf_delta_old";
        INSERT INTO "dbrdf_teachingAssistantOf_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_teachingAssistantOf_delta_new" t0;
        TRUNCATE TABLE "dbrdf_teachingAssistantOf_delta_new";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 14
    ---- DEPENDS ON: 13, 6
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Work>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Research>(?X) .
    INSERT INTO "dbrdf_Work"(s) SELECT t0.s FROM "dbrdf_Research" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Work" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Work>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#Course>(?X) .
    INSERT INTO "dbrdf_Work"(s) SELECT t0.s FROM "dbrdf_Course" t0 WHERE NOT EXISTS (SELECT 1 FROM "dbrdf_Work" ex WHERE ex.s = t0.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    RETURN total_tuples;
END;
$$ LANGUAGE plpgsql;

-- END FUNCTION:   do_reasoning_all
------------------------------------------------------------------------------------------
