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

        $tupleInformaton = null;
        $tupleType = null;

        /*
         * Use triple pattern
         */
        if (true === isset($queryParts['triple_pattern'])) {
            $tupleInformation = $queryParts['triple_pattern'];
            $tupleType = 'triple';

        /*
         * Use quad pattern
         */
        } elseif (true === isset($queryParts['quad_pattern'])) {
            $tupleInformation = $queryParts['quad_pattern'];
            $tupleType = 'quad';

        /*
         * Neither triple nor quad information
         */
        } else {
            throw new \Exception(
                'Neither triple nor quad information available in given query object: '.$queryObject->getQuery()
            );
        }

        if (1 > count($tupleInformation)) {
            throw new \Exception('Query contains more than one triple- respectivly quad pattern.');
        }

        /*
         * Triple
         */
        if ('triple' == $tupleType) {
            $subject = $this->createNodeByValueAndType($tupleInformation[0]['s'], $tupleInformation[0]['s_type']);
            $predicate = $this->createNodeByValueAndType($tupleInformation[0]['p'], $tupleInformation[0]['p_type']);
            $object = $this->createNodeByValueAndType($tupleInformation[0]['o'], $tupleInformation[0]['o_type']);
            $graph = null;

        /*
         * Quad
         */
        } elseif ('quad' == $tupleType) {
            $subject = $this->createNodeByValueAndType($tupleInformation[0]['s'], $tupleInformation[0]['s_type']);
            $predicate = $this->createNodeByValueAndType($tupleInformation[0]['p'], $tupleInformation[0]['p_type']);
            $object = $this->createNodeByValueAndType($tupleInformation[0]['o'], $tupleInformation[0]['o_type']);
            $graph = $this->createNodeByValueAndType($tupleInformation[0]['g'], 'uri');
        }

        // no else neccessary, because otherwise the upper exception would be thrown if tupleType is neither
        // quad or triple.

        return $this->statementFactory->createStatement($subject, $predicate, $object, $graph);
    }
protected function getStatement(Query $queryObject)
    {
        $queryParts = $queryObject->getQueryParts();

        $tupleInformaton = null;
        $tupleType = null;

        /*
         * Use triple pattern
         */
        if (true === isset($queryParts['triple_pattern'])) {
            $tupleInformation = $queryParts['triple_pattern'];
            $tupleType = 'triple';

        /*
         * Use quad pattern
         */
        } elseif (true === isset($queryParts['quad_pattern'])) {
            $tupleInformation = $queryParts['quad_pattern'];
            $tupleType = 'quad';

        /*
         * Neither triple nor quad information
         */
        } else {
            throw new \Exception(
                'Neither triple nor quad information available in given query object: '.$queryObject->getQuery()
            );
        }

        if (1 > count($tupleInformation)) {
            throw new \Exception('Query contains more than one triple- respectivly quad pattern.');
        }

        /*
         * Triple
         */
        if ('triple' == $tupleType) {
            $subject = $this->createNodeByValueAndType($tupleInformation[0]['s'], $tupleInformation[0]['s_type']);
            $predicate = $this->createNodeByValueAndType($tupleInformation[0]['p'], $tupleInformation[0]['p_type']);
            $object = $this->createNodeByValueAndType($tupleInformation[0]['o'], $tupleInformation[0]['o_type']);
            $graph = null;

        /*
         * Quad
         */
        } elseif ('quad' == $tupleType) {
            $subject = $this->createNodeByValueAndType($tupleInformation[0]['s'], $tupleInformation[0]['s_type']);
            $predicate = $this->createNodeByValueAndType($tupleInformation[0]['p'], $tupleInformation[0]['p_type']);
            $object = $this->createNodeByValueAndType($tupleInformation[0]['o'], $tupleInformation[0]['o_type']);
            $graph = $this->createNodeByValueAndType($tupleInformation[0]['g'], 'uri');
        }

        // no else neccessary, because otherwise the upper exception would be thrown if tupleType is neither
        // quad or triple.

        return $this->statementFactory->createStatement($subject, $predicate, $object, $graph);
    }
protected function getStatement ( Query $ queryObject ) { $ queryParts = $ queryObject -> getQueryParts ( ) ; $ tupleInformaton = null ; $ tupleType = null ; /*
         * Use triple pattern
         */ if ( true === isset ( $ queryParts [ 'triple_pattern' ] ) ) { $ tupleInformation = $ queryParts [ 'triple_pattern' ] ; $ tupleType = 'triple' ; /*
         * Use quad pattern
         */ } elseif ( true === isset ( $ queryParts [ 'quad_pattern' ] ) ) { $ tupleInformation = $ queryParts [ 'quad_pattern' ] ; $ tupleType = 'quad' ; /*
         * Neither triple nor quad information
         */ } else { throw new \ Exception ( 'Neither triple nor quad information available in given query object: ' . $ queryObject -> getQuery ( ) ) ; } if ( 1 > count ( $ tupleInformation ) ) { throw new \ Exception ( 'Query contains more than one triple- respectivly quad pattern.' ) ; } /*
         * Triple
         */ if ( 'triple' == $ tupleType ) { $ subject = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 's' ] , $ tupleInformation [ 0 ] [ 's_type' ] ) ; $ predicate = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 'p' ] , $ tupleInformation [ 0 ] [ 'p_type' ] ) ; $ object = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 'o' ] , $ tupleInformation [ 0 ] [ 'o_type' ] ) ; $ graph = null ; /*
         * Quad
         */ } elseif ( 'quad' == $ tupleType ) { $ subject = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 's' ] , $ tupleInformation [ 0 ] [ 's_type' ] ) ; $ predicate = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 'p' ] , $ tupleInformation [ 0 ] [ 'p_type' ] ) ; $ object = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 'o' ] , $ tupleInformation [ 0 ] [ 'o_type' ] ) ; $ graph = $ this -> createNodeByValueAndType ( $ tupleInformation [ 0 ] [ 'g' ] , 'uri' ) ; } // no else neccessary, because otherwise the upper exception would be thrown if tupleType is neither // quad or triple. return $ this -> statementFactory -> createStatement ( $ subject , $ predicate , $ object , $ graph ) ; }
Create Statement instance based on a given Query instance.

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

@return Statement statement object itself

@throws \Exception if query contains more than one triple pattern
@throws \Exception if more than one graph was found

@api

@since 0.1
Create Statement instance based on a given Query instance .