% XY Example 3. BOM: for each part X counting its basic componets Y % "Negation and Aggregates in Recursive Rules: the LDL++ Approach", DOOD 93. database ( { g(X:string, Y:string, Q:integer) }). export rgc(I, X, Y, C). export final_count(X,Y,C). rgc(0,X,Y,sum_all) <- g(X,Y,Q), ~g(Y,_,_). rgc(I+1,X,Y,sum_all) <- g(X,W,Q2), rgc(I,W,Y,Q1), Q=Q1*Q2. final_count(X1,Y1,sum_all) <- rgc(I,X1,Y1,Q).