Transformation over relations

From UNL Wiki
(Difference between revisions)
Jump to: navigation, search
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
Relations and hyper-relations are altered, replaced, created and deleted by [[T-rule]]s:
+
Relations are altered, replaced, created and deleted by [[S-rule]]s:
  
== Altering relations ==
+
=== Altering nodes in a relation ===
The arguments of a relation are altered  
+
Elements of nodes in relations are altered through the operators + (add) and - (delete). The operator + may be omitted.
 +
*rel(%x,A;%y,B):=rel(%x,+C;%y,+D); (add the feature C to %x and D to %y)
 +
*rel(%x,A;%y,B):=rel(%x,C;%y,D);(the same as above)
 +
*rel(%x,A;%y,B):=rel(%x,-A;%y); (delete the feature A from %x)
 +
"strings", [headwords] and <nowiki>[[UWs]]</nowiki> are considered to be features (but a single node may have only one of each)
 +
*rel(%x;%y):=rel(%x,"a";%y); (replace the existing string in %x, if any, by "a")
 +
*rel(%x;%y):=rel(%x,[A];%y);(replace the existing headword in %x, if any, by [A])
 +
*rel(%x;%y):=rel(%x,<nowiki>[[A]]</nowiki>;%y); (replace the existing UW in %x, if any, by <nowiki>[[A]]</nowiki>)
  
<CONDITION> := <ACTION>;
+
=== Creating nodes in a relation ===
 +
Nodes are created when they are not co-indexed to any node in the left side (see [[Indexation]]):
 +
*rel(%x,A;%y,B):=rel(%x;%y;'''%z,+A'''); (the node %z, with the feature A, is created as a new argument of the relation rel)
  
 +
=== Deleting nodes in a relation ===
 +
Nodes are deleted when they are not co-indexed to any node in the right side (see [[Indexation]]):
 +
*rel(%x,A;%y,B;'''%z,C'''):=rel(%x;%y); (the node %z is deleted as an argument of the relation rel)
 +
Nodes are completelly deleted if, and only if, they are not part of any other relation
  
 +
=== Creating relations ===
 +
Relations are created by the operator + (add) before the relation to be created. This operator may not be omitted.
 +
*rel(%x;%y):=+rel2(%x;%z); (a new relation rel2 is created between the nodes %x and %z; the original relation is not altered)
 +
Creation of relations is a possible source of infinite loops. In order to prevent the rule from applying eternally, the condition field must be controlled:
 +
*rel(%x;%y)^rel2(%x;%z):=+rel2(%x;%z);
  
==
+
=== Deleting relations ===
There are four types of S-rules:
+
Relations are deleted when they are not repeated in the right side, except in case of +  
;Change
+
*rel(%x;%y):=; (the relation rel between the nodes %x and %y is deleted)
<CONDITION> := <RELATION>;
+
*rel(%x;%y):=rel2(%x;%y); (the relation rel between %x and %y is deleted and a new relation rel2 is created in its place) (replacement)
:Change the attributes of the constituents of the relation. The relation itself is not affected. Features are added through "+" and deleted through "-".
+
*rel(%x;%y):=+rel2(%x;%y); (the relation rel is preserved and a new relation rel2 is created) (creation)
:*VA(%head;%adjt):=VA(%head,+C;%adj,-D); (add the feature C to the head and remove the feature D from the adjunct)
+
;Create
+
<CONDITION> := +<RELATION>;
+
:Create a new relation. Nodes to be created must be defined as strings (between quotes) or lemmas (between brackets), if not co-indexed to an existing node.
+
:*VA(%head;%adjt):=+VC(%head;"c"); (add the relation VC between the head and "c", which is created.)
+
;Delete
+
<CONDITION> := -<RELATION>;
+
:Delete a relation between the head and the argument. The head and the argument are not deleted.
+
:*VA(%head;%adjt):=-VA(%head;%adjt); (delete the relation VA between the head and its arguments. The nodes are not deleted)
+
;Replace
+
<RELATION> := <RELATION>;
+
:Replace the relation in the left side by the one in the right side
+
:*VA(%head;%any):=VC(%head;%any); (replace the relation VA by VC)
+
:Two special cases of replacement are
+
:;Merge: <RELATION><RELATION> := <RELATION>;
+
::Replace the relations in the left side by the ones in the right side.
+
::*VA(%head;%adjt)VC(%head;%comp):=VB(VB(%head;%adjt);%comp); (VA and VC are deleted, and VB is created)
+
:;Divide: <RELATION> := <RELATION><RELATION>;
+
::Replace the relation in the left side by those in the right side.
+
::*VA(%head;%adjt):=VC(%head;%x)VC(%head;%y); (VA is deleted, and the two VCs are created)
+
  
Where:<br/>
+
=== Replacing relations ===
*<CONDITION> (to be repeated 0 or more times) may be a [[Tagset|tag]] or a <RELATION> that defines when the rule is applied. It may be empty in general cases (i.e., if the rule is always applied).
+
Relations in the left side are replaced by relations in the right side, except in case of +:
*<RELATION> (to be repeated 1 or more times) may be:
+
*rel(%x;%y):=rel2(%x;%y); (the relation rel between %x and %y is deleted and a new relation rel2 is created in its place)  
**a [[Syntactic roles|syntactic relation]] containing the <HEAD>, in case of head-only relations (VH, NH, JH, PH, IH, CH, AH, DH), or the <HEAD> and <ARGUMENT> (i.e, complement, adjunct or specifier), in case of binary relations (VA, VC, VS, VB, NA, NC, NS, etc).
+
*rel1(%x;%y)rel2(%y;%z):=rel3(%x;%z); (the relations rel1 and rel2 are deleted and a new relation rel3 is created in their place) (merge)
**a [[Universal Relation|semantic relation]], containing the <SOURCE> and the <TARGET>.
+
*rel(%x;%y):=rel1(%x;%y)rel2(%y;%z); (the relation rel is deleted and two new relations rel1 and rel2 are created in its place) (divide)
*<HEAD>, <ARGUMENT>, <SOURCE> and <TARGET> may be expressed as
+
*(%x)(%y):=rel(%x;%y); (the linear relation between the nodes %x and %y is replaced by the non-linear relation rel between the same nodes)
**a "string" (strings come between parentheses);
+
*L(%x;%y):=rel(%x;%y); (the same as above)
**a [lemma] (lemmas come between square brackets);
+
**a feature or a set of features, separated by comma, and extracted from the [[Tagset|UNDLF Tagset]];
+
**an [[#Indexes|index]];
+
**an action, to be performed by adding features (through "+"), deleting features (through "-"), or through the right side of an [[A-rule]] (i.e., prefixation, suffixation, infixation); or
+
**a <RELATION> itself (i.e., rules may be recursive).
+
 
+
 
+
 
+
 
+
*REL1(%x;%y):=REL2(%x;%y); (replacement)
+
*REL(%x;%y):=; (deletion)
+
*REL1(%x;%y):=+REL2(%w;%z); (creation)
+
 
+
=== Creating hyper-relations ===
+
Hyper-relations are created through encapsulating relations:
+
*REL1(%x;%y)REL2(%x;%z):=REL1(REL2(%x;%z);%y); (the relation REL1 between %x and %y becomes a hyper-relation between the relation REL2(%x;%z) and the node %y.)
+
 
+
=== Transforming hyper-relations into simple relations ===
+
Hyper-relations are transformed into simple relations by removing their internal relations:
+
*REL1(REL2(%x;%z);%y):=REL1(%x;%y)REL2(%x;%z); (the hyper-relation REL1 between the relation REL2(%x;%z) and the node %y is transformed into a simple relation between the nodes %x and %y; the relatin REL2(%x;%z) is not affected.)
+

Latest revision as of 12:51, 5 November 2013

Relations are altered, replaced, created and deleted by S-rules:

Contents

Altering nodes in a relation

Elements of nodes in relations are altered through the operators + (add) and - (delete). The operator + may be omitted.

  • rel(%x,A;%y,B):=rel(%x,+C;%y,+D); (add the feature C to %x and D to %y)
  • rel(%x,A;%y,B):=rel(%x,C;%y,D);(the same as above)
  • rel(%x,A;%y,B):=rel(%x,-A;%y); (delete the feature A from %x)

"strings", [headwords] and [[UWs]] are considered to be features (but a single node may have only one of each)

  • rel(%x;%y):=rel(%x,"a";%y); (replace the existing string in %x, if any, by "a")
  • rel(%x;%y):=rel(%x,[A];%y);(replace the existing headword in %x, if any, by [A])
  • rel(%x;%y):=rel(%x,[[A]];%y); (replace the existing UW in %x, if any, by [[A]])

Creating nodes in a relation

Nodes are created when they are not co-indexed to any node in the left side (see Indexation):

  • rel(%x,A;%y,B):=rel(%x;%y;%z,+A); (the node %z, with the feature A, is created as a new argument of the relation rel)

Deleting nodes in a relation

Nodes are deleted when they are not co-indexed to any node in the right side (see Indexation):

  • rel(%x,A;%y,B;%z,C):=rel(%x;%y); (the node %z is deleted as an argument of the relation rel)

Nodes are completelly deleted if, and only if, they are not part of any other relation

Creating relations

Relations are created by the operator + (add) before the relation to be created. This operator may not be omitted.

  • rel(%x;%y):=+rel2(%x;%z); (a new relation rel2 is created between the nodes %x and %z; the original relation is not altered)

Creation of relations is a possible source of infinite loops. In order to prevent the rule from applying eternally, the condition field must be controlled:

  • rel(%x;%y)^rel2(%x;%z):=+rel2(%x;%z);

Deleting relations

Relations are deleted when they are not repeated in the right side, except in case of +

  • rel(%x;%y):=; (the relation rel between the nodes %x and %y is deleted)
  • rel(%x;%y):=rel2(%x;%y); (the relation rel between %x and %y is deleted and a new relation rel2 is created in its place) (replacement)
  • rel(%x;%y):=+rel2(%x;%y); (the relation rel is preserved and a new relation rel2 is created) (creation)

Replacing relations

Relations in the left side are replaced by relations in the right side, except in case of +:

  • rel(%x;%y):=rel2(%x;%y); (the relation rel between %x and %y is deleted and a new relation rel2 is created in its place)
  • rel1(%x;%y)rel2(%y;%z):=rel3(%x;%z); (the relations rel1 and rel2 are deleted and a new relation rel3 is created in their place) (merge)
  • rel(%x;%y):=rel1(%x;%y)rel2(%y;%z); (the relation rel is deleted and two new relations rel1 and rel2 are created in its place) (divide)
  • (%x)(%y):=rel(%x;%y); (the linear relation between the nodes %x and %y is replaced by the non-linear relation rel between the same nodes)
  • L(%x;%y):=rel(%x;%y); (the same as above)
Software