Skip to content
Snippets Groups Projects
hw2-q3.dl 863 B
Newer Older
Dan Suciu's avatar
Dan Suciu committed
/************ data model **************/
.symbol_type PersonType
.symbol_type DescriptionType

.decl person(name:PersonType, description:DescriptionType)
.input person(filename="DATA/person.facts")

.decl female(name:PersonType)
.input female(filename="DATA/female.facts")

.decl male(name:PersonType)
.input male(filename="DATA/male.facts")

.decl parent_child(p1:PersonType, p2:PersonType)
.input parent_child(filename="DATA/parent_child.facts")

.decl person_living(p:PersonType)
.input person_living(filename="DATA/person_living.facts")

/************* problem 0 **************/
/**** Find all children of Priscilla ****/
.decl p0(x:PersonType, d:DescriptionType)
// NOTE: if you want to redirect the output to a file
// you can use the syntax:
// .output p0(filename="hw2-q3-0.ans")
.output p0(IO=stdout)
p0(x,d) :- parent_child("Priscilla",x), person(x,d).