petshop-40-queries.spp
petshop/catalogue/petshop-40-queries.spp
Download original file · Petstore source contents
1domain petshop;23Scenario serial readShopInventory(Goods, Goods[], StockLine[]) {4prepareProductSelection;5listProducts;6prepareInventorySelection;7findStockLine;8identify(stockLines);9}1011Scenario serial readShopMerchant(Merchant) {12configureMerchantLookup;13findMerchant;14identify(merchant);15}1617atomic calculate prepareProductSelection(Goods) {18goods.active = true;19}2021atomic calculate filterProducts(Goods, Goods[]) {22Goods[] filtered = new Goods[] {23};24for (Goods product : goodss) {25if (goods.category == BLANK || product.category == goods.category) {26filtered = append(filtered, product);27}28}29goodss = filtered;30}3132Scenario serial browseShopProducts(Goods, Goods[]) {33prepareProductSelection;34listProducts;35localizeCatalog;36filterProducts;37}