public function compile()
    {
        if (strlen($this->_csdl) == 0) {
            throw new DataSift_Exception_InvalidData('Cannot compile an empty definition.');
        }

        try {
            $res = $this->_user->post('compile', array('csdl' => $this->_csdl));
            if (isset($res['hash'])) {
                $this->_hash = $res['hash'];
            } else {
                throw new DataSift_Exception_CompileFailed('Compiled successfully but no hash in the response');
            }

            if (isset($res['created_at'])) {
                $this->_created_at = strtotime($res['created_at']);
            } else {
                throw new DataSift_Exception_CompileFailed('Compiled successfully but no created_at in the response');
            }

            if (isset($res['dpu'])) {
                $this->_total_dpu = $res['dpu'];
            } else {
                throw new DataSift_Exception_CompileFailed('Compiled successfully but no DPU in the response');
            }
        } catch (DataSift_Exception_APIError $e) {
            // Reset the hash
            $this->clearHash();

            switch ($e->getCode()) {
                case 400:
                    // Compilation failed, we should have an error message
                    throw new DataSift_Exception_CompileFailed($e->getMessage());
                    break;
                default:
                    throw new DataSift_Exception_CompileFailed(
                        'Unexpected APIError code: ' . $e->getCode() . ' [' . $e->getMessage() . ']'
                    );
            }
        }
    }