.


:




:

































 

 

 

 


Albatross





isa


Colour

Brown

\ ^^ movingmethod


 


;olour /

Black and white


Albert


\ isa

\

Ross


is a \

\act

ActrVe_at night

<^


Walk


, 15.5.

, ( "isa") ( ), ( ).

, , Prolog, , :

isa(bird, animal). % -

isa (ross, albatross). % -

raoving_method(bird, fly). % -

moving_method< kiwi, walk). % -

, .


15.



. . , . 15.5, , " ", " ". " " " ". isa. Prolog , : moving_method (X, Method):-

isa [ X, superx), % isa

moving_irieth0d{ SuperX, Method). , . , : " , ":

(act (Fact):- i - ; Fact = Rel (Argl, 2) Fact,!. % -

fact (Fact):-

Fact =.. [ Rel, Argl, Arg2J,

isa arclt Su.erArgl, S isa

SucpterF S a uperFact) Re1' *"***", "**'

, , :

7- fact) moving method[ kim, Method)). Method = walk ~

, , . , :

?- fact (moving method (albert, Method)). Method - fly -

bird. , , isa.

. "" , . , . , , , , .

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

, , :



II. Prolog


FRA ME: bird

a_kind_of: animal

moving_methcd: fly

|

active_at: daylight . , (a_kir.d_of) ( ), (moving ir.ethod) (activeat) . .

FRAME; albatross a_kind_of: bird colour: black and_white size: 115

FRAME kiwi a kind of: bird movingjriethod: walk active at: night colour: brown size: 40

, . albatross moving method active at. , , movingjuethod active_at, . , , :

FRAME Albert instance of: albatross size: 120"

, a_kind_of instance_of. , .

, , Prolog , , . . : Frame_name(Slot, Value]

. , . 15.10 .

15.10.

% Prolog:
% frame name (Slot, Value)

"Value - ,

% bird -

bird) a kind_of, animal). bird(moving_method, fly). bird{ active_at, daylight).

% albatross; - , % : - 115

albatross a_kind_of, bird).

15, 351


 


albatross { colour, black_and_white). albatross; size, 115).

% kiwi; - , , % ,

kiwi[ a_kind_of, bird). kiwi [ moving_method, walk). kiwi(active_at, night). kiwi(size, 40). kiwi (colour, bron).

% albert -

albert(instance_of, albatross). albert(size, 120).

% ross - -

ross(instance of, albatross). rossi size, 40").

% animal - relative size i relative_size

animal (relative size, execute (relative size(Object, Value), object, Value)).

, . Prolog :

value(Frame, Slot, Value)

Value - Slot Frame. ( ), ; , . , a kind of instance of . " ", . Prolog- :

value { Frame, Slot, Value):-

Query =.. [ Frame, Slot, Value],

call Query),!. %

value) Frame, Slot, Value):-

parent { Frame, Parent Frame), %

value (ParentFrame, Slot, Value).

parent(Frame, ParentFrame):-

(Query =.. { Frame, a_kind_of, Parent Frame]

Query =.. [ Frame, instance_of, ParentFrame]), call £ Query).

, 15.10, , :

?- valuet albert, active_at, AlbertTime). AlbertTime = daylight

?- valuet kiwi, active_at, KiwiTirae). KiwiTime = night

352 li. Prolog


, . , , . , 15.10, , : - 104%, - 35%. ( ) . , :

40/115 * 100% = 34.78%

, relativesize . , relative_size animal . value :

?- value(ross, relative_size, R}. R = 34.78

. ross , relative size, instance_of ( albatross), a_knd_of ( bird), a_M.nd._of, , , animal. . size ross albatross. value. value, , . , , () , , Prolog :

relativesize c Object, RelativeSize):-

value (ObjClass, size, ClassSize),

RelativeSize is objSize/ClassSize * 100. %

relative_size animal . Object () RelativeSize ( ) , relative size. Prolog, , . execute! relative_size (Object, RelSize), Object, RelSize}

relative_size animal : animal! relative_size, execute! relative_size£ Obj, Val), Obj, Val)).

value . , , , , . . value . . :

value! Frame, Slot, Value):-

value{ Frame, Frame, Slot, Value).


15.



% () value) frame, SuperFrame, Slot, Value);-

Query-.. [ SuperFrame, Slot, Information],

call* Query!, % ,

process< information, Frame, Value),!. %

% , % value) Frame, SuperFrame, Slot, Value):-

paren tt SuperFrame, FarentSuperFrame),

value! Frame, FarentSuperFrame, Slot, Value). % process) Information, Frame, Value)

process! execute! Goal, Frame, Value), Frame, Value):!,

call (Goal). process! Value, _, Value). ,

, , - . , , .

, , , . . , "" ( instance_of a_kind_of). , , . value , , , , . .





:


: 2015-10-01; !; : 549 |


:

:

,
==> ...

795 - | 791 -


© 2015-2024 lektsii.org - -

: 0.023 .