#1 11.05.09 02:59
Помогите, Prolog
есть задание:
__________________________________________________ ___________________________
Разработать базу данных продовольственной торговой компании, содержащую сведения о складах и магазинах (виды и количество продуктов, наименования поставщиков продуктов, оптовые и розничные цены продуктов и т.д.).
Выполнить в окне Dialog четыре сложных поисковых запроса, например:
•определить магазины, где имеется продукт А по цене от Р1 до Р2 от постав-щика В в количестве не менее Q килограммов (литров, штук)
__________________________________________________ ___________________________
не знаю с чего начать и как.до этого было задание написать генеалогическое дерево условной семьи
domains
fact=symbol
predicates
male(fact)
female(fact)
mother(fact,fact)
father(fact,fact)
wife(fact,fact)
son(fact,fact)
dauther(fact,fact)
brother(fact,fact)
sister(fact,fact)
grandm(fact,fact)
grandf(fact,fact)
uncle(fact,fact)
aunt(fact,fact)
cousen(fact,fact)
cousin(fact,fact)
clauses
male(vyacheslav).
male(sasha).
male(dmitrii).
male(vasiliy).
male(alex).
female(inna).
female(olga).
female(alena).
female(eva).
mother(inna,olga).
mother(inna,sasha).
mother(eva,alex).
mother(olga,alena).
father(vyacheslav,sasha).
father(vyacheslav,olga).
father(dmitriy,alena).
father(sasha,alex).
wife(inna,vyacheslav).
wife(olga,dmitrii).
wife(alena,vasiliy).
wife(eva,sasha).
son(X,Y):-mother(Y,X),male(X).
son(X,Y):-father(Y,X),male(X).
dauther(X,Y):-mother(Y,X),female(X).
dauther(X,Y):-mother(Y,X),female(X).
brother(X,Y):-mother(Z,X),mother(Z,Y),male(X),X<>Y.
sister(X,Y):-mother(Z,X),mother(Z,Y),female(X),X<>Y.
grandf(X,Y):-father(X,Z),father(Z,Y).
grandf(X,Y):-father(X,Z),mother(Z,Y).
grandm(X,Y):-mother(X,Z),father(Z,Y).
grandm(X,Y):-mother(X,Z),mother(Z,Y).
aunt(X,Y):-brother(Z,X),father(Z,Y),female(X).
aunt(X,Y):-sister(Z,X),mother(Z,Y),female(X).
uncle(X,Y):-brother(Z,X),father(Z,Y),male(X).
uncle(X,Y):-sister(Z,X),mother(Z,Y),male(X).
cousen(X,Y):-father(Z,X),brother(N,Z),father(N,Y),male(X).
cousen(X,Y):-father(Z,X),sister(N,Z),mother(N,Y),male(X).
cousen(X,Y):-mother(Z,X),sister(N,Z),father(N,Y),male(X).
cousen(X,Y):-mother(Z,X),brother(N,Z),father(N,Y),male(X).
cousin(X,Y):-father(Z,X),brother(N,Z),father(N,Y),male(X).
cousin(X,Y):-father(Z,X),sister(N,Z),mother(N,Y),male(X).
cousin(X,Y):-mother(Z,X),sister(N,Z),father(N,Y),male(X).
cousin(X,Y):-mother(Z,X),brother(N,Z),father(N,Y),male(X).
тут вроде все просто, а вот как реализовать БД...
кто может чем помочь, подсказать...
Offline

