Fixed dependency relations

Change-Id: Ic0f0ac05c810c0aed6451c35f3afae9b3e7a80b0
diff --git a/lib/KorAP/XML/Index/Mate/Dependency.pm b/lib/KorAP/XML/Index/Mate/Dependency.pm
index ff28d7f..7bf45a7 100644
--- a/lib/KorAP/XML/Index/Mate/Dependency.pm
+++ b/lib/KorAP/XML/Index/Mate/Dependency.pm
@@ -88,23 +88,23 @@
 	      $target, 'mate/d:' . $NODE_LABEL
 	    );
 
-	    my %rel = (
+	    $mtt->add(
+	      term => '>:mate/d:' . $label,
 	      pti => 32, # term-to-term relation
 	      payload =>
 		'<i>' . $target->pos . # right part token position
 		  '<s>' . $source_term->tui . # left part tui
 		    '<s>' . $target_term->tui # right part tui
-		  );
-
-	    $mtt->add(
-	      term => '>:mate/d:' . $label,
-	      %rel
 	    );
 
 	    my $target_mtt = $stream->pos($target->pos);
 	    $target_mtt->add(
 	      term => '<:mate/d:' . $label,
-	      %rel
+	      pti => 32, # term-to-term relation
+	      payload =>
+		'<i>' . $source->pos . # left part token position
+		  '<s>' . $source_term->tui . # left part tui
+		    '<s>' . $target_term->tui # right part tui
 	    );
 	  }
 
@@ -116,6 +116,7 @@
 	      $target, 'mate/d:' . $NODE_LABEL
 	    );
 
+	    # TODO: THAT'S WRONG!
 	    my %rel = (
 	      pti => 33, # term-to-element relation
 	      payload =>
diff --git a/t/index/mate_dependency.t b/t/index/mate_dependency.t
index fab2bb5..eb1a0ad 100644
--- a/t/index/mate_dependency.t
+++ b/t/index/mate_dependency.t
@@ -15,14 +15,14 @@
 my $data = $tokens->to_data->{data}->{stream};
 
 # Unary relation
-is($data->[4]->[3], '<:mate/d:--$<b>32<i>4<s>1<s>1', '< rel 1 (unary)');
-is($data->[4]->[4], '>:mate/d:--$<b>32<i>4<s>1<s>1', '> rel 1 (unary)');
-is($data->[4]->[7], 'mate/d:NODE$<b>128<s>1', 'token for rel 1 (unary)');
+is($data->[4]->[2], '<:mate/d:--$<b>32<i>4<s>1<s>1', '< rel 1 (unary)');
+is($data->[4]->[1], '>:mate/d:--$<b>32<i>4<s>1<s>1', '> rel 1 (unary)');
+is($data->[4]->[8], 'mate/d:NODE$<b>128<s>1', 'token for rel 1 (unary)');
 
 is($data->[1]->[0], '>:mate/d:NK$<b>32<i>3<s>1<s>1', '> rel 2 (term-to-term)');
 is($data->[1]->[3], 'mate/d:NODE$<b>128<s>1', '< rel 2 (term-to-term)');
-is($data->[3]->[1], '<:mate/d:NK$<b>32<i>3<s>1<s>1', '< rel 2 (term-to-term)');
-is($data->[3]->[4], 'mate/d:NODE$<b>128<s>1', '< rel 2 (term-to-term)');
+is($data->[3]->[1], '<:mate/d:NK$<b>32<i>1<s>1<s>1', '< rel 2 (term-to-term)');
+is($data->[3]->[5], 'mate/d:NODE$<b>128<s>1', '< rel 2 (term-to-term)');
 
 done_testing;