:-module(test_constraint,[constraint/1]).


%constrain each p in pc
%	to have cpu(p) = "pentium2"
%	and name(has_os(p)) < > "win95"'


constraint(C) :-
	C=[restrict_subquery(
		all(var(uevar1)),
		[generate(pc,var(uevar1))],
		[logical_and(	[generate(cpu,[pc],[var(uevar1)],string,var(evar3)),expression([],[var(evar3)],expr(=,var(evar3),pentium2))],
				[	generate(has_os,[pc],[var(uevar1)],os,var(evar4)),
					generate(name,[os],[var(evar4)],string,var(evar5)),
					expression([],[var(evar5)],expr(<>,var(evar5),win95))
				]
		)
		]
	)].


/*
%constrain each p in pc
%	such that name(has_os(p)) = "winNT"
%to have memory(p) > = 32'

constraint(C) :-
	C=restrict_subquery(
		all(var(uevar2)),
		[	generate(pc,var(uevar2)),
			generate(has_os,[pc],[var(uevar2)],os,var(evar6)),
			generate(name,[os],[var(evar6)],string,var(evar7)),
			expression([],[var(evar7)],expr(=,var(evar7),winNT))
		],
		[	generate(memory,[pc],[var(uevar2)],integer,var(evar8)),
			expression([],[var(evar8)],expr(>=,var(evar8),32))
		]
	).
*/

