Add rewrite test as method to vc

Change-Id: I87ac48fdbf9d4c75ce09c4456460d1ede56b9034
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 5d2b498..3259083 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -207,6 +207,35 @@
 
       return this;
     },
+
+
+    // Check if the virtual corpus contains a rerite
+    wasRewritten : function (obj) {
+
+      var obj;
+      if (arguments.length === 1) {
+        obj = arguments[0];
+      }
+      else {
+        obj = this._root;
+      };
+
+      // Check for rewrite
+      if (obj.rewrites() && obj.rewrites().length() > 0) {
+        return true;
+      }
+
+      // Check recursively
+      else if (obj.ldType() === 'docGroup') {
+        for (var i in obj.operands()) {
+          if (this.wasRewritten(obj.getOperand(i))) {
+            return true;
+          }
+        };
+      };
+
+      return false;
+    },
     
     // Check if the virtual corpus contains a rewrite
     // This is a class method
diff --git a/dev/js/src/vc/doc.js b/dev/js/src/vc/doc.js
index 7c4f98a..2d38b56 100644
--- a/dev/js/src/vc/doc.js
+++ b/dev/js/src/vc/doc.js
@@ -42,6 +42,7 @@
 
       if (obj === undefined) {
         console.log(json);
+        return;
       };
 
       // Bind the parent
diff --git a/dev/js/src/vc/docgroupref.js b/dev/js/src/vc/docgroupref.js
index f1c1851..905faf8 100644
--- a/dev/js/src/vc/docgroupref.js
+++ b/dev/js/src/vc/docgroupref.js
@@ -9,6 +9,9 @@
   'util'
 ], function (jsonldClass, rewriteListClass, stringValClass) {
 
+  // TODO:
+  //   Does not support rewrites currently
+  
   const loc = KorAP.Locale;
   loc.EMPTY = loc.EMPTY || '⋯';
 
diff --git a/dev/js/src/vc/jsonld.js b/dev/js/src/vc/jsonld.js
index 545652b..600a5bb 100644
--- a/dev/js/src/vc/jsonld.js
+++ b/dev/js/src/vc/jsonld.js
@@ -95,6 +95,10 @@
       };
     },
 
+    rewrites : function () {
+      return null;
+    },
+
     toQuery : function () {
       return '';
     }
diff --git a/dev/js/src/vc/rewritelist.js b/dev/js/src/vc/rewritelist.js
index 8e68fa0..9a87e4e 100644
--- a/dev/js/src/vc/rewritelist.js
+++ b/dev/js/src/vc/rewritelist.js
@@ -23,6 +23,10 @@
       return this;
     },
 
+    length : function () {
+      return this._list.length;
+    },
+
     /**
      * Get element.
      */