Grammar Specs
(→Transformation rules) |
(→Types of rules) |
||
Line 204: | Line 204: | ||
== Types of rules == | == Types of rules == | ||
− | In the UNL Grammar there are | + | In the UNL Grammar there are three basic types of rules: |
− | + | === Normalization Rules === | |
− | + | (main article: [[N-Rules]] | |
− | + | Used to normalize the natural language input and to segment natural language texts into sentences. | |
− | + | ||
− | + | === Transformation rules === | |
− | + | (main article: [[T-Rules]] | |
+ | Used to generate natural language sentences out of UNL graphs and vice-versa. | ||
+ | |||
+ | == Disambiguation rules === | ||
+ | (main article: [[D-rules]] | ||
+ | Used to improve the performance of transformation rules by constraining their applicability. | ||
The Segmentation Rules and Transformation Rules follow the very general formalism | The Segmentation Rules and Transformation Rules follow the very general formalism |
Revision as of 15:56, 31 May 2013
UNL grammars are sets of rules for translating UNL expressions into natural language (NL) sentences and NL sentences into UNL expressions. They are normally unidirectional, i.e., the UNL-ization grammar (NL-to-UNL) is different from the NL-ization grammar (UNL-to-NL), even though they share the same basic syntax.
Contents |
Basic symbols
Symbol | Definition | Example |
---|---|---|
^ | not | ^a = not a |
{ | } | or | {a|b} = a or b |
% | index for nodes, attributes and values | %x (see below) |
# | index for sub-NLWs | #01 (see below) |
= | attribute-value assignment | POS=NOU |
! | rule trigger | !PLR |
& | merge operator | %x&%y |
? | dictionary lookup operator | ?[a] |
“ “ | string | "went" |
[ ] | natural language entry (headword) | [go] |
[[ ]] | UW | [[to go(icl>to move)]] |
( ) | node | (a) |
// | regular expression | /a{2,3}/ = aa,aaa |
- The differences between "", [] and [[]]
- Double quotes are always used to represent strings: "a" will match only the string "a"
- Simple square brackets are always used to represent natural language entries (headwords) in the dictionary: [a] will match the node associated to the entry [a] retrieved from the dictionary, no matter its current realization, which may be affected by other rules (the original [a] may have been replaced, for instance, by "b", but will still be indexed to the entry [a])
- Double square brackets are always used to represent UWs: [[a]] will match the node associated to the UW [[a]]
- Predefined values (assigned by default)
- SCOPE - Scope
- SHEAD - Sentence head (the beginning of a sentence)
- STAIL - Sentence tail (the end of a sentence)
- CHEAD - Scope head (the beginning of a scope)
- CTAIL - Scope tail (the end of a scope)
- TEMP - Temporary entry (entry not found in the dictionary)
- DIGIT - Any sequence of digits (i.e.: 0,1,2,3,4,5,6,7,8,9)
Basic concepts
Nodes
A node is the most elementary unit in the grammar. It is the result of the tokenization process, and corresponds to the notion of "lexical item", to be represented by dictionary entries. At the surface level, a natural language sentence is considered a list of nodes, and a UNL graph a set of relations between nodes. Any node is a vector (one-dimensional array) containing the following necessary elements:
- a string, to be represented between "quotes", which expresses the actual state of the node;
- a headword, to be represented between [square brackets], which expresses the original value of the node in the dictionary;
- a UW, to be represented between [[double square brackets]], which expresses the UW value of the node;
- a feature or set of features, which express the features of the node;
- an index, preceded by the symbol %, which is used to reference the node;
Examples of nodes are
- ("ing") (a node making reference only to its actual string value)
- ([book]) (a node making reference only to its headword,i.e., its original state in the dictionary)
- ([[book(icl>document)]]) (a node making reference only to its UW value)
- (NUM) (a node making reference only to one of its features)
- (POS=NOU) (a node making reference only to one of its features in the attribute-value pair format)
- (%x) (a node making reference only to its unique index)
- ("string",[headword],[[UW]],feature1,feature2,...,attribute1=value1,attribute2=value2,...,%x) (complete node)
Properties of nodes
- Nodes are enclosed between (parentheses)
- ("a") is a node
- "a" is not a note
- The elements of a node are separated by comma
- ("a",[a],[[a]],A,B,A=C,%a)
- The order of elements inside a node is not relevant.
- ("a",[a],[[a]],A,B,A=C,%a) is the same as ([[a]],B,A,"a",[a],A=C,%a)
- Nodes may have one single string, headword, UW and index, but may have as many features as necessary
("a","b")(a node may not contain more than one string)([a],[b])(a node may not contain more than one headword)([[a]],[[b]])(a node may not contain more than one UW)(%a,%b)(a node may not contain more than one index)- (A,B,C,D,...,Z) (a node may contain as many features as necessary)
- A node may be referred by any of its elements
- ("a") refers to all nodes where actual string = "a"
- ([a]) refers to all nodes where headword = [a]
- ([[a]]) refers to all nodes where UW = [[a]]
- (A) refers to all nodes having the feature A
- ("a",[a],[[a]],A) refers to all nodes having the feature A where string = "a" and headword = [a] and UW = [[a]]
- Nodes are automatically indexed according to a position-based system if no explicit index is provided (see Index)
- ("a")("b") is actually ("a",%01)("b",%02)
- Regular expressions may be used to make reference to any element of the node, except the index
- ("/a{2,3}/") refers to all nodes where string is a sequence of 2 to 3 characters "a"
- ([/a{2,3}/]) refers to all nodes where headword is a sequence of 2 to 3 characters "a"
- ([[/a{2,3}/]]) refers to all nodes where UW is a sequence of 2 to 3 characters "a"
- (/a{2,3}/) refers to all nodes having a feature that is a sequence of 2 to 3 characters "a"
- Nodes may contain disjoint features enclosed between {braces} and separated by comma
- ({A|B}) refers to all nodes having the feature A OR B
- Node features may be expressed as simple attributes, or attribute-value pairs
- (MCL) - feature as an attribute: refers to all nodes having the feature MCL
- (GEN=MCL) - feature as an attribute-value pair, which is the same as (GEN,MCL): refers to all nodes having the features GEN and MCL.
Attribute-value pairs may be used to create co-reference between different nodes (as in agreement):
- (%x,GEN)(%y,GEN=%x) - the value of the attribute GEN of the node %x is the same of the attribute GEN of the node %y (see Index)
Relations
In order to form a natural language sentence or a UNL graph, nodes are inter-related by relations. In the UNL framework, there can be three different types of relations:
- the linear relation L expresses the surface structure of natural language sentences
- syntactic relations express the deep (tree) structure of natural language sentences
- semantic relations express the structure of UNL graphs
Properties of relations
- The linear relation is always binary and is represented in two possible formats
- L(%x;%y), where L is the invariant name of the linear relation, and %x and %y are nodes; or
- (%x)(%y)
- Syntactic relations are not predefined, although we have been using a set of binary relations based on the X-bar theory.
- Semantic relations constitute a predefined and closed set that can be found here.
- Syntactic and semantic relations are represented in the same way
- rel(%x;%y), where "rel" is the name of the relation, %x is the source node, and %y is the target node
- Arguments of linear, syntactic and semantic relations are not commutative.
- The order of the elements in a relation affects the result:
- (%x)(%y) is different from (%y)(%x)
- relation(%x;%y) is different from relation(%y;%x)
- Linear and semantic relations are always binary; syntactic relations may be n-ary
- L(%x;%y) - linear relation
- agt(%x;%y) - semantic relation
- VH(%x) - unary syntactic relation
- VC(%x;%y) - binary syntactic relation
- XX(%x;%y;%z) - possible ternary syntactic relation
- Inside each relation, nodes are isolated by semicolon (;).
- VC(%x;%y)
VC(%x,%y)- Inside each relation, nodes may be referenced by any of its elements, isolated by comma (,)
- ("a")([b]) - linear relation between a node where string = "a" and another node where headword = [b]
- L([[c]];D) - linear relation between a node where UW = [[c]] and another node having the feature D
- VC(%a;%b) - syntactic relation between a node where index = %a and another node where index = %b
- agt("a",[a],[[a]],A;"b",[b],[[b]],B) - semantic relation between a node having the feature A where string = "a" AND headword "a" AND UW = [[a]] AND another node having the feature B where string = "b" AND headword = [b] AND UW = [[b]]
- Relations may be conjoined through juxtaposition
- ("a")("b")("c") - two linear relations: one between ("a") and ("b") AND other between ("b") and ("c")
- agt(%x;%y)obj(%x;%z) - two semantic relations: one between (%x) and (%y) AND other between (%x) and (%z)
VC([a];[b]),VC([a];[c])- conjoined relations must not be isolated by comma- Relations may be disjoined through {braces}
- {("a")|("b")}("c") - either ("a")("c") or ("b")("c")
- {agt(%x;%y)|exp(%x;%y)}obj(%x;%z) - either agt(%x;%y)obj(%x;%z) or exp(%x;%y)obj(%x;%z)
- Syntactic and semantic relations may be replaced by regular expressions
- /.{2,3}/(%x;%y) - any relation made of two or three characters between %x and %y
Hyper-nodes
Nodes may contain one or more relations. In this case, they are said to be "hyper-nodes", and represent scopes or sub-graphs. As any node, hyper-nodes contain a string, a headword, a UW, an index and features, of which the internal relations are a special type. Examples of hyper-nodes are the following:
- (("a")("b")) - a hyper-node containing a linear relation between the nodes ("a") and ("b")
- (VC(%x;%y)VA(%x;%z)) - a hyper-node containing two syntactic relations: VC(%x;%y)AND VA(%x;%z)
- (agt([a];[b])obj([a];[c])) - a hyper-node containing two semantic relations: agt([a];[b]) AND obj([a];[c])
- (([kick],V)([the],D)([bucket],N),V,NTST) - a hyper-node having the features N and NTST and containing two linear relations: one between the nodes ([kick],V) and ([the],D), and other between ([the],D) and [bucket],N)
- (([kick],V)([the],D)([bucket],N),"kick the bucket",[[die]],V,NTST) - the same as before, except for the fact that the hyper-node has string = "kick the bucket" and UW = [[die]]
Hyper-nodes may also contain internal hyper-nodes:
- ((("a")("b"))("c")) - a hyper-node containing a linear relation between the hyper-node (("a")("b")) and the node ("c")
Properties of hyper-nodes
- As any node, hyper-nodes are expressed between (parentheses)
- (("a")("b"))
- As any node, hyper-nodes may have one single string, one single headword and one single UW, but may have as many features and internal relations as necessary
- (([kick],V)([the],D)([bucket],N),"kick the bucket",[kick the bucket],[[die]],V,NTST)
- As any node, hyper-nodes may be referenced by any of its elements, including internal relations
- (([kick],V)) - refers to any hyper-node containing the node ([kick],V)
- (([the],D)([bucket],N)) - refers to any hyper-node containing a linear relation between ([the],D) AND ([bucket],N)
- (([kick],D),([bucket],N)) - refers to any hyper-node containing the nodes ([kick],V) AND ([bucket],N)
- When a hyper-node is deleted, all its internal relations are deleted as well
- (([kick],V)([the],D)([bucket],N)):=; (the hyper-node is deleted, as well as the relations ([kick],V)([the],D) AND ([the],D)([bucket],N))
Hyper-relations
Relations may have relations as arguments. In this case, they are said to be "hyper-relations". Examples of hyper-relations are the following:
- XP(XB(%a;%b);%c) - a syntactic relation XP between the syntactic relation XB(%a;%b) and the node %c
- and(agt([a];[b]);agt([a];[c])) - a semantic relation "and" between the semantic relations agt([a];[b]) AND agt([a];[c])
Properties of hyper-relations
- A hyper-relation may have one single relation as each argument
- XP(XB(%a;%b);%c) - the source argument of the hyper-relation XP is a relation
- XP(%a;XB(%b;%c)) - the target argument of the hyper-relation XP is a relation
- XP(VC(%a;%b);VA(%a;%c)) - the source and the target argument of the hyper-relation XP are relations
XP(VC(%a;%b)VA(%a;%c);VS(%a;%d))- a hyper-relation may not have more than one relation as one single argument (in this case, the hyper-relation XP contained two relations as the source argument)
- Relations do not have strings, UWs, headwords or any features
XP(XB(%a;%b),"ab",[ab],[[ab]],A,B;%c)(the relation XB(%a;%b) may not have strings, UWs, headwords or any features)
Types of rules
In the UNL Grammar there are three basic types of rules:
Normalization Rules
(main article: N-Rules Used to normalize the natural language input and to segment natural language texts into sentences.
Transformation rules
(main article: T-Rules Used to generate natural language sentences out of UNL graphs and vice-versa.
Disambiguation rules =
(main article: D-rules Used to improve the performance of transformation rules by constraining their applicability.
The Segmentation Rules and Transformation Rules follow the very general formalism
α:=β;
where the left side α is a condition statement, and the right side β is an action to be performed over α.
The Disambiguation Rules, which were directly inspired by the UNL Centre's former co-occurrence dictionary and knowledge base, follows a slightly different formalism:
α=P;
where the left side α is a statement and the right side P is an integer from 0 to 255 that indicates the probability of occurrence of α.
Normalization rules
Normalization rules are used to prepare the natural language input for automatic processing. They constitute the preprocessing module that applies over the input as a string and runs prior to the tokenization. They have two roles:
- to normalize the input text (to replace abbreviations by their extend forms, to extend contractions, etc.)
- to segment the natural language text into sentences (i.e., to create the tags <SHEAD> (beginning of a sentence), <STAIL> (end of a sentence), <CHEAD> (beginning of a scope) and <CTAIL> (end of a scope) inside the input text). These sentences are used as sentence and clause boundaries, and define the units of processing of the Transformation and Disambiguation grammars.
Examples of Normalization rules
- Segmentation
- ("/.*\./",%x):=(%x)(+STAIL,%y); (creates an STAIL node after any sequence of characters followed by "." (/.*\./);
- ("/\(/",%x):=(+CHEAD,%y)(%x); (creates an CHEAD node before the opening of a parentheses (/\(/);
- Normalization
- ("an "):=("a "); ("an apple" > "a apple")
- ("don't"):=("do not"); ("I don't see" > "I do not see")
Disambiguation Rules
Apart from Transformation Rules, the UNL Grammar also comprises Disambiguation Rules, which are optional and may be used to:
- Prevent wrong lexical choices;
- Provoke best matches;
- Check the consistency of the graphs, trees and lists.
The formalism here presented is directly inspired by UNL Centre former co-occurrence dictionary and knowledge-base. The structure of the rule is as follows:
STATEMENT=P;
Where
STATEMENT is any network, tree or list relation; and
P, which can range from 0 (impossible) to 255 (necessary), is the probability of occurrence of the STATEMENT
There are three types of disambiguation rules:
- Network disambiguation rules
- Tree disambiguation rules
- List disambiguation rules
Network Disambiguation Rules
Network disambiguation rules apply over the network structure of UNL graphs to constrain the application of Tree-to-Network (TN) and Network-to-Network (NN) Transformation Rules. They have the following format:
SEM(A;B)=P;
Where SEM is a semantic relation, A and B are nodes, and P is an integer (from 0 to 255).
Examples
- agt(VER;ADJ)=0;
- An adjective (ADJ) may not be an agent (agt) of a verb (VER).
- agt(VER;NOU)=255;
- Agents (agt) of verbs (VER) are always nouns (NOU).
Use
INPUT | TRANSFORMATION RULES | DISAMBIGUATION RULES | OUTPUT |
---|---|---|---|
SYN(A,B,C;D,E,F) | SYN(A;D)=agt(;); (higher priority) SYN(A;E)=aoj(;); (lower priority) |
agt(A;F)=0; | aoj(A,B,C;D,E,F) |
Tree Disambiguation Rules
Tree disambiguation rules apply over the intermediate tree structure to constrain the application of List-to-Tree (LT), Network-to-Tree (NT) and Tree-to-Tree (TT) Transformation Rules. They have the following format:
SYN(A;B)=P;
Where SYN is a syntactic relation, A and B are nodes, and P is an integer (from 0 to 255).
Examples
- VS(VER;ADJ)=0;
- An adjective (ADJ) may not be an specifier (VS) of a verb (VER).
- NS(NOU;DET)=255;
- Determiners (DET) are always specifiers (NS) of nouns (NOU).
Use
INPUT | TRANSFORMATION RULES | DISAMBIGUATION RULES | OUTPUT |
---|---|---|---|
(A,B,C)(D,E,F) | (A)(D)=X(A;D); (higher priority) (A)(E)=X(E;A); (lower priority) |
X(F;A)=255; | X(D,E,F;A,B,C) |
agt(A,B,C;D,E,F) | agt(A;D)=X(A;D); (higher priority) agt(A;E)=Y(A;E); (lower priority) |
X(B;F)=0; | Y(A,B,C;D,E,F) |
List Disambiguation Rules
List disambiguation rules apply over the natural language list structure to constrain the application of both Tree-to-List (TL) and List-to-List (LL) Transformation Rules. They are also used for word selection. They have the following format:
(A)(B)=P;
Where A and B are nodes, and P is an integer (from 0 to 255).
Examples
- (ART)(BLK)(VER)=0;
- An article (ART) may not precede a verb (VER).
- (ART)(BLK)(NOU)=255;
- Articles (ART) always precede nouns (NOU).
Use
INPUT | TRANSFORMATION RULES | DISAMBIGUATION RULES | OUTPUT |
---|---|---|---|
X(A,B,C;D,E,F) | X(A;D)=(A)(D); (higher priority) X(A;F)=(F)(A); (lower priority) |
(B)(E)=0; | (D,E,F)(A,B,C) |
INPUT | DICTIONARY | DISAMBIGUATION RULES | OUTPUT |
---|---|---|---|
the book | [book] "22222" (POS=VER); (higher priority) [book] "11111" (POS=NOU); (lower priority) |
(ART)(BLK)(VER)=0; | [book] "1111" (POS=NOU); |
Formal Syntax of Disambiguation Rules
Disambiguation rules must comply with the following syntax
<DISAMBIGUATION RULE> ::= <NN RULE> | <TT RULE> | <LL RULE> <NN RULE> ::= (<SEM>)+ "=" [0-255]";" <TT RULE> ::= (<SYN>)+ "=" [0-255]";" <LL RULE> ::= "(" <NODE> ")" ( "(" <NODE> ")" )+ "=" [0-255]";" <SEM> ::= <TEXT> "(" <NODE> ";" <NODE> ")" <SYN> ::= <TEXT> "(" <NODE> ";" <NODE> ")" <NODE> ::= ( (<DESCRIPTION>)( "," <DESCRIPTION> )* )? <DESCRIPTION> ::= <STRING> | <ENTRY> | <FEATURE> | <RELATION> <STRING> ::= """<text>""" <ENTRY> ::= "["<entry>"]" <FEATURE> ::= <VALUE> | <ATTRIBUTE> | <ATTRIBUTE>"="<VALUE> <RELATION> ::= <SEM>|<SYN> <VALUE> ::= <TEXT> <ATTRIBUTE> ::= <TEXT> <TEXT> ::= any sequence of characters except whitespace | <REGULAR EXPRESSION> <REGULAR EXPRESSION> ::= "/"<PERL COMPATIBLE REGULAR EXPRESSIONS>"/"
Indexes
- Indexes (%) are used for co-indexing nodes, attributes and values inside and between the left and the right side of transformation rules.
- X(%a;)Y(%a;) (the first node of X is also the first node of Y)
- X(%a;%b):=Y(%b;%a); (the first node of X becomes the second node of Y, and the second node of X becomes the first node of Y)
- X(%a;)Y(%a;):=Z(%a); (if the first node of X is the first node of Y then make it the single node of Z)
Any co-indexation is made by the use of indexes and not by the repetition of features. In that sense, X(A;)Y(A;) is different from X(%a;)Y(%a;). In the former case, the first node of X is not necessarily the first node of Y, they only share the same feature A; in the latter case, the first node of X is necessarily the first node of Y.
- Indexes are made of any sequence of alphanumeric characters and underscore
- %index
- %a
- %first_index
- %a1
%first index(no blank spaces are allowed)
%01 (numbers are used for default indexation and must be avoided - see below)
- Default indexation
- If omitted, indexes are assigned by default, according to the following rules:
- Default indexes are assigned from left to right in each side of the rule according to the position of the nodes:
- X(A;B)Y(C;D) is the same as X(%01,A;%02,B)Y(%03,C;%04,D)
- Default indexation is done only for non-indexed nodes (i.e., user-defined indexes prevail over indexes assigned by default):
- X(A,%A;B)Y(C,%C;D) is the same as X(A,%A;B,%02)Y(C,%C;%04,D)
- (Notice that the user-defined indexes %A and %C are preserved and not replaced by default indexes)
- X(A,%A;B)Y(C,%C;D) is the same as X(A,%A;B,%02)Y(C,%C;%04,D)
- In default indexation, left-side nodes are automatically co-indexed with right-side nodes if and only if their position and number are the same:
- X(A;B):=Y(C;D); is the same as X(%01,A;%02,B):=Y(%01,C;%02,D);
- X(A;B):=Y(C;D;E); is the same as X(%01,A;%02,B):=Y(%03,C;%04,D;%05,E);
- (there is no co-indexation between the left and the right side in the latter case, because the number of the nodes is not the same)
- Default indexes are also assigned to hyper-nodes and sub-nodes
- (((A))):=(((B))); is the same as (%01(%01%01(%01%01%01,A))):=(%01(%01%01(%01%01%01,B)));
- In default indexation, sub-nodes are informed by the syntax <PARENT NODE><CHILD NODE>, where <PARENT NODE> may be, itself, a sub-node:
- X(Y(A;B);C) is the same as X(%01,Y(%01%01,A;%01%02,B);%02)
- %01 = Y(A;B), %02 = C, %01%01 = A, %01%02 = B
- X(Y(Z(A;B);C);D) is the same as X(%01,Y(%01%01,Z(%01%01%01,A;%01%01%02,B);%01%02,C);%02,D)
- %01 = Y(Z(A;B);C), %02 = D, %01%01 = Z(A;B), %01%02 = C, %01%01%01 = A, %01%01%02 = B
- X(Y(A;B);C) is the same as X(%01,Y(%01%01,A;%01%02,B);%02)
- Non-indexed nodes in the right side means ADDITION, whereas left-side nodes that are not referred to in the right side means DELETION
- X(%a;%b):=Y(%a;X;%b); is the same as X(%a;%b):=Y(%a;%02,X,;%b); (it means that a new node with the feature X will be created for the relation Y)
- X(%a;%b;%c):=Y(%a;%c); (it means that the second node of X will be deleted from the relation Y)
- Indexes may also be used to transfer attribute values expressed in the format ATTRIBUTE=VALUE
- X(A,%a,ATT1=VAL1;B,%b):=X(%a;%b,ATT1=%a); (the value "VAL1" of "ATT1" of %a is copied to the node %b)
- Special indexes (#) are used to make reference to the internal structure of the field <NLW> in the dictionary
- (X)(Y):=(X,#02)(Y)(X,#01);
- The rule above is used for complex dictionary entries such as:
- [[A][B]] "uw" (X, #01(ATT=AAA), #02(ATT=BBB)) <flg,fre,pri>;
- It means that, given (X)(Y), the output should be (B)(Y)(A).
- The rule above is used for complex dictionary entries such as:
Examples of Rules
In the examples below:
- L(A;B) is a linear (list) relation between A and B (i.e., L(A;B) = (A)(B))
- REL(A;B) is a non-linear (tree or network) relation between A and B
- %X is the index for a node
- :X indicates that the following relation or node is inside the hyper-node X
- A,B,C,D,B1,B2,B3 and B4 are features of the nodes %A,%B,%C,%D,%B1,%B2,%B3 and %B4, respectively.
LL RULES
INITIAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4)
- LL#1: (B):=;
- (Delete all nodes having the feature B, wherever they are)
- FINAL STATE: L(%A;%C) L(%C;%D)
- The whole hyper-node %B will be deleted, including all its nodes, no matter in which level.
- LL#2: (B1):=;
- (Delete all nodes having the feature B1, wherever they are)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B2;%B3) :B(%B4)
- Only the node (%B1) is deleted. The relation REL is also deleted, but the node %B4 is preserved as an isolated node inside the hyper-node %B.
- LL#3: ((B1)):=;
- (Delete any hyper-node that contains the node having the feature B1, wherever they are);
- FINAL STATE: L(%A;%C) L(%C;%D)
- The whole hyper-node %B will be deleted, including all its nodes, no matter in which level.
- LL#4: (B1):=(NEW);
- (Add the feature “NEW” to all nodes having the feature B1)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4) (NO CHANGE IN THE NODE STRUCTURE)
- There is no indexes in the left and the right side, which have the same number of nodes. This means that they are automatically co-indexed. No node is deleted or replaced. The feature “NEW” is added to the the node %B1, because it contains the feature B1. This rule provokes a look, because the feature NEW will be added indefinitely to the node %B1. In order to avoid this, the condition should be set (B1,^NEW):=(NEW);
- LL#5: (%x,B1):=(%y,NEW);
- (Replace any node having the feature B1 by a new node having the feature NEW)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%NEW;%B2) L:B(%B2;%B3) REL:B(%NEW;%B4)
- The node %B1 is deleted and replaced by a new node %NEW. Notice that all instances of the node are replaced.
- LL#6: ({(B1)|(B3)}):=;
- (Delete any hyper-node that contains nodes having the features B1 or B3);
- FINAL STATE: L(%A;%C) L(%C;%D)
- The whole hyper-node %B will be deleted, including all its nodes, no matter in which level.
- LL#7: ((B1)(B2)):=;
- (Delete any hyper-node that contains the relation L(B1;B2));
- FINAL STATE: L(%A;%C) L(%C;%D)
- The whole hyper-node %B will be deleted, including all its nodes, no matter in which level.
- LL#8: ((B1)(B3)):=;
- (Delete any hyper-node that contains the relation L(B1;B3))
- Nothing happens. The condition is not true in the case of the initial state indicated above.
- LL#9: ((B1)):=(-feature);
- (Remove the feature “feature” from any hyper-node containing a node with the feature B1)
- As the left and the right side do not have indexes, they are automatically co-indexed. The co-indexation, however, is valid only to the hyper-node level, because the right side does not contain any inner node. In that sense, the feature “feature” is not removed from the inner node, but from the hyper-node.
- LL#10: ((B1)):=((-feature));
- (Remove the feature “feature” from anynode having the feature B1 which is inside a hyper-node)
- The automatic indexation affects both levels: the hyper-node and the node, because they are equivalent. The rule is the same as (%x,(%y,B1)):=(%x,(%y,-feature));. The feature “feature” is now removed from the inner node and not from the hyper-node.
- LL#11: ((%x,B1)):=((%y,NEW));
- (Replace any node containing the feature B1 inside a hyper-node by a new node containing the feature 'NEW')
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%NEW;%B2) L:B(%B2;%B3) REL:B(%NEW;%B4)
- The same as (%x,B1):=(%y,NEW); but inside a hyper-node (i.e., the rule applies only to the nodes having the feature B1 which are inside some other node).
- LL#12: ((B1)):=((E)(F));
- (Replace any node containing the feature B1 by a linear relation between two new nodes containing the features E and F, respectively)
- FINAL STATE: : L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B2;%B3) REL:B(%HB;%B4) L:HB(%E;%F)
- The same as (%x,B1):=(%y,E)(%z,F); but inside a hyper-node (i.e., the rule applies only to the nodes having the feature B1 which are inside some other node). The linear relation between the nodes (%B1) and (%B2) disappear, because (%B1) is an argument of a non-linear relation REL(%B1;%B4) and should be replaced, therefore, by a hyper-node instead of a simple sequence of nodes (%E)(%F), since
REL((%E)(%F);(%B4))is not possible. As a consequence, the nodes (%E) and (%F) are created inside the hyper-node %HB and may not hold any linear relation with %B2, because they are now in different scopes.
- LL#13: ((B1)):=(((E)(F),-B1));
- (Replace any node containing the feature B1 by a new node containing a linear relation between two new nodes containing the features E and F, respectively)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%HB;%B2) L:B(%B2;%B3) REL:B(%HB;%B4) L:HB(%E;%F)
- The same as (%x,(%a,B1)):=(%x,(%b,E)(%c,F)); but inside a hyper-node (i.e., the rule applies only to the nodes having the feature B1 which are inside some other node). Differently from the previous example, the node containg the feature B1 is replaced by a hyper-node and not by two other nodes of the same level. As the system is conservative, the feature B1 has to deleted in order to prevent the rule from applying eternally.
- LL#14:((B1)):=((E),(F));
- (Replace the node containing the feature B1 by two new nodes containing the features E and F, respectively)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%HB;%B2) L:B(%B2;%B3) REL:B(%HB;%B4) :HB(%E) :HB(%F)
- The nodes (E) and (F) no longer constitute a linear relation, and are added as isolated notes to the hyper-node. Because of that, (B1) has to be replaced, necessarily, by a hyper-node. This means that this rule will have exactly the same effect of the rule below.
- LL#15:((B1)):=(((E),(F),-B1));
- (Replace the node containing the feature B1 by two new nodes containing the features E and F, respectively)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%HB;%B2) L:B(%B2;%B3) REL:B(%HB;%B4) :HB(%E) :HB(%F)
- The nodes (E) and (F) no longer constitute a linear relation, and are added as isolated notes to the hyper-node. As the system is conservative, the feature B1 has to deleted in order to prevent the rule from applying eternally.
- LL#16: (REL(%B1;%B4)):=(NEWREL(%B1;%B5));
- (Replace the relation REL between the nodes %B1 and %B4 by a new relation NEWREL between the existing node %B1 and a new node %B5)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) NEWREL:B(%B1;%B5) :B(%B4)
- Nodes on both sides are automatically co-indexed, because their number is the same. Therefore, the relation on the left side is replaced by the relation on the right side in the same hyper-node. No node is deleted: notice that %B4 is still there. This is the same as REL(A;B):=REL(C;D);.
- LL#17:(B1)(B2):=;
- (The same as L(%B1;%B2):=; i.e., delete the linear relation between %B1 and %B2)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) :B(%B3) REL:B(%B1;%B4)
- The linear relation between (%B1) and (%B2) is deleted, but the nodes (%B1) and (%B2) are preserved if part of other non-linear relations.
- LL#18:(B1)(B2):=(B5);
- (The same as L(%B1;%B2):=(%B5); i.e., replace the linear relation between %B1 and %B2 by %B5)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B5;%B3) REL:B(%B1;%B4)
- The linear relation between (%B1) and (%B2) is replaced by %B5, but the nodes (%B1) and (%B2) are preserved if part of other non-linear relations.
- LL#19:(%B1,B1)(B2):=(%B1);
- (The same as L(%B1;%B2):=(%B1); i.e., replace the linear relation between %B1 and %B2 by %B1)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B3) REL:B(%B1;%B4)
- The linear relation between (%B1) and (%B2) is replaced by %B1, but the nodes (%B1) and (%B2) are preserved if part of other non-linear relations.
- LL#20:(B1)(%B2,B2):=(%B2);
- (The same as L(%B1;%B2):=(%B2); i.e., replace the linear relation between %B1 and %B2 by %B2)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B2;%B3) REL:B(%B1;%B4)
- The linear relation between (%B1) and (%B2) is replaced by %B2, but the nodes (%B1) and (%B2) are preserved if part of other non-linear relations.
- LL#21:(%B1,B1)(%B2,B2):=(%B1,(%B2));
- (replace the linear relation between %B1 and %B2 by the node %B1 with %B2 inside as an isolated node)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B3) REL:B(%B1;%B4) :B1(%B2)
- The linear relation between (%B1) and (%B2) is replaced by %B1, but the nodes (%B1) and (%B2) are preserved if part of other non-linear relations.
- LL#22: (%D,D):=(%D,-D,+D1)(%D,-D,+D2);
- (Duplicate the node having the feature D, wherever they are)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D1) L(%D1;%D2) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4)
- The whole hyper-node %D will be duplicated, including all its nodes, no matter in which level. Node duplication occurs only in LL rules. As the system is conservative, the feature D has to deleted in order to prevent the rule from applying eternally.
LT RULES
INITIAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4)
- LT#1: (%B1,B1)(%B2,B2):=REL(%B1;%B2);
- (Replace the relation L(%B1;%B2) by the relation REL(%B1;%B2))
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) REL:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4)
- No node is deleted, but there’s no longer a linear relation between %B1 and %B2. There’s still, however, a linear relation between %B2 and %B3 inside the hyper-node %B.
- LT#2: (%B1,B1)(%B2,B2):=+REL(%B1;%B2);
- (Add the relation REL(%B1;%B2) to the graph )
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4) REL(%B1;%B2)
- No node or relation is deleted. A new relation is created in the graph.
- LT#3: (%B1,B1)(%B2,B2)(%B3,B3):=REL(%B1;%B2);
- (Replace the relations L(%B1;%B2)L(%B2;%B3) by the relation REL(%B1;%B2))
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) REL:B(%B1;%B2) REL:B(%B1;%B4)
- The node (%B3) is deleted because it is not present in the right side.
- LT#4: (%B1,B1)(%B3,B3)(%B2,B2):=REL(%B1;%B2);
- (Replace the relations L(%B1;%B3)L(%B3;%B2) by the relation REL(%B1;%B2))
- Nothing happens. The condition is not true in this case.
- LT#5: (%B1,B1):=REL(%B1;%B5); (Replace the node having the feature B1 by the relation REL(%B1;%B5))
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B2;%B3) REL:B(%HB;%B4) REL:HB(%B1;%B5)
- There is no longer a linear relation between %B1 and %B2, because the node was replaced by a relation and, therefore, removed from the list structure.
- LT#6: (%B1,B1):=+REL(%B1;%B5); (Add the relation REL(%B1;%B5) to the graph)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4) REL(%B1;%B5)
- No node is replaced or deleted. A new relation is added to the graph.
- LT#7: (REL(%B1,B1;%B4,B4)):=NEWREL(%B1;%B4); (Replace the hyper-node containing the relation REL by the relation NEWREL(%B1;%B5)
- FINAL STATE: L(%A;%C) L(%C;%D) NEWREL(%B1;%B4)
- The whole hyper-node %B will be replaced by the new relation. All its inner nodes not referred to in the right side will be deleted as well.
- LT#8: (REL(%B1,B1;%B4,B4)):=+NEWREL(%B1;%B4); (Add the relation NEWREL(%B1;%B4) to the graph)</nowiki>
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4) NEWREL(%B1;%B4)
- The hyper-node remains the same. The relation NEWREL(%B1;%B4) is added to its outer scope.
TL Rules
INITIAL STATE: L(%A;%B) L(%B;%C) REL:B(%B1;%B2) REL:B(%B1;%B3)
- TL#1: REL(%B1;%B2)REL(%B1;%B3):=(%B1)(%B2);
- (Replace the relation REL between the nodes %B1 and %B2 and the relation REL between the nodes %B1 and %B3 by a linear relation between %B1 and %B2)
- FINAL STATE: L(%A;%B) L(%B;%C) L:B(%B1;%B2)
- The node %B3 is deleted, because it does not have any other relation with any other node inside the hyper-node.
- TL#2: REL(%B1;%B2):=(%B2);
- (Replace the relation REL between the nodes %B1 and %B2 by the node %B1)
- FINAL STATE: L(%A;%B) L(%B;%C) REL:B(%B1;%B3) :B(%B2)
- The node %B1 is not deleted, because it still has a relation with the node %B3. The relation between %B1 and %B2 is replaced by a single node %B2.
TT or NN Rules
INITIAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) REL:B(%B1;%B4)
- TT#1:REL(%x;%y):=NEWREL(%x;%y)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) NEWREL:B(%B1;%B4)
- The relation is changed, but the arguments %x and %y are preserved.
- TT#2: REL(%x;%y):=REL(%w;%z)
- FINAL STATE: L(%A;%B) L(%B;%C) L(%C;%D) L:B(%B1;%B2) L:B(%B2;%B3) :B(%B4) REL(%w;%z)
- The relation between %x and %y is deleted, but the nodes are preserved. Noticed that %B4 became an isolated node, but it’s still there, because no node may be deleted by a NN rule.
INITIAL STATE : REL(%x;%y;%z)
- TT#3:REL(%x;%y;%z):=REL(%x;%y);
- FINAL STATE: REL(%x;%y) (%z)
- The node %z is not deleted.