Introduce display of relational structures (experimental)

Change-Id: I3f8f16ff477e0ff21d846a4a0799a8e48f3f43e4
diff --git a/dev/demo/all.html b/dev/demo/all.html
index 369ec2c..6cbfa65 100644
--- a/dev/demo/all.html
+++ b/dev/demo/all.html
@@ -175,7 +175,7 @@
 	      data-doc-id="WWW"
 	      data-text-id="03313"
 	      data-match-id="p102-103"
-	      data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans"
+	      data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels"
 	      id="WPD-WWW.03313-p102-103"
 	      tabindex="6">
 	    <div class="meta">WPD/WWW/03313</div>
@@ -194,7 +194,7 @@
 	      data-doc-id="FFF"
 	      data-text-id="01460"
 	      data-match-id="p119-120"
-	      data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans"
+	      data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels"
 	      id="WPD-FFF.01460-p119-120"
 	      tabindex="6">
 	    <div class="meta">WPD/III/78432</div>
@@ -211,7 +211,7 @@
 	      data-doc-id="HHH"
 	      data-text-id="06056"
 	      data-match-id="p2564-2565"
-	      data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans"
+	      data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels"
 	      id="WPD-HHH.06056-p2564-2565"
 	      tabindex="6">
 	    <div class="meta">WPD/HHH/06056</div>
diff --git a/dev/demo/alldemo.js b/dev/demo/alldemo.js
index 5e0ec44..226ee28 100644
--- a/dev/demo/alldemo.js
+++ b/dev/demo/alldemo.js
@@ -137,6 +137,75 @@
   "<\/span>"+
   "<span class=\"context-right\"><\/span>";
 
+var relSnippet =
+    "<span class=\"context-left\"></span>" +
+    "<span class=\"match\">" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p199\">" +
+    "    <span xlink:title=\"malt/d:ADV\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p199\">dann</span>" +
+    "  </span>" +
+    " zog " +
+    "  <span xlink:title=\"malt/d:SUBJ\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p199\">ich</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p202\">" +
+    "    <span xlink:title=\"malt/d:OBJA\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p199\">mich</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:PP\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p199\">gegen</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p204\">" +
+    "    <span xlink:title=\"malt/d:DET\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p204\">das</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:PN\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p202\">Regiment</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p206\">" +
+    "    <span xlink:title=\"malt/d:AVZ\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p199\">zurück</span>" +
+    "  </span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p207\">" +
+    "    <span xlink:title=\"malt/d:KON\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p199\">und</span>" +
+    "  </span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p208\">" +
+    "    <span xlink:title=\"malt/d:CJ\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p206\">war</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:AUX\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p207\">bemüht</span>" +
+    "," +
+    "  <span xlink:title=\"malt/d:DET\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p211\">einige</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p211\">" +
+    "    <span xlink:title=\"malt/d:ATTR\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p211\">genaue</span>" +
+    "  </span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p212\">" +
+    "    <span xlink:title=\"malt/d:OBJA\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p215\">Umrisse</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:OBJP\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p215\">aufs</span>" +
+    "  <span xlink:title=\"malt/d:PN\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p212\">Papier</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p215\">" +
+    "    <span xlink:title=\"malt/d:PART\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p215\">zu</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:OBJI\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p208\">bringen</span>" +
+    ", um mir " +
+    "  <span xml:id=\"token-GOE/AGA/01784-p219\">" +
+    "    <span xlink:title=\"malt/d:DET\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p219\">die</span>" +
+    "  </span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p220\">Bezüge</span>" +
+    "  <span xlink:title=\"malt/d:KON\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p219\">und</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p222\">" +
+    "    <span xlink:title=\"malt/d:DET\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p222\">die</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:CJ\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p220\">Distanzen</span>" +
+    "  <mark>" +
+    "    <span xlink:title=\"malt/d:DET\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p225\">der</span>" +
+    "  </mark>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p225\">" +
+    "    <span xlink:title=\"malt/d:ATTR\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p225\">landschaftlichen</span>" +
+    "  </span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p226\">" +
+    "    <span xlink:title=\"malt/d:GMOD\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p222\">Gegenstände</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:KON\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p219\">desto</span>" +
+    "  <span xlink:title=\"malt/d:ADV\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p229\">besser</span>" +
+    "  <span xml:id=\"token-GOE/AGA/01784-p229\">" +
+    "    <span xlink:title=\"malt/d:PART\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p229\">zu</span>" +
+    "  </span>" +
+    "  <span xlink:title=\"malt/d:CJ\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGA/01784-p226\">imprimieren</span>" +
+    "</span>" +
+    "<span class=\"context-right\"></span>";
+
+
 var menuContent = [
     ['cnx/c', 'cnx', 'c'],
     ['mate/c', 'mate', 'c'],
@@ -546,8 +615,11 @@
   KorAP.API.getMatchInfo = function(match, callObj, cb) {
 
     console.log(match);
-    
-    if (callObj["spans"] !== undefined && callObj["spans"] === true) {
+
+    if (callObj["foundry"] === "malt" && callObj["layer"] === "d") {
+      cb({ "snippet": relSnippet });
+    }
+    else if (callObj["spans"] !== undefined && callObj["spans"] === true) {
       cb({ "snippet": treeSnippet2 });
     }
     else {