Fixed treatment of alternative annotations in one cell in querycreator

Change-Id: I89ecc0ba2ef15f18a2a962e3682ae3816e931481
diff --git a/dev/js/src/match/querycreator.js b/dev/js/src/match/querycreator.js
index caae6a3..1da61cc 100644
--- a/dev/js/src/match/querycreator.js
+++ b/dev/js/src/match/querycreator.js
@@ -81,7 +81,27 @@
               i++;
           };
 
-          this.toggleInToken(target, i, foundry + '/' + layer + '=' + target.innerText);
+
+          var prefix = foundry + '/' + layer + '=';
+          var annotation = '';
+
+          // There are multiple annotations in this cell - add/remove an or-group
+          if (target.childNodes.length > 1) {
+            var orGroup = [];
+            target.childNodes.forEach(function (item) {
+              if (item.nodeType === 3)
+                orGroup.push(prefix + item.data);
+            });
+            annotation = '(' + orGroup.sort().join(' | ') + ')';
+          }
+
+          // Add/Remove the annotation
+          else {
+            annotation = prefix + target.innerText;
+          };
+
+          // Add term
+          this.toggleInToken(target, i, annotation);
         }
 
         // Get orth values