MFRL/PC (Frame Representation Language with Matching for PC)

From Bauman National Library
This page was last modified on 1 June 2016, at 17:05.
MFRL/PC (Frame Representation Language with Matching for PC)
Paradigm multi-paradigm: Reflective-oriented, imperative, scripting , Functional
Designed by Moscow Power Engineering Institute
First appeared 1993
Typing discipline dynamic, implicit, Weak
License LGPL
Website None
Influenced by
Frame Representation Language, LISP

Language MFRL / PC (Frame Representation Language with Matching for PC) is designed based on the language FRL (FRL - Frame Representation Language, Roberts & Goldstein, MIT 1977) in the MEI at the Department of Applied Mathematics in the group system programming led Semenova E.T.

A frame language is a technology used for knowledge representation in artificial intelligence. Frames are stored as ontologies of sets and subsets of the frame concepts. They are similar to class hierarchies in object-oriented languages although their fundamental design goals are different. Frames are focused on explicit and intuitive representation of knowledge where as objects focus on encapsulation and information hiding. Frames originated in AI research and objects primarily in software engineering. However, in practice the techniques and capabilities of frame and object-oriented languages overlap significantly.

Frame

A frame is a data-structure for representing a stereotyped situation, like being in a certain kind of living room, or going to a child's birthday party. Attached to each frame are several kinds of information. Some of this information is about how to use the frame. Some is about what one can expect to happen next. Some is about what to do if these expectations are not confirmed.

We can think of a frame as a network of nodes and relations. The "top levels" of a frame are fixed, and represent things that are always true about the supposed situation. The lower levels have many terminals–"slots" that must be filled by specific instances or data. Collections of related frames are linked together into frame-systems. The effects of important actions are mirrored by transformations between the frames of a system. The syntax of the frame in the extended Backus-Naur notation (metacharacters: ":: =" "<" ">" "|" "{" "}" "[" "]") is as follows:

     <frame> :: = (<frame name> {<slot>})
     <frame name> :: = <atom>
     <slot> :: = (<slot name> {<dimension>})
     <slot name> :: = <ratio> | <property> | SELF
     <ratio> :: = <atom>
     <property> :: = <atom>
     <aspect> :: = (<dimension name> {<this>})
     <aspect name> :: = <atom>
     <this> :: = (<given name> {<comment>}) | <functor>
     <functor> :: = OR | ALT | NOT | IF | THEN | ELSE | FI
     <name of> :: = <value>
     <value> :: = <atom> | <d-couple> |
                    <name LISP- or LSF function> |
                    <call LISP- or LSF function> |
                    <frame name> | <frame>
     <comment> :: = (<name comment> {<message>})
     <Name Comment> :: = <label>
     <label> :: = <atom>
     <message> :: = <s-expression>

Data Types MFRL / PC.

In MFRL / PC, there are three types of values (data): indirect, direct and calculable.

Indirect value.

Indirect data has comment (STATUS: INDIRECT) and may also contain comments tagged SLOT: and FACET. Example. Suppose there are frames F1 and F2:

 F1: (F1 ... (S ... (A (F2 (STATUS: INDIRECT) (SLOT: Q)))
                                ...) ...)
 F2: (F2 ... (... S (A (V1))
             (Q ... (A (V2)) ...)

Then, in response to a request data from aspect A of the slot S frame F1 will be given the value of V2, because F2 is an indirect value.

Calculable value.

Calculable data is contained in the aspects $ IF-ADDED, $ IF-REMOVED, $ IF-NEEDED, $ IF-INSTANTIATED, $ REQUIRE, $ IF-GET, $ IF-PUT, $ IF-REM and has no comment (STATUS: NOEVAL) or in the aspects $ VALUE, $ DEFAULT and has commentary (STATUS: EVAL). Example. Suppose there is a frame F

  F: (F ... (S ... ($ VALUE (LIST (STATUS: EVAL)
                                 (PARMQ: A B C)))
                    ...) ...)

Then, in response to a request for data from $ VALUE aspect slot S frame F will not be issued value with the name LIST, and given data with the name (A B C), i.e. with the name obtained as a result of evaluating function LIST arguments A, B and C. The same thing happens in the case when the frame F has the form

 F: (F ... (S ... ($ VALUE ((LIST 'A' B 'C) (STATUS: EVAL)))
                            ...) ...)

Direct value.

All other data are straight. These frames are retrieved from the network without any additional processing.

Types of comments

The FRL has several types of comments:

  • Comment tagged STATUS: is used to indicate the method of processing data during the extraction. Possible messages for this commentary are EVAL, NOEVAL and INDIRECT;
  • Comments tagged SLOT: and FACET: used to specify the referent of the indirect data. They are used together with a commentary (STATUS: INDIRECT);
  • Comments tagged PARM: and PARMQ: used when specifying the arguments to the attached procedures;
  • Comment Tagged FINHERIT: used for local management of inheritance. If the message has CONTINUE, it inherits the slot containing its data from its AKO-prototypes even if he contains the desired data. STOP message prohibits inheritance of the data sought in the containing slot;
  • Comment (TYPE: <type>) enables selective procedure call functions FPROC, FNEED and FEXEC;
  • Comment labeled IN: is inserted into the data by system as soon as data is extracted, for identifying the frame and slot dimensions, from which data were extracted.

Trace

The FRL is possible to trace, ie perform certain user programs, when you make changes in any frame, slot, aspect, comment and a message. For this purpose, system has special means through which the impact of the user to work FRLpocessor. These tools include procedure FTRACE. With FTRACE user can connect to a system of procedures (referred to as tracer) that govern launch of attached procedures. Tracer procedures may be attached to any frame with a predetermined structure. To connect these procedures to the FRL-processor must perform function: (FTRACE <name-frame> <list-pairs>), where <frame> - name of the frame containing the tracer procedure and <list-pairs> - list of species ((<meta name-substructure> <condition> ...).

<Meta name-substructure> - this is FRAME, SLOT, VALUE, LABEL or MESSAGE.

<Condition> is one of the following atoms: IF-ADDED, IF-REMOVED, IF-GETED, which is interpreted as follows:

  • IF-ADDED - tracer procedures are launched when you add in structure to the corresponding meta name;
  • IF-REMOVED - tracer procedures run when removing from the system structure with the corresponding meta name;
  • IF-GETED - tracer procedures are launched when removed from the network structure with the corresponding meta name.

You can use this treatment: (TRACE <frame name>). In this case, the tracer will announced all procedures from the frame <frame name>.

To disable tracing, use function FUNTRACE. Syntax: (FUNTRACE). Example of FTRACE structure:

  (<frame name>
     (FRAME ($ IF-ADDEED <procedures to
                           entering of a new frame system>)
            ($ IF-REMOVED <procedures to removal
                         frame from the system>)
            ($ IF-GETED <procedures to extract information 
                          from frame>)
     )
     (SLOT ($ IF-ADDED <procedures performed when
                       a new slot is writing in any frame>)
           ($ IF-REMOVED <procedures to removal
                         slots of any frame>)
           ($ IF-GETED <procedures to extract information from
                       slot>)
     )
     (FACET ($ IF-ADDED <procedures performed when entering
                        a new aspect in any slot>)
            ($ IF-REMOVED <procedures to removal
                          aspects of any slot>)
            ($ IF-GETED <procedure retrieves the value of the
                        dimensions>)
     )
     (VALUE ($ IF-ADDED <procedures performed when entering
                        new value in any dimension>)
            ($ IF-REMOVED <procedures to removal
                           the value of any aspect>)
            ($ IF-GETED <procedure retrieves commentary the value>)
     )
     (LABEL ($ IF-ADEED <procedures performed when entering
                     new comments at any given>)
            ($ IF-REMOVED <procedures to removal
                          comments from any of the>)
            ($ IF-GETED <procedure that extract a comment from
                        any data>)
     )
     (MESSAGE ($ IF-ADDED <procedures to
                          entering of a new message in some
                          Comment>)
              ($ IF-REMOVED <procedures to
                            delete a message from any
                            comment>)
     )
   )


Note: All components of such frame structure are optional.

A brief description of the functions of language MFRL / PC

Symbols for functions MFRL / PC

In the tables below, we use the following notation for the function arguments in the language MFRL / PC:

  • f - name of the frame;
  • fs - frame structure;
  • s - name of the slot;
  • ss - slot;
  • a - aspectname;
  • as - aspect;
  • v - dataname;
  • vs - data;
  • l - commentname (labelname);
  • ls ​​- comment;
  • m - name of the message;
  • ms - message;
  • pnl - procedure name list
  • fnl - frame name list
  • fvl - fame value list
  • fn - function name

Note: Optional arguments LSF functions follow the mandatory in this specification are separated by a colon. Alternative arguments enclosed in braces.

Constants MFRL / PC

Syntax Semantics
* AKO-INSTANCE * The list of properties to store the names of the inverse relationship (CDR '* AKO-INSTANCE *) => ((AKO. INSTANCE) (INSTANCE. AKO))
AKO AKO
INSTANCE INSTANCE
$ VALUE $ VALUE
$ DEFAULT $ DEFAULT
$ IF-NEEDED $ IF-NEEDED
$ IF-REMOVED $ IF-REMOVED
$ IF-ADDED $ IF-ADDED
$ IF-INSTANTIATED $ IF-INSTANTIATED
$ REQUIRE $ REQUIRE
$ IF-GETED $ IF-GETED
$ IF-ADD $ IF-ADD
$ IF-REM $ IF-REM
$ IF-GET $ IF GET-

Stacks MFRL / PC

Stackname Appointment Used by function
* FRAMES * (list of properties) It contains names of active frames DEFRAME, FRESET, FPRINT, FASSERT, FSAVE, DEFRAMEQ, FASSERTQ, FDESTROY
* PROCEDURES * (list of properties) It contains names of the active treatments PASSERT, PRESET, PSAVE, PASSERTQ
* FGENAMELIST * (variable) It contains information to generate unique names of frames (implemented as a list of properties) FGENAME, FGETNAME

Global variables MFRL / PC

Syntax Semantics
* IFRAME * Body of the frame immediately after the FRAME? or FNAME?
* FNAME * Name the frame immediately after the FRAME? or FNAME?
* DESCR * Body of the descriptor immediately after DNAME?
* DNAME * Name tag immediately after DNAME?
* MATCHED * List of comparable objects after FMATCH?
* UNMATCHED * List of non-comparable objects after FMATCH?

Changing frames and procedures network

Syntax Semantics
(ASSERT fn bd) Determined or overridden procedure named fn with body bd. Procedure name is entered in the stack * PROCEDURES *. The result - name of the procedure.
(PASSERTQ fn bd) Same as PASSERT, but arguments are not evaluated.
(DEFRAME f: ss1 ... ssn) Create new frame containing the specified slot. The result - name of the created frame. Attached procedures are not activated.
(DEFRAMEQ f: ss1 ... ssn) The analogue DEFRAME, but arguments are not evaluated.
(FASSERT f: ss1 ... ssn) Create new or update an old frame. The result - name of the frame. Attached procedures are performed.
(FASSERTQ f: ss1 ... ssn) The analogue FASSERTQ, but arguments are not evaluated.
(FRENAME f1: f2) Frame named f1 is renamed into the frame named f2. The result - new name.
(FNAME {f fs}) The result - name of the frame. If a frame is not found - it is created.
(FRAME {f fs}) The result - pointer to the frame structure. If the frame is not found - it is created
(FPUT- f: s a v l m) It added slot s, aspect a, data v, label l, comment m to frame f. If any of the structures: f, s, a, v, l, m have already existed, it is added new information, or the structure remains unchanged. If at completion FPUT some of the structures: f, s, a, v, l, m not existed - it is created. Attached procedures are not performed
(FPUT-STRUCTURE- f) (FPUT-STRUCTURE- f ss) (FPUT-STRUCTURE- fs as) (FPUT-STRUCTURE- fsa vs) (FPUT-STRUCTURE- fsav ls) (FPUT-STRUCTURE- fsavl ms) The same as in FPUT-, but the last argument is interpreted as a treatment to prepare appropriate structure that is added to the entire frame
(FPUT f: s a v l m) It added slot s, aspect a, data v, label l, comment m to frame f. If any of the structures: f, s, a, v, l, m have already existed, it is added new information, or the structure remains unchanged. If at completion FPUT some of the structures: f, s, a, v, l, m not existed - it is created. Attached procedures are performed
(FPUTV f s v) = (FPUT f s $ VALUE v)
(FPUT-STRUCTURE f) (FPUT-STRUCTURE f ss) (FPUT-STRUCTURE fs as) (FPUT-STRUCTURE fsa vs) (FPUT-STRUCTURE fsav ls) (FPUT-STRUCTURE fsavl ms) The same as in FPUT, but the last argument is interpreted as a treatment to prepare appropriate structure that is added to the entire frame
(FPUT-STRUC f sb) = (FPUT-STRUCTURE f sb)
(FPUT-STRUC f s ab) = (FPUT-STRUCTURE f s ab)
(FPUT-STRUC f s a d) = (FPUT-STRUCTURE f s a d)
(FPUT-STRUC f s a v c) = (FPUT-STRUCTURE f s a v c)
(FPUT-STRUC f s a v l m) = (FPUT-STRUCTURE f s a v l m)
(FDELETE f: s a v l m) Same as FREMOVE, but attached procedures are not activated, and the result - pointer to the modified frame substructure.
(FDEL-STRUCTURE f) (FDEL-STRUCTURE f ss) (FDEL-STRUCTURE fs as) (FDEL-STRUCTURE fsa vs) (FDEL-STRUCTURE fsav ls) (FDEL-STRUCTURE fsavl ms) Removes substructure of frame f, which localized by other arguments. The result - change substructure or NIL, if the removal has taken place. Attached procedures are not followed. Number of arguments - from 1 to 6
(FREMOVE f: s a v l m) It removes frame substructure, which localized by other arguments. Last argument specifies the name of deleting substructure. Number of arguments - from 1 to 6. The result - last argument in the appeal. Attached procedures are performed.
(FREM-STRUCTURE f) (FREM-STRUCTURE f ss) (FREM-STRUCTURE fs as) (FREM-STRUCTURE fsa vs) (FREM-STRUCTURE fsav ls) (FREM-STRUCTURE fsavl ms) Same as FDEL-STRUCTURE, with the difference that the associated procedures are performed
(FREM-STRUC f s a v l m) = (FREM-STRUCTURE f s a v l m)
(FREP-STRUCTURE f) (FREP-STRUCTURE f ss) (FREP-STRUCTURE fs as) (FREP-STRUCTURE fsa vs) (FREP-STRUCTURE fsav ls) (FREP-STRUCTURE fsavl ms) The last argument is interpreted as a treatment structure of appropriate level. It completely replaces the corresponding frame in the input structure. The result - change substructure. Number of arguments - from 1 to 5. Attached procedures are performed.
(FREP-STRUCTURE- f) (FREP-STRUCTURE- f ss) (FREP-STRUCTURE- fs as) (FREP-STRUCTURE- fsa vs) (FREP-STRUCTURE- fsav ls) (FREP-STRUCTURE- fsavl ms) The last argument is interpreted as a treatment structure of appropriate level. It completely replaces the corresponding frame in the input structure. The result - change substructure. Number of arguments - from 1 to 5. Attached procedures are not performed.
(FREP-STRUC f s a v l m) = (FREP-STRUCTURE f s a v l m)
(FINSTANTIATE f1: f2) It creates an instance of the frame named f1 f2. If f2 is omitted, creates a frame with the system name. Created instance is include value produced by procedures attached to the aspects of the $ IF-INSTANTIATED each slot of the frame f. The result - the name of the created frame.
(FCLEAN f s: a) It removes the frame f slot s aspect a all data that do not satisfy the procedures inherited from the aspect of $ REQUIRE. If a dimension is omitted, then a = $ VALUE. Returns a list of deleted data.
(FINSTANCE f sb *) It creates an instance of the frame f with slots s1 s2 ... sN.
(FREVADD s) Creates backlink to s of the frame: VALUE per frame: FRAME (in the aspect: FACET).
(FREVREM s) Removes backlink to s of the frame: VALUE per frame: FRAME (in the aspect: FACET).
(FORWADD s) Creates directlink s of the frame: VALUE per frame: FRAME (in the aspect: FACET).
(FORWREM s) Removes directlink s of the frame: VALUE per frame: FRAME (in the aspect: FACET).
(PRESET: pnl) These procedures removed from the system. The result is a list of the names of the remote procedure. If pnl handling is omitted, it is considered that pnl = * PROCEDURES *.
(FRESET: fnl) These frames are overwritten in memory. Attached procedures are not followed. The result - list of the names of jammed frames. If fnl handling is omitted, it is considered that fnl = * FRAMES *.
(DEDESCR q sb *) Creates a new handle with slots s1 ... sN.
(DINSTANCE q sb *) Creates a copy of the descriptor with slots s1 ... sN.

References

  1. Frame language
  2. A Framework for Representing Knowledge, Marvin Minsky, MIT-AI Laboratory Memo 306, June, 1974.
  3. Guidelines for the course "Introduction to Programming" languages and knowledge representation systems (programming language LSF) Baydun VV, Bunin AI Chernov PL ── M .: Mosс. MPEI, 1993. ── 44.

The article is written by Zheludkov A.V.