protected function getStatements(Query $queryObject)
    {
        $queryParts = $queryObject->getQueryParts();

        $statementArray = [];

        // if only triples, but no quads
        if (true === isset($queryParts['triple_pattern'])
            && false === isset($queryParts['quad_pattern'])) {
            foreach ($queryParts['triple_pattern'] as $pattern) {
                /**
                 * Create Node instances for S, P and O to build a Statement instance later on.
                 */
                $s = $this->createNodeByValueAndType($pattern['s'], $pattern['s_type']);
                $p = $this->createNodeByValueAndType($pattern['p'], $pattern['p_type']);
                $o = $this->createNodeByValueAndType($pattern['o'], $pattern['o_type']);
                $g = null;

                $statementArray[] = $this->statementFactory->createStatement($s, $p, $o, $g);
            }

            // if only quads, but not triples
        } elseif (false === isset($queryParts['triple_pattern'])
            && true === isset($queryParts['quad_pattern'])) {
            foreach ($queryParts['quad_pattern'] as $pattern) {
                /**
                 * Create Node instances for S, P and O to build a Statement instance later on.
                 */
                $s = $this->createNodeByValueAndType($pattern['s'], $pattern['s_type']);
                $p = $this->createNodeByValueAndType($pattern['p'], $pattern['p_type']);
                $o = $this->createNodeByValueAndType($pattern['o'], $pattern['o_type']);
                $g = $this->createNodeByValueAndType($pattern['g'], $pattern['g_type']);

                $statementArray[] = $this->statementFactory->createStatement($s, $p, $o, $g);
            }

            // found quads and triples
        } elseif (true === isset($queryParts['triple_pattern'])
            && true === isset($queryParts['quad_pattern'])) {
            throw new \Exception('Query contains quads and triples. That is not supported yet.');
        // neither quads nor triples
        } else {
            throw new \Exception('Query contains neither quads nor triples.');
        }

        return $this->statementIteratorFactory->createStatementIteratorFromArray($statementArray);
    }