/** Execute the operation */
    @Override
    protected void onExecute() throws Exception {

      int count = 0;
      com.sparsity.dex.gdb.Graph graph = ((DexGraph) getGraph()).getRawGraph();

      // Get by label

      if (key.compareTo(StringFactory.LABEL) == 0) { // label is "indexed"

        int type = graph.findType(value.toString());
        if (type != com.sparsity.dex.gdb.Type.InvalidType) {
          com.sparsity.dex.gdb.Type tdata = graph.getType(type);
          if (tdata.getObjectType() == ObjectType.Edge) {
            com.sparsity.dex.gdb.Objects objs = graph.select(type);
            com.sparsity.dex.gdb.ObjectsIterator objsItr = objs.iterator();

            while (objsItr.hasNext()) {
              @SuppressWarnings("unused")
              long v = objsItr.nextObject();
              count++;
            }

            objsItr.close();
            objs.close();
          }
        }
      } else {

        // Get by a different property

        for (int type : types) {
          int attr = graph.findAttribute(type, key);
          if (com.sparsity.dex.gdb.Attribute.InvalidAttribute != attr) {
            com.sparsity.dex.gdb.Attribute adata = graph.getAttribute(attr);

            if (adata.getKind() == AttributeKind.Basic) {
              throw new RuntimeException("Key " + key + " is not indexed");
            } else { // use the index
              com.sparsity.dex.gdb.Objects objs = DexUtils.getUsingIndex(graph, adata, value);
              com.sparsity.dex.gdb.ObjectsIterator objsItr = objs.iterator();

              while (objsItr.hasNext()) {
                @SuppressWarnings("unused")
                long v = objsItr.nextObject();
                count++;
              }

              objsItr.close();
              objs.close();
            }
          }
        }
      }

      setResult(count);
    }
 /**
  * Initialize the operation
  *
  * @param args the operation arguments
  */
 @Override
 protected void onInitialize(Object[] args) {
   super.onInitialize(args);
   types = DexUtils.getEdgeTypes(((DexGraph) getGraph()).getRawGraph());
 }