Relations

From UNL Wiki
(Difference between revisions)
Jump to: navigation, search
(Properties)
(Properties)
Line 72: Line 72:
 
;Differently from [[node]]s, relations do not have elements (strings, headwords, features and indexes)
 
;Differently from [[node]]s, relations do not have elements (strings, headwords, features and indexes)
 
:In rel("a",[a],<nowiki>[[a]]</nowiki>,A;"b",[b],<nowiki>[[b]]</nowiki>,B), the elements "a", "b", [a], [b], <nowiki>[[a]], [[b]]</nowiki>, A and B belong to the arguments of the relation and not to the relation itself.
 
:In rel("a",[a],<nowiki>[[a]]</nowiki>,A;"b",[b],<nowiki>[[b]]</nowiki>,B), the elements "a", "b", [a], [b], <nowiki>[[a]], [[b]]</nowiki>, A and B belong to the arguments of the relation and not to the relation itself.
 +
 +
== Transformations ==
 +
{{:Transformation over relations}}

Revision as of 17:12, 21 August 2013

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 between nodes:

  • the linear relation L, which defines the order of the elements in a list
  • syntactic relations (such as adjunct of the noun phrase, complement of the verbal phrase, specifier of the adjective phrase, etc.)
  • semantic relations (such as agent, object, manner, instrument, etc.)


Contents

Basic Symbols

Basic symbols used in the UNL framework
Symbol Definition Example
( ) node (%a)
" " string "went"
[ ] natural language entry (headword) [go]
[[ ]] UW [[to go(icl>to move)]]
// regular expression /a{2,3}/ = aa,aaa
rel(x;y) relation agt(kill;Peter)
^ not ^a = not a
{ | } or {a|b} = a or b
% index for nodes, attributes and values %x
: scope ID :01
# index for sub-NLWs #01
= attribute-value assignment POS=NOU
! rule trigger !PLR
& merge operator %x&%y
? dictionary lookup operator ?[a]

Basic Concepts

Grammar.png
Node
A node is the most elementary unit in the graph. It is the result of the tokenization process, and corresponds to the notion of "lexical item". At the surface level, a natural language sentence is considered a list of nodes, and a UNL graph a set of relations between nodes.
Relation
In order to form a natural language sentence or a UNL graph, nodes are inter-related by relations. In the UNL framework, there are three different types of relations: the linear (list) relation, syntactic relations and semantic relations.
Hyper-Node
A hyper-node is a sub-graph, i.e., a scope: a node containing relations between nodes.
Hyper-Relation
A hyper-relation is a relation between relations.

Notation

Relations are represented by the general syntax

rel:scope(arg1;arg2;...;argn)

Where

  • rel is the name of the relation;
  • scope is the scope of the relation;
  • arg1, arg2, ..., are the arguments of the relation, i.e., nodes.

The main scope is 00 and it is not shown, by default:

  • rel(arg1;arg2) is the same as rel:00(arg1;arg2) (i.e., the relation rel belongs to the main scope, i.e., the main graph)
  • rel:01(arg1;arg2) (the relation rel belongs to the scope :01, i.e., a sub-graph inside the main graph)

Types

In the UNL framework, there can be three different types of relations:

  • the linear relation L expresses the surface (list) structure of natural language sentences
  • syntactic relations express the syntactic (tree) structure of natural language sentences
  • semantic relations express the semantic (graph) structure of UNL graphs

Examples

Examples of relations:

  • ("a")("b") (a linear relation between two nodes: one having the string "a" and the other having the string "b"
  • L("a";"b") (the same as above)
  • VC(V;NP) (a syntactic relation VC between two nodes: one having the feature V and the other having the feature NP
  • VC("a",V;"b",[[b]],LEX=N,NP) (a syntactic relation VC between two nodes: one having the string "a" and the feature V; and the other having the string "b", the UW b and the features LEX=N and NP)
  • agt("kill";N) (a semantic relation between two nodes: one having the string "kill" and the other having the feature N.

Properties

The linear relation is always binary and is represented in two possible formats
  • L(%x;%y) or
  • (%x)(%y)

where L is the invariant name of the linear relation, and %x and %y are nodes.

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.
Arguments of 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
Differently from nodes, relations do not have elements (strings, headwords, features and indexes)
In rel("a",[a],[[a]],A;"b",[b],[[b]],B), the elements "a", "b", [a], [b], [[a]], [[b]], A and B belong to the arguments of the relation and not to the relation itself.

Transformations

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

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