INTERNET
 :
  |    

/

, . /

-

1 | 2

 

11

.

-1-95.

1.   : - .

2.   : BD, :

 

 

 

: .

3.   , :

3.1. , , , :

3.2. :

       ;

       ;

       ;

       ;

       ;

3.3. BD B1, B2, , .

4.   :
4.1. :

4.2. :



5.   :

5.1. : 4.10.96.

5.2. , , : 18.10.96.

5.3. : 25.10.96.

5.4. - : 15.11.96.

5.5. : 29.11.96.

5.6. : 13.12.96.

5.7. : 20.12.96.

: .. ____________

: .. ____________


1.   - .
- , . . ( ), - , , ( , , - ), , . - , - .
, ( ) , .

2.   .
, , , (). n- ( n ), ( ) ( ).
( ).
, database. , , . , - dbasedom.
: assert - , retract - , save - , consult - .
bd, characteristick, b1, b2 table1, table2.

3.   .
- . (). do (char), , , :
+-------------- --------------+

:

1 :-

2 :-

3 :-

4 :-

5 :- 젠

6 :- 젠

7 :-

8 :- Ѡ

------------------| |------------------

+--------------------------------------------+

4.   .
do (<>), ( ). , : open, store, adding, correct, see, del, indication. Indication IndicationB1, IndicationB2 . Do(8) .

5.   :

5.1. (Open).
do(1) :
+--------- --------+

?

1 :- bd

2 :- b1

3 :- b2

4 :-

------| |------

+----------------------------+
Open , . ( exists). consult. Open(1) bd, Open(2) b1, Open(3) - b2.

5.2. (Store).
do(2) :

+--------- --------+

?

1 :- bd

2 :- b1

3 :- b2

4 :-

------| |------

+----------------------------+
. save, , .

5.3. (See).
do(3) :

+-------- -------+

?

1 :- bd

2 :- b1

3 :- b2

4 :-

------| |------

+----------------------------+
See(1) See(2) . , Fail .

5.4. (Adding).
, .
Get, assert, .

5.5. (Correct).
- , . ( ) , , , , (retract) (assert).

5.6. (Indication).
Indication(1) b1, Indication(2) - b2. - IndicationB1 IndicationB2. : , , . , . , b1 b2.

5.7. (Del).
, , . retract.

6. .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% %

% . %

% -1-95. %

% 11. %

% %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

domains

artikul = integer

cex, sklad = integer

name = string

rubley, kopeek = integer

year, month, day = integer

placedom = place(cex, sklad)

pricedom = price(rubley, kopeek)

datedom = date(year, month, day)

database - bd

characteristick(artikul, placedom, name, pricedom, datedom)

database - b1

table1(artikul, placedom, name, pricedom, datedom)

database - b2

table2(artikul, placedom, name, pricedom, datedom)

predicates

windows

go

do(char)

open(char)

store(char)

adding

correct(char)

indication(char)

indicationB1(char)

indicationB2(char)

see(char)

del(char)

exists(string)

show(artikul, placedom, name, pricedom, datedom)

get(artikul, placedom, name, pricedom, datedom)

goal

windows, go.

clauses

characteristick(1,place(5,6),"Gayka",price(0,45),date(1996,1,4)).

characteristick(2,place(6,7),"Vint",price(0,65),date(1996,2,45)).

windows :-

makewindow(1,52,0,"",24,0,1,80),

write(" ."),

makewindow(2,52,0,"",0,0,1,80),

write(" \" \""),

makewindow(3,112,1," ",2,17,14,46),

nl, write(" :"), nl,

nl, write(" 1 :- "),

nl, write(" 2 :- "),

nl, write(" 3 :- "),

nl, write(" 4 :- "),

nl, write(" 5 :- "),

nl, write(" 6 :- "),

nl, write(" 7 :- "),

nl, write(" 8 :- "), nl,

nl, write(" ------------------| |------------------"),

framewindow(126).

go :-

gotowindow(3), cursor(11,21),

readchar(X), do(X).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

do('1') :-

makewindow(4,18,1," ",5,25,10,30),

framewindow(19),

nl, write(" ?"), nl,

nl, write(" 1 :- bd"),

nl, write(" 2 :- b1"),

nl, write(" 3 :- b2"),

nl, write(" 4 :- "), nl,

nl, write(" ------| |------"),

cursor(7,13), readchar(X), open(X),

removewindow, go, !.

do('2') :-

makewindow(4,18,1," ",5,25,10,30),

framewindow(19),

nl, write(" ?"), nl,

nl, write(" 1 :- bd"),

nl, write(" 2 :- b1"),

nl, write(" 3 :- b2"),

nl, write(" 4 :- "), nl,

nl, write(" ------| |------"),

cursor(7,13), readchar(X), store(X),

removewindow, go, !.

do('3') :-

makewindow(4,18,1," ",5,25,10,30),

framewindow(19),

write(" ?"), nl,

nl, write(" 1 :- bd"),

nl, write(" 2 :- b1"),

nl, write(" 3 :- b2"),

nl, write(" 4 :- "), nl,

nl, write(" ------| |------"),

cursor(7,13), readchar(X), see(X),

removewindow, go, !.

do('4') :-

makewindow(4,18,1," ",5,25,9,30),

framewindow(19),

write(" : "), nl,

nl, write(" 1 :- "),

nl, write(" 2 :- "),

nl, write(" 3 :- "), nl,

nl, write(" ------| |------"),

cursor(6,13), readchar(X), correct(X),

removewindow, go, !.

do('5') :-

makewindow(4,18,1," ",5,25,10,30),

framewindow(19),

write(" :"), nl,

nl, write(" 1 :- "),

nl, write(" 2 :- "),

nl, write(" 3 :- "),

nl, write(" 4 :- "), nl,

nl, write(" ------| |------"),

cursor(7,13), readchar(X), del(X),

removewindow, go, !.

do('6') :-

makewindow(4,18,1," ",5,25,9,30),

framewindow(19),

write(" ?"), nl,

nl, write(" 1 :- B1"),

nl, write(" 2 :- B2"),

nl, write(" 3 :- "), nl,

nl, write(" ------| |------"),

cursor(6,13), readchar(X), indication(X),

removewindow, go, !.

do('7') :-

makewindow(4,18,1," ",7,10,13,60),

framewindow(19), adding,

removewindow, go, !.

do('8') :-

makewindow(4,95,1,"",10,29,5,22), nl,

framewindow(94),

write(" ? (Yes/No)"), readchar(X),

X='y', exit;

removewindow, go, !.

do(_) :-

makewindow(4,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, go.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

open('1') :-

makewindow(5,95,1," bd",7,20,10,40),

framewindow(94), nl,

write(" : "), readln(FN),

exists(FN), consult(FN, bd),

nl, write(" "), readchar(_), removewindow, !.

open('2') :-

makewindow(5,95,1," b1",7,20,10,40),

framewindow(94), nl,

write(" : "), readln(FN),

exists(FN), consult(FN, b1),

nl, write(" "), readchar(_), removewindow, !.

open('3') :-

makewindow(5,95,1," b2",7,20,10,40),

framewindow(94), nl,

write(" : "), readln(FN),

exists(FN), consult(FN, b2),

nl, write(" "), readchar(_), removewindow, !.

open('4') :-

!.

open(_) :-

makewindow(5,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, do('1').

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

store('1') :-

makewindow(5,95,1," bd",7,20,10,40),

framewindow(94), nl,

write(" : "), readln(FN), save(FN, bd),

nl, write(" "), readchar(_), removewindow, !.

store('2') :-

makewindow(5,95,1," b1",7,20,10,40),

framewindow(94), nl,

write(" : "),

readln(FN), save(FN, b1),

nl, write(" "), readchar(_), removewindow, !.

store('3') :-

makewindow(5,95,1," b2",7,20,10,40),

framewindow(94), nl,

write(" : "),

readln(FN), save(FN, b2),

nl, write(" "), readchar(_), removewindow, !.

store('4') :-

!.

store(_) :-

makewindow(5,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, do('2').

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

see('1') :-

makewindow(5,95,1," bd ",7,10,9,60),

framewindow(94), nl,

characteristick(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

show(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

nl,nl,write(" ENTER ..."),

readchar(_), nl, fail.

see('1') :-

removewindow, removewindow, do('3'), !.

see('2') :-

makewindow(5,95,1," b1 ",7,10,9,60),

framewindow(94), nl,

table1(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

show(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

nl,nl,write(" ENTER ..."),

readchar(_), nl, fail.

see('2') :-

removewindow, removewindow, do('3'), !.

see('3') :-

makewindow(5,95,1," b2 ",7,10,9,60),

framewindow(94), nl,

table2(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

show(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

nl,nl,write(" ENTER ..."),

readchar(_), nl, fail.

see('3') :-

removewindow, removewindow, do('3'), !.

see('4') :-

!.

see(_) :-

makewindow(5,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, do('3').

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

correct('1') :-

makewindow(5,95,1," , ",7,10,13,60),

framewindow(94),

write(" : "), readint(X),

characteristick(X,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

nl, write(" :"), nl, nl,

show(X,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)), nl, nl,

write(" :"), nl, nl,

get(ArtD,place(NCD,NSD),NameD,price(RubD,KopD),date(YearD,MonD,DayD)), nl,

clearwindow,

retract(characteristick(X,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day))),

assert(characteristick(ArtD,place(NCD,NSD),NameD,price(RubD,KopD),date(YearD,MonD,DayD))),

removewindow, removewindow, do('4'), !.

correct('1') :-

removewindow, removewindow, do('4'), !.

correct('2') :-

makewindow(5,95,1," , ",7,10,13,60),

framewindow(94),

write(": "), readln(X),

characteristick(Art,place(NC,NS),X,price(Rub,Kop),date(Year,Mon,Day)),

nl, write(" :"), nl, nl,

show(Art,place(NC,NS),X,price(Rub,Kop),date(Year,Mon,Day)), nl, nl,

write(" :"), nl, nl,

get(ArtD,place(NCD,NSD),NameD,price(RubD,KopD),date(YearD,MonD,DayD)), nl,

clearwindow,

retract(characteristick(Art,place(NC,NS),X,price(Rub,Kop),date(Year,Mon,Day))),

assert(characteristick(ArtD,place(NCD,NSD),NameD,price(RubD,KopD),date(YearD,MonD,DayD))),

removewindow, removewindow, do('4'), !.

correct('2') :-

removewindow, removewindow, do('4'), !.

correct('3') :-

!.

correct(_) :-

makewindow(5,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, do('4').

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

del('1') :-

makewindow(5,95,1," ",7,20,10,40),

framewindow(94),

write(" : "), readint(X),

retract(characteristick(X,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day))), nl,

write(" ."), readchar(_),

removewindow,removewindow, do('5'), !.

del('1') :-

makewindow(6,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" ."), readchar(_),

removewindow, removewindow, removewindow, do('5').

del('2') :-

makewindow(5,95,1," ",7,20,10,40),

framewindow(94),

write(" : "), readln(X),

retract(characteristick(Art,place(NC,NS),X,price(Rub,Kop),date(Year,Mon,Day))), nl,

write(" ."), readchar(_),

removewindow,removewindow, do('5'), !.

del('2') :-

makewindow(6,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" ."), readchar(_),

removewindow, removewindow, removewindow, do('5').

del('3') :-

makewindow(5,95,1," ",7,20,10,40),

framewindow(94),

retract(characteristick(_,place(_,_),_,price(_,_),date(_,_,_))),

fail.

del('3') :-

write(" ."), readchar(_),

removewindow,removewindow, do('5'), !.

del('4') :-

!.

del('_') :-

makewindow(5,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, do('5').

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

indication('1') :-

makewindow(5,18,1," B1 ",8,25,10,30),

framewindow(19),

write(" :"), nl,

nl, write(" 1 :- "),

nl, write(" 2 :- "),

nl, write(" 3 :- "),

nl, write(" 4 :- "), nl,

nl, write(" ------| |------"),

cursor(7,13), readchar(X), indicationB1(X),

removewindow, removewindow, do('6'), !.

indication('2') :-

makewindow(5,18,1," B2 ",8,25,10,30),

framewindow(19),

write(" :"), nl,

nl, write(" 1 :- "),

nl, write(" 2 :- "),

nl, write(" 3 :- "),

nl, write(" 4 :- "), nl,

nl, write(" ------| |------"),

cursor(7,13), readchar(X), indicationB2(X),

removewindow, removewindow, do('6'), !.

indication('3') :-

!.

indication(_) :-

makewindow(5,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, do('6').

indicationB1('1') :-

makewindow(6,95,1," B1 ",7,20,10,40),

framewindow(94), nl,

write(" : "), readint(X),

write(" : "), readint(Y),

characteristick(Art,place(X,Y),Name,price(Rub,Kop),date(Year,Mon,Day)),

assert(table1(Art,place(X,Y),Name,price(Rub,Kop),date(Year,Mon,Day))),

fail.

indicationB1('1') :-

removewindow, removewindow, indication('1').

indicationB1('2') :-

makewindow(6,95,1," B1 ",7,20,10,40),

framewindow(94), nl,

write(" : "), readint(X),

write(" : "), readint(Y),

characteristick(Art,place(NC,NS),Name,price(X,Y),date(Year,Mon,Day)),

assert(table1(Art,place(NC,NS),Name,price(X,Y),date(Year,Mon,Day))),

fail.

indicationB1('2') :-

removewindow, removewindow, indication('1').

indicationB1('3') :-

makewindow(6,95,1," B1 ",7,20,10,40),

framewindow(94), nl,

write(" : "), readint(X),

write(" : "), readint(Y),

write(" : "), readint(Z),

characteristick(Art,place(NC,NS),Name,price(Rub,Kop),date(X,Y,Z)),

assert(table1(Art,place(NC,NS),Name,price(Rub,Kop),date(X,Y,Z))),

fail.

indicationB1('3') :-

removewindow, removewindow, indication('1').

indicationB1('4') :-

!.

indicationB1(_) :-

makewindow(6,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, indication('1').

indicationB2('1') :-

makewindow(6,95,1," B2 ",7,20,10,40),

framewindow(94), nl,

write(" : "), readint(X),

write(" : "), readint(Y),

characteristick(Art,place(X,Y),Name,price(Rub,Kop),date(Year,Mon,Day)),

assert(table2(Art,place(X,Y),Name,price(Rub,Kop),date(Year,Mon,Day))),

fail.

indicationB2('1') :-

removewindow, removewindow, indication('2').

indicationB2('2') :-

makewindow(6,95,1," B2 ",7,20,10,40),

framewindow(94), nl,

write(" : "), readint(X),

write(" : "), readint(Y),

characteristick(Art,place(NC,NS),Name,price(X,Y),date(Year,Mon,Day)),

assert(table2(Art,place(NC,NS),Name,price(X,Y),date(Year,Mon,Day))),

fail.

indicationB2('2') :-

removewindow, removewindow, indication('2').

indicationB2('3') :-

makewindow(6,95,1," B2 ",7,20,10,40),

framewindow(94), nl,

write(" : "), readint(X),

write(" : "), readint(Y),

write(" : "), readint(Z),

characteristick(Art,place(NC,NS),Name,price(Rub,Kop),date(X,Y,Z)),

assert(table2(Art,place(NC,NS),Name,price(Rub,Kop),date(X,Y,Z))),

fail.

indicationB2('3') :-

removewindow, removewindow, indication('2').

indicationB2('4') :-

!.

indicationB2(_) :-

makewindow(6,76,1,"",8,29,5,22),

framewindow(75), nl,

write(" "), readchar(_),

removewindow, removewindow, indication('2').

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

adding :-

get(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)),

nl, write(" :"),

nl, show(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)), nl,

nl, write(" ? (Yes/No)"), readchar(A),

A='y',

assert(characteristick(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)));

!.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

exists(FN) :-

existfile(FN);

makewindow(6,76,1,"",10,25,5,30), nl,

framewindow(75),

write(" ",FN," !"),

readchar(_), removewindow,

removewindow, removewindow, do('1').

show(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)) :-

write(" 렠 : ",Art),

nl, write(" (, ) : ",NC,", ",NS),

nl, write(" ࠠ : ",Name),

nl, write(" (:) : ",Rub,":",Kop),

nl, write(" (--) : ",Year,"-",Mon,"-",Day).

get(Art,place(NC,NS),Name,price(Rub,Kop),date(Year,Mon,Day)) :-

write(" 렠 : "), readint(Art),

write(" 堠 : "), nl,

write(" : "), readint(NC),

write(" 䠠 : "), readint(NS),

write(" ࠠ : "), readln(Name),

write(" : "), nl,

write(" 頠 : "), readint(Rub),

write(" ꠠ : "), readint(Kop),

write(" : "), nl,

write(" 䠠 : "), readint(Year),

write(" : "), readint(Mon),

write(" : "), readint(Day).

7.    .
.
+-------------- --------------+

:

1 :-+--------- --------+

2 :- ?

+-------------- bd-------------+

: data

+-- --+

+--------------------------------------+
.
+-------------- --------------+

:

1 :-+--------- --------+

2 :- ?

+------------- b2------------+

: data2

+-- --+

+--------------------------------------+
.
+-------------- --------------+

:

1 :-+-------- -------+

2 :- ?

+----------------------- bd ----------------------+

렠 : 2

(, ) : 6, 7

ࠠ : Vint

(:) : 0:65

(--) : 1996-2-45

ENTER ...

+----------------------------------------------------------+
.
+-------------- --------------+

:

1 :-+------- ------+

2 :- :

+------- , ------+

:

렠 : 1

(, ) : 5, 6

ࠠ : Gayka

(:) : 0:45

(--) : 1996-1-4

:

렠 :

+----------------------------------------------------------+
.
+-------------- --------------+

:

1 :-+ +

2 :- :

+-------- --------+

: 1

.

+-- --+

+--------------------------------------+
.
+-------------- --------------+

:

1 :-+- -+

2 :- ?

+------ B1 ------+

: 0

: 45

+-- --+

+--------------------------------------+

+----------------------------+
.
+-------------- --------------+

:

1 :-

2 :-

+------------- -------------+

堠 :

: 5

䠠 : 6

ࠠ : Shayba

:

頠 : 1

ꠠ : 2

:

䠠 : 1996

: 23

: 3

+----------------------------------------------------------+


8.    .
, (7.).
. , - , , , ( , CAPSLOCK). (Yes/No - /) - .

9.    .
- , , .

10. .
1. . . Micro Prologe.
2. . . .


Copyright © 2005—2007 «RefStore.Ru»