getPersistenceIterator( $filter->getParameter('start'), $filter->getParameter('end') ); $resultUnitCollection = new ResultUnitCollection(); foreach ($results as $result){ $resultUnitCollection->add(new ResultUnit($this->getResource($result['subject']))); } return $resultUnitCollection; } private function getPersistenceIterator(int $start, int $end): iterable { /** @var common_persistence_Persistence $persistence */ $persistence = $this->getModel()->getPersistence(); if (!($persistence instanceof common_persistence_SqlPersistence)) { throw new core_kernel_persistence_Exception( 'Persistence implementation has to be common_persistence_SqlPersistence instance' ); } $query = 'SELECT id, subject FROM statements WHERE (id BETWEEN :start AND :end) AND predicate = :predicate AND object IN (:class) ORDER BY id'; $type['class'] = Connection::PARAM_STR_ARRAY; return new common_persistence_sql_QueryIterator( $persistence, $query, $this->getFilterArray($start, $end), $type ); } private function getFilterArray(int $start, int $end): array { return [ 'start' => $start, 'end' => $end, 'predicate' => OntologyRdf::RDF_TYPE, 'class' => array_unique($this->getTargetClasses()), ]; } }