@Override
  public boolean nodeHasLabel(KernelStatement state, long nodeId, int labelId)
      throws EntityNotFoundException {
    if (state.hasTxStateWithChanges()) {
      if (state.txState().nodeIsDeletedInThisTx(nodeId)) {
        return false;
      }

      if (state.txState().nodeIsAddedInThisTx(nodeId)) {
        TxState.UpdateTriState labelState = state.txState().labelState(nodeId, labelId);
        return labelState.isTouched() && labelState.isAdded();
      }

      TxState.UpdateTriState labelState = state.txState().labelState(nodeId, labelId);
      if (labelState.isTouched()) {
        return labelState.isAdded();
      }
    }

    return storeLayer.nodeHasLabel(nodeId, labelId);
  }
  @Override
  public boolean nodeHasLabel(KernelStatement state, long nodeId, int labelId)
      throws EntityNotFoundException {
    if (state.hasTxStateWithChanges()) {
      if (state.txState().nodeIsDeletedInThisTx(nodeId)) {
        return false;
      }

      switch (state.txState().labelState(nodeId, labelId)) {
        case ADDED:
          return true;
        case REMOVED:
          return false;
        default: // i.e. UNTOUCHED
          if (state.txState().nodeIsAddedInThisTx(nodeId)) {
            return false;
          }
          // else fall through and return from the store layer
      }
    }

    return storeLayer.nodeHasLabel(nodeId, labelId);
  }