def _setup(self, query):
        """ Setup for processing `query`. """
        if query.vnames is not None:
            bad = []
            metadata = self.simulation_info['variable_metadata']
            expressions = self.simulation_info['expressions']
            for name in query.vnames:
                if name not in metadata and name not in [ e['pcomp_name'] for e in expressions.values()] and name not in self.metadata_names:
                    bad.append(name)
            if bad:
                raise RuntimeError('Names not found in the dataset: %s' % bad)

        self._drivers = {}
        self._driver_id = None
        self._driver_name = None
        for driver_info in self._reader.drivers():
            _id = driver_info['_id']
            name = driver_info['name']
            prefix, _, name = name.rpartition('.')
            if prefix:
                prefix += '.'
            driver_info['prefix'] = prefix
            self._drivers[driver_info['name'] ] = driver_info
            if ( driver_info['name'] ) == query.driver_name:
                self._driver_name = query.driver_name
                #self._driver_id = _id

        # self._drivers = {}
        # self._driver_id = None
        # for driver_info in self._reader.drivers():
        #     _id = driver_info['_id']
        #     name = driver_info['name']
        #     prefix, _, name = name.rpartition('.')
        #     if prefix:
        #         prefix += '.'
        #     driver_info['prefix'] = prefix
        #     self._drivers[_id] = driver_info
        #     if driver_info['name'] == query.driver_name:
        #         self._driver_id = _id

        if query.driver_name:
            #if self._driver_id is None:
            if self._driver_name is None:
                raise ValueError('No driver named %r' % query.driver_name)

        self._case_ids = None
        self._query_id = None
        self._parent_id = None
        #if query.case_id is not None:
            #self._query_id = query.case_id
            #self._case_ids = set((self._query_id,))
            ##self._driver_id = None  # Case specified, ignore driver.
            #self._driver_name = None  # Case specified, ignore driver.
        if query.case_itername is not None:
            self._query_itername = query.case_itername
            self._case_iternames = set((self._query_itername,))
            #self._driver_id = None  # Case specified, ignore driver.
            self._driver_name = None  # Case specified, ignore driver.


        #elif query.parent_id is not None: # TODO - fix this
        elif query.parent_itername is not None: # TODO - fix this
            self._parent_itername = query.parent_itername
            self._case_iternames = set((self._parent_itername,))
            parent_itername_parts = self._parent_itername.split('-')
            for case_data in self._reader.cases():
                itername = case_data['metadata']['_itername']
                itername_parts = itername.split('-')
                if len(parent_itername_parts) + 1 == len(itername_parts) and itername_parts[:-1] == parent_itername_parts:
                    self._case_iternames.add(itername)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/casehandlers/query_hdf5.py/CaseDatasetHDF5._setup/original