![](bg4.png)
program by rules of form (2)-(4). A food recall by a
given company is encoded as (5). A conceptual
model for supply chains is that of an acyclic,
directed graph as illustrated in Figure 1. Knowledge
about supply chain operations provides the
semantics for the graph’s vertices and edges. Each
vertex, except for a point of origin or food source
such as the grower or importer, corresponds to a
firm A that performs a transformative step on a less
processed product to generate a more refined
product supplied to firm B located down-stream in
the chain and to whom A is directly connected by an
edge in the graph. Clearly, if A supplies B—who in
turn supplies another firm or a final consumer, then
their products are derived from the same food
commodity. Rule (6) encodes the supply functions.
Each edge of the graph represents a valid flow of
ingredients or final product(s) for resale from a firm
A set upstream in the chain and directly connected to
a firm B by an edge in the graph, i.e. a supply
operation between the two types of entities
connected in that supply chain. Figure 1 contains
17 edges with 4 dashed edges corresponding to
foreign supplying functions. The U.S. supply chain
defined by 13 solid edges is encoded by 13
individual rules of the form of (7) or (8), depending
on whether an ingredient or final product is supplied.
We omit some of the rules to avoid repetition and
save space. Tracing products forward, and similarly
backward, in the supply chain is achieved by (9)-
(14), which also compute the transitive closure of
these relations. Our knowledge base contains a
simple ontology which models the main stages of a
food product as it evolves from raw, unprocessed
food at the farmer/grower level of the supply chain
to a processed food ready for consumption at the
retail point-of-sale. The ontology is built with rules
of form (15)-(16) for each food supply chain (47) to
represent a product’s primary ingredient(s) and its
derivative products as illustrated by facts (17)-(46).
The ASP program described and below is based on
work from (Nogueira and Greis, 2012 and 2013).
firm(Idcode,Name,State). (2)
type_firm(Idcode,Type). (3)
prod_supplied(Idcode,Product).
(4)
recall(Product,Idcode). (5)
supplies(A,I1,B) :- (6)
valid_supply(F,A,B),
is_of(I1,F),prod_supplied(A,I1),
is_of(I2,F),prod_supplied(B,I2).
valid_supply(F,A,B) :-
(7)
type_firm(A,grower),
type_firm(B,processor),A!=B,
sc(F),is_ingr(I1,I2),
is_of(I1,F),prod_supplied(A,I1),
is_of(I2,F),prod_supplied(B,I2).
valid_supply(F,A,B) :- (8)
type_firm(A,grower),
type_firm(B,wholesaler),A!=B,
sc(F),prod_supplied(A,I),
is_of(I,F),prod_supplied(B,I).
fwtrace(C,LC,F,A,LA) :- (9)
recall(F,C),supplies(C,F,A),
firm(C,_,LC),firm(A,_,LA), C!=A.
fwtrace(B,LB,F1,A,LA) :- (10)
is_ingr(F,F1),supplies(B,F1,A),
fwtrace(C,LC,F,B,LB),
firm(C,_,LC),firm(B,_,LB),
firm(A,_,LA),B!=C,B!=A,A!=C.
fwtrace(B,LB,F,A,LA) :- (11)
supplies(B,F,A),
fwtrace(C,LC,F,B,LB),
firm(B,_,LB),firm(A,_,LA),
firm(C,_,LC),B!=C,B!=A,A!=C.
bktrace(A,LA,F,C,LC) :- (12)
recall(F,C),supplies(A,F,C),
firm(C,_,LC),firm(A,_,LA),C!=A.
bktrace(B,LB,F1,C,LC):- (13)
is_ingr(F1,F),supplies(B,F1,C),
bktrace(C,LC,F,A,LA),
firm(B,_,LB),firm(C,_,LC),
firm(A,_,LA),B!=C,B!=A,A!=C.
bktrace(B,LB,F,C,LC) :- (14)
supplies(B,F,C),
bktrace(C,LC,F,A,LA),
firm(B,_,LB),firm(C,_,LC),
firm(A,_,LA),B!=C,B!=A,A!=C.
is_of(Product,Chain). (15)
is_ingr(Product1,Product2). (16)
is_of(ttfresh, tomatoes). (17)
is_of(ttketchup, tomatoes). (18)
is_of(ttpastepuree, tomatoes).
(19)
…
is_of(pepper, peppers). (27)
is_of(ppfresh, peppers). (28)
is_of(ppchili, peppers).
(29)
is_ingr(ttfresh, ttpastepuree). (30)
is_ingr(ttpreserved, ttketchup).(31)
is_ingr(ttpreserved, ttsauce). (32)
…
is_ingr(ppfresh, pepper). (43)
is_ingr(ppgreenfrsh, ppcrshgrd).(44)
is_ingr(ppcrshgrd,ppdrycrshgrd).(45)
is_ingr(ppchili, ppdrycrshgrd). (46)
supply_chain(Chain). (47)
KEOD2013-InternationalConferenceonKnowledgeEngineeringandOntologyDevelopment
402