1 / 4

The Even Query

The Even Query. % Express the even query without assuming a total order (i.e., use choice) item (a) . item(cc). item(bb). seq (nil , nil ). seq (X, Y ) <- seq (_, X), item(Y), choice((X), (Y)), choice((Y), (X)). even(nil). odd(Y ) < - even(X), seq (X, Y).

betrys
Download Presentation

The Even Query

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Even Query %Express the even query without assuming a total order (i.e., use choice) item(a). item(cc). item(bb). seq(nil, nil). seq(X, Y) <- seq(\_, X), item(Y), choice((X), (Y)), choice((Y), (X)). even(nil). odd(Y) <- even(X), seq(X, Y). even(Z) <- odd(Y), seq(Y, Z). evencount<- even(Z), ~seq(Z, \_). %but no recursive query is actually needed pair(X, Y) <- item(Y), item(Y), Y~=X, choice((X), (Y)), choice((Y), (X)). odd <- item(X), ~pair(X, _). even <- ~odd.

  2. How soon for each part delivery(Part, fsmax<Days>) <- basic(Part, Days). delivery(Part, fsmax<Days>) <- assbl(Part, Sub), delivery(Sub, Days). actualDays(Part, max<Days>) <- delivery(part, Days). % %An extension of the seminaivefixpoint to efficiently execute this program % ddelivery(0, Part, max<Days>) <- basic(Part, Days). %here the compiler will use max--but for the example at hand there is only %Day for each basic part. ddelivery(J+1, Part, max<Days>) <- assbl(Part, Sub), ddelivery(J, Sub, Days), if(all(J, Part, D2) then D2<Days). all(J+1, Part, Days) < all(J, Part, Days), ~ddelivery(J+1, Part, Days). all(J+1, Part, Days) <- ddelivery(J+1, Part, Days).

  3. How soon for each part delivery(Part, fsmax<Days>) <- basic(Part, Days). delivery(Part, fsmax<Days>) <- assbl(Part, Sub), delivery(Sub, Days). actualDays(Part, max<Days>) <- delivery(part, Days). %An extension of the seminaivefixpoint to efficiently execute this program ddelivery(0, Part, max<Days>) <- basic(Part, Days). ddelivery(J+1, Part, max<Days>) <- assbl(Part, Sub), ddelivery(J, Sub, Days), ~later(J, Part, Days) later(J, Part, Days) <- all(J, Part, D2), D2<Days. all(J+1, Part, Days) < all(J, Part, Days), ~ddelivery(J+1, Part, Days) all(J+1, Part, Days) <- ddelivery(J+1, Part, Days). basic(bolt, 2). basic(nut, 4). assb(frame, bolt). assb(bike, nut). assb(bike, frame). We thus get: ddelivery(0, bolt, 2). ddelivery(0, nut, 4). Then ddelivery(1, frame, 2). ddelivery(1, bike, 4). ddelivery(2, bike, 2) %from frame … we must compare against ddelivery(1, bike, 4). Obtained at the previous step.!!!!

  4. Stratification all(J+1, Part, Days) <- all(J, Part, Days), ~ddelivery(J+1, Part, Days). all(J+1, Part, Days) <- ddelivery(J+1, Part, Days). ddelivery(J+1, Part, max<Days>) <-assbl(Part, Sub), ddelivery(J, Sub, Days), ~later(J, Part, Days) later(J, Part, Days) <- all(J, Part, D2), D2<Days.

More Related