------------------------------------------------------------------------------------------
-- 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#ResearchGroup>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#researchProject>(?X,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 2574 FROM "__triples" t0 WHERE t0.p = 26458 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2574);
    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 "__triples" t0 WHERE t0.p = 12;
    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, "__triples" t1 WHERE t0.o = t1.s AND t1.p = 12 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 12 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 "__triples" t0, "dbrdf_subOrganizationOf_delta_old" t1 WHERE t0.o = t1.s AND t0.p = 12 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 12 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 12, 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#Research>(?X1) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#researchProject>(?X,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26459 FROM "__triples" t0 WHERE t0.p = 26458 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26459);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26459 FROM "__triples" t0 WHERE t0.p = 26460 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26459);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 3
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor_takesCourse>(?X0,?X2) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor>(?X1,?X0), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X1,?X2) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.o, 26461, t1.o FROM "__triples" t0, "__triples" t1 WHERE t0.s = t1.s AND t0.p = 429 AND t1.p = 416 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 26461 AND ex.o = t1.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#connectedCourses>(?X0,?X2) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X1,?X0), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X1,?X2) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.o, 26462, t1.o FROM "__triples" t0, "__triples" t1 WHERE t0.s = t1.s AND t0.p = 416 AND t1.p = 416 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 26462 AND ex.o = t1.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_connectedCourses_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_connectedCourses_delta_old"(s, o) SELECT t0.s, t0.o FROM "__triples" t0 WHERE t0.p = 26462;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_connectedCourses_delta_old" ON "dbrdf_connectedCourses_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_connectedCourses_delta_old" ON "dbrdf_connectedCourses_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_connectedCourses_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_connectedCourses_old" ON "dbrdf_connectedCourses_old"(s, o); CREATE INDEX "IDX_1_dbrdf_connectedCourses_old" ON "dbrdf_connectedCourses_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_connectedCourses_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#connectedCourses$delta_new>(?X,?Z) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#connectedCourses$delta_old>(?X,?Y), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#connectedCourses>(?Y,?Z) .
        INSERT INTO "dbrdf_connectedCourses_delta_new"(s, o) SELECT t0.s, t1.o FROM "dbrdf_connectedCourses_delta_old" t0, "__triples" t1 WHERE t0.o = t1.s AND t1.p = 26462 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26462 AND ex.o = t1.o);


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


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#connectedCourses$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#connectedCourses$delta_old>(?Y,?X) .
        INSERT INTO "dbrdf_connectedCourses_delta_new"(s, o) SELECT t0.o, t0.s FROM "dbrdf_connectedCourses_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 26462 AND ex.o = t0.s);


        -- Propagate $delta_new

        INSERT INTO "dbrdf_connectedCourses_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_connectedCourses_delta_old" t0;
        INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26462, t0.o FROM "dbrdf_connectedCourses_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_connectedCourses_delta_old";
        INSERT INTO "dbrdf_connectedCourses_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_connectedCourses_delta_new" t0;
        TRUNCATE TABLE "dbrdf_connectedCourses_delta_new";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 5
    ----------------------------------------

    -- 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26463 FROM "__triples" t0 WHERE t0.p = 26464 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26463);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26463 FROM "__triples" t0 WHERE t0.p = 26465 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26463);
    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#AdministrativeStaff>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#SystemsStaff>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26466 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26467 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26466);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26466 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26468 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26466);
    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#Dean>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#College>(?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26469 FROM "__triples" t0, "__triples" t1 WHERE t0.o = t1.s AND t0.p = 102 AND t1.p = 2 AND t1.o = 26470 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26469);
    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#worksFor>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#headOf>(?X,?Y) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 26, t0.o FROM "__triples" t0 WHERE t0.p = 102 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26 AND ex.o = t0.o);
    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#Article>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TechnicalReport>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26471 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26472 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26471);
    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#ConferencePaper>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26471 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26473 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26471);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26471 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26474 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26471);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 10
    ---- DEPENDS ON: 9, 5
    ----------------------------------------

    -- Nonrecursive rules

    -- [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 "__triples"(s, p, o) SELECT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26475 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 2585 FROM "__triples" t0 WHERE t0.p = 26465 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26471 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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#Software>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26463 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26476 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 26460 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 26477 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2587 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26478 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 2585 FROM "__triples" t0 WHERE t0.p = 26479 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 2585);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 2585 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26480 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 2585);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 11
    ---- DEPENDS ON: 8
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#memberOf>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#worksFor>(?X,?Y) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 414, t0.o FROM "__triples" t0 WHERE t0.p = 26 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 414 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_memberOf_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_memberOf_delta_old"(s, o) SELECT t0.s, t0.o FROM "__triples" t0 WHERE t0.p = 414;
    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_member_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_member_delta_old"(s, o) SELECT t0.s, t0.o FROM "__triples" t0 WHERE t0.p = 26481;
    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;

    -- 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#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 "__triples" ex WHERE ex.s = t0.o AND ex.p = 414 AND ex.o = 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 "__triples" ex WHERE ex.s = t0.o AND ex.p = 26481 AND ex.o = t0.s);


        -- Propagate $delta_new

        INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 414, 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 26481, 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";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 12
    ----------------------------------------

    -- 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26482 FROM "__triples" t0 WHERE t0.p = 26483 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26482);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 13
    ----------------------------------------

    -- Nonrecursive rules

    -- [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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 3066 FROM "__triples" t0 WHERE t0.p = 26483 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 3066);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 3066 FROM "__triples" t0 WHERE t0.p = 16 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 3066);
    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#teachingAssistantOf>(?X,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 3066 FROM "__triples" t0 WHERE t0.p = 3197 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 3066);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 3066 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 3128 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 3066);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

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

    -- 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 "__triples"(s, p, o) SELECT t0.s, 2, 26484 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26459 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26484);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26484 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 3066 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26484);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 15
    ---- DEPENDS ON: 4, 3
    ----------------------------------------

    -- Nonrecursive rules

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues>(?X0,?X3) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf>(?X0,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#connectedCourses>(?X1,?X2), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf>(?X3,?X2) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26485, t2.s FROM "__triples" t0, "__triples" t1, "__triples" t2 WHERE t0.o = t1.s AND t1.o = t2.o AND t0.p = 16 AND t1.p = 26462 AND t2.p = 16 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26485 AND ex.o = t2.s);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues>(?X0,?X3) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf>(?X0,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#takesCourse>(?X2,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor>(?X2,?X3) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26485, t2.o FROM "__triples" t0, "__triples" t1, "__triples" t2 WHERE t0.o = t1.o AND t1.s = t2.s AND t0.p = 16 AND t1.p = 416 AND t2.p = 429 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26485 AND ex.o = t2.o);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues>(?X0,?X2) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor_takesCourse>(?X0,?X1), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#advisor_takesCourse>(?X2,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26485, t1.s FROM "__triples" t0, "__triples" t1 WHERE t0.o = t1.o AND t0.p = 26461 AND t1.p = 26461 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26485 AND ex.o = t1.s);
    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_colleagues_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_colleagues_delta_old"(s, o) SELECT t0.s, t0.o FROM "__triples" t0 WHERE t0.p = 26485;
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    delta_old_size := delta_old_size + rows_nr;
    CREATE INDEX "IDX_0_dbrdf_colleagues_delta_old" ON "dbrdf_colleagues_delta_old"(s, o); CREATE INDEX "IDX_1_dbrdf_colleagues_delta_old" ON "dbrdf_colleagues_delta_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_colleagues_old"(s integer, o integer) ON COMMIT DROP;
    CREATE INDEX "IDX_0_dbrdf_colleagues_old" ON "dbrdf_colleagues_old"(s, o); CREATE INDEX "IDX_1_dbrdf_colleagues_old" ON "dbrdf_colleagues_old"(o);
    CREATE LOCAL TEMPORARY TABLE "dbrdf_colleagues_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#colleagues$delta_new>(?X,?Z) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues$delta_old>(?X,?Y), <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues>(?Y,?Z) .
        INSERT INTO "dbrdf_colleagues_delta_new"(s, o) SELECT t0.s, t1.o FROM "dbrdf_colleagues_delta_old" t0, "__triples" t1 WHERE t0.o = t1.s AND t1.p = 26485 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26485 AND ex.o = t1.o);


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


        -- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues$delta_new>(?X,?Y) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#colleagues$delta_old>(?Y,?X) .
        INSERT INTO "dbrdf_colleagues_delta_new"(s, o) SELECT t0.o, t0.s FROM "dbrdf_colleagues_delta_old" t0 WHERE NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 26485 AND ex.o = t0.s);


        -- Propagate $delta_new

        INSERT INTO "dbrdf_colleagues_old"(s, o) SELECT t0.s, t0.o FROM "dbrdf_colleagues_delta_old" t0;
        INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26485, t0.o FROM "dbrdf_colleagues_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_colleagues_delta_old";
        INSERT INTO "dbrdf_colleagues_delta_old"(s, o) SELECT DISTINCT t0.s, t0.o FROM "dbrdf_colleagues_delta_new" t0;
        TRUNCATE TABLE "dbrdf_colleagues_delta_new";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 16
    ----------------------------------------

    -- 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 "__triples"(s, p, o) SELECT t0.s, 26487, t0.o FROM "__triples" t0 WHERE t0.p = 24 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26487 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 "__triples"(s, p, o) SELECT t0.s, 26487, t0.o FROM "__triples" t0 WHERE t0.p = 22 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26487 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 "__triples"(s, p, o) SELECT t0.s, 26487, t0.o FROM "__triples" t0 WHERE t0.p = 20 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 26487 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_hasAlumnus_delta_old"(s integer, o integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_hasAlumnus_delta_old"(s, o) SELECT t0.s, t0.o FROM "__triples" t0 WHERE t0.p = 26486;
    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;
    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 "__triples" t0 WHERE t0.p = 26487;
    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;

    -- 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#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 "__triples" ex WHERE ex.s = t0.o AND ex.p = 26486 AND ex.o = t0.s);


        -- <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 "__triples" ex WHERE ex.s = t0.o AND ex.p = 26487 AND ex.o = t0.s);


        -- Propagate $delta_new

        INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26486, 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";

        INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 26487, 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";

    END LOOP;

    -- END Recursive rules

    ----------------------------------------
    ---- COMPONENT 17
    ---- DEPENDS ON: 16
    ----------------------------------------

    -- Nonrecursive rules

    -- [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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 6 FROM "__triples" t0 WHERE t0.p = 22 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 6);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 6 FROM "__triples" t0 WHERE t0.p = 26487 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 6);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 6 FROM "__triples" t0 WHERE t0.p = 26486 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 6);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 6 FROM "__triples" t0 WHERE t0.p = 24 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 6);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 6 FROM "__triples" t0 WHERE t0.p = 20 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 6);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 18
    ---- DEPENDS ON: 11, 1, 17, 0
    ----------------------------------------

    -- Nonrecursive rules

    -- [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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 26479 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26489 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26488 FROM "__triples" t0 WHERE t0.p = 12 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26488);
    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#member>(?X,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 26481 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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#Department>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 10 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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#Program>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26490 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 26491 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 6 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26488 FROM "__triples" t0 WHERE t0.p = 26491 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26488);
    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#College>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26470 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 2574 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 26492 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26488 FROM "__triples" t0 WHERE t0.p = 12 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26488);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    ----------------------------------------
    ---- COMPONENT 19
    ---- DEPENDS ON: 16, 11, 13, 8, 6, 18, 7
    ----------------------------------------

    -- Nonrecursive rules

    -- [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 "__triples"(s, p, o) SELECT t0.s, 2, 26493 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 412 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26493);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26496 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26498 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26496);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26496 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 356 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26496);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26496 FROM "__triples" t0 WHERE t0.p = 16 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26496);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26497 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 125 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26497 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 262 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26497 FROM "__triples" t0 WHERE t0.p = 26500 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26497 FROM "__triples" t0 WHERE t0.p = 429 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26497);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26497 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 14 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26497 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26501 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);
    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#Dean>(?X) .
    INSERT INTO "__triples"(s, p, o) SELECT t0.s, 2, 26497 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26469 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);
    GET DIAGNOSTICS rows_nr = ROW_COUNT;
    total_tuples := total_tuples + rows_nr;

    -- [Rule] <http://swat.cse.lehigh.edu/onto/univ-bench.owl#TeachingAssistant>(?X) :- <http://swat.cse.lehigh.edu/onto/univ-bench.owl#teachingAssistantOf>(?X,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 3196 FROM "__triples" t0 WHERE t0.p = 3197 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 3196);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 26502 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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#member>(?X,?X1) .
    INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26494 FROM "__triples" t0 WHERE t0.p = 26481 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 26503 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 26487 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26494 FROM "__triples" t0 WHERE t0.p = 26486 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26494 FROM "__triples" t0 WHERE t0.p = 26492 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 29 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 429 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.o, 2, 26494 FROM "__triples" t0 WHERE t0.p = 2587 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.o AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 20 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 24 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 2012 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 3198 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 22 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 FROM "__triples" t0 WHERE t0.p = 27 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);
    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 "__triples"(s, p, o) SELECT t0.s, 2, 26504 FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26466 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26504);
    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_Student_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Student_delta_old"(s) SELECT t0.s FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26493;
    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_Director_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Director_delta_old"(s) SELECT t0.s FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26495;
    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_Faculty_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Faculty_delta_old"(s) SELECT t0.s FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26496;
    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 "__triples" t0 WHERE t0.p = 2 AND t0.o = 26497;
    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_Chair_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Chair_delta_old"(s) SELECT t0.s FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26499;
    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_TeachingAssistant_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_TeachingAssistant_delta_old"(s) SELECT t0.s FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 3196;
    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_Person_delta_old"(s integer) ON COMMIT DROP;
    INSERT INTO "dbrdf_Person_delta_old"(s) SELECT t0.s FROM "__triples" t0 WHERE t0.p = 2 AND t0.o = 26494;
    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_delta_new"(s 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 "__triples" t0 WHERE t0.p = 2 AND t0.o = 26504;
    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;

    -- 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#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, "__triples" t1, "__triples" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND t1.p = 416 AND t2.p = 2 AND t2.o = 3066 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26493);


        -- <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, "__triples" t1, "__triples" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND t1.p = 102 AND t2.p = 2 AND t2.o = 26490 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26495);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26496);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26497);


        -- <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, "__triples" t1, "__triples" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND t1.p = 102 AND t2.p = 2 AND t2.o = 10 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26499);


        -- <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, "__triples" t1, "__triples" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND t1.p = 3197 AND t2.p = 2 AND t2.o = 3066 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 3196);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26494);


        -- <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 "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26504);


        -- <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, "__triples" t1, "__triples" t2 WHERE t0.s = t1.s AND t1.o = t2.s AND t1.p = 26 AND t2.p = 2 AND t2.o = 26488 AND NOT EXISTS (SELECT 1 FROM "__triples" ex WHERE ex.s = t0.s AND ex.p = 2 AND ex.o = 26504);


        -- Propagate $delta_new

        INSERT INTO "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26493 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26495 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26496 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26497 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26499 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 3196 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26494 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 "__triples"(s, p, o) SELECT DISTINCT t0.s, 2, 26504 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";

    END LOOP;

    -- END Recursive rules

    RETURN total_tuples;
END;
$$ LANGUAGE plpgsql;

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