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);
    }
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);
    }
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 ) ; }
Create statements from query.

@param Query $queryObject query object which represents a SPARQL query

@return StatementIterator StatementIterator object

@throws \Exception if query contains quads and triples at the same time
@throws \Exception if query contains neither quads nor triples

@api

@since 0.1
Create statements from query .