protected function rdfPhpToStatementIterator(array $rdfPhp)
    {
        $statements = [];

        // go through all subjects
        foreach ($rdfPhp as $subject => $predicates) {
            // predicates associated with the subject
            foreach ($predicates as $property => $objects) {
                // object(s)
                foreach ($objects as $object) {
                    /*
                     * Create subject node
                     */
                    if (true === $this->RdfHelpers->simpleCheckURI($subject)) {
                        $s = $this->nodeFactory->createNamedNode($subject);
                    } elseif (true === $this->RdfHelpers->simpleCheckBlankNodeId($subject)) {
                        $s = $this->nodeFactory->createBlankNode($subject);
                    } else {
                        // should not be possible, because EasyRdf is able to check for invalid subjects.
                        throw new \Exception('Only URIs and blank nodes are allowed as subjects.');
                    }

                    /*
                     * Create predicate node
                     */
                    if (true === $this->RdfHelpers->simpleCheckURI($property)) {
                        $p = $this->nodeFactory->createNamedNode($property);
                    } elseif (true === $this->RdfHelpers->simpleCheckBlankNodeId($property)) {
                        $p = $this->nodeFactory->createBlankNode($property);
                    } else {
                        // should not be possible, because EasyRdf is able to check for invalid predicates.
                        throw new \Exception('Only URIs and blank nodes are allowed as predicates.');
                    }

                    /*
                     * Create object node
                     */
                    // URI
                    if ($this->RdfHelpers->simpleCheckURI($object['value'])) {
                        $o = $this->nodeFactory->createNamedNode($object['value']);

                    // datatype set
                    } elseif (isset($object['datatype'])) {
                        $o = $this->nodeFactory->createLiteral($object['value'], $object['datatype']);

                    // lang set
                    } elseif (isset($object['lang'])) {
                        $o = $this->nodeFactory->createLiteral(
                            $object['value'],
                            'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString',
                            $object['lang']
                        );
                    // if no information about the object was provided, assume its a simple string
                    } else {
                        $o = $this->nodeFactory->createLiteral($object['value']);
                    }

                    // build and add statement
                    $statements[] = $this->statementFactory->createStatement($s, $p, $o);
                }
            }
        }

        return $this->statementIteratorFactory->createStatementIteratorFromArray($statements);
    }
protected function rdfPhpToStatementIterator(array $rdfPhp)
    {
        $statements = [];

        // go through all subjects
        foreach ($rdfPhp as $subject => $predicates) {
            // predicates associated with the subject
            foreach ($predicates as $property => $objects) {
                // object(s)
                foreach ($objects as $object) {
                    /*
                     * Create subject node
                     */
                    if (true === $this->RdfHelpers->simpleCheckURI($subject)) {
                        $s = $this->nodeFactory->createNamedNode($subject);
                    } elseif (true === $this->RdfHelpers->simpleCheckBlankNodeId($subject)) {
                        $s = $this->nodeFactory->createBlankNode($subject);
                    } else {
                        // should not be possible, because EasyRdf is able to check for invalid subjects.
                        throw new \Exception('Only URIs and blank nodes are allowed as subjects.');
                    }

                    /*
                     * Create predicate node
                     */
                    if (true === $this->RdfHelpers->simpleCheckURI($property)) {
                        $p = $this->nodeFactory->createNamedNode($property);
                    } elseif (true === $this->RdfHelpers->simpleCheckBlankNodeId($property)) {
                        $p = $this->nodeFactory->createBlankNode($property);
                    } else {
                        // should not be possible, because EasyRdf is able to check for invalid predicates.
                        throw new \Exception('Only URIs and blank nodes are allowed as predicates.');
                    }

                    /*
                     * Create object node
                     */
                    // URI
                    if ($this->RdfHelpers->simpleCheckURI($object['value'])) {
                        $o = $this->nodeFactory->createNamedNode($object['value']);

                    // datatype set
                    } elseif (isset($object['datatype'])) {
                        $o = $this->nodeFactory->createLiteral($object['value'], $object['datatype']);

                    // lang set
                    } elseif (isset($object['lang'])) {
                        $o = $this->nodeFactory->createLiteral(
                            $object['value'],
                            'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString',
                            $object['lang']
                        );
                    // if no information about the object was provided, assume its a simple string
                    } else {
                        $o = $this->nodeFactory->createLiteral($object['value']);
                    }

                    // build and add statement
                    $statements[] = $this->statementFactory->createStatement($s, $p, $o);
                }
            }
        }

        return $this->statementIteratorFactory->createStatementIteratorFromArray($statements);
    }
protected function rdfPhpToStatementIterator ( array $ rdfPhp ) { $ statements = [ ] ; // go through all subjects foreach ( $ rdfPhp as $ subject => $ predicates ) { // predicates associated with the subject foreach ( $ predicates as $ property => $ objects ) { // object(s) foreach ( $ objects as $ object ) { /*
                     * Create subject node
                     */ if ( true === $ this -> RdfHelpers -> simpleCheckURI ( $ subject ) ) { $ s = $ this -> nodeFactory -> createNamedNode ( $ subject ) ; } elseif ( true === $ this -> RdfHelpers -> simpleCheckBlankNodeId ( $ subject ) ) { $ s = $ this -> nodeFactory -> createBlankNode ( $ subject ) ; } else { // should not be possible, because EasyRdf is able to check for invalid subjects. throw new \ Exception ( 'Only URIs and blank nodes are allowed as subjects.' ) ; } /*
                     * Create predicate node
                     */ if ( true === $ this -> RdfHelpers -> simpleCheckURI ( $ property ) ) { $ p = $ this -> nodeFactory -> createNamedNode ( $ property ) ; } elseif ( true === $ this -> RdfHelpers -> simpleCheckBlankNodeId ( $ property ) ) { $ p = $ this -> nodeFactory -> createBlankNode ( $ property ) ; } else { // should not be possible, because EasyRdf is able to check for invalid predicates. throw new \ Exception ( 'Only URIs and blank nodes are allowed as predicates.' ) ; } /*
                     * Create object node
                     */ // URI if ( $ this -> RdfHelpers -> simpleCheckURI ( $ object [ 'value' ] ) ) { $ o = $ this -> nodeFactory -> createNamedNode ( $ object [ 'value' ] ) ; // datatype set } elseif ( isset ( $ object [ 'datatype' ] ) ) { $ o = $ this -> nodeFactory -> createLiteral ( $ object [ 'value' ] , $ object [ 'datatype' ] ) ; // lang set } elseif ( isset ( $ object [ 'lang' ] ) ) { $ o = $ this -> nodeFactory -> createLiteral ( $ object [ 'value' ] , 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString' , $ object [ 'lang' ] ) ; // if no information about the object was provided, assume its a simple string } else { $ o = $ this -> nodeFactory -> createLiteral ( $ object [ 'value' ] ) ; } // build and add statement $ statements [ ] = $ this -> statementFactory -> createStatement ( $ s , $ p , $ o ) ; } } } return $ this -> statementIteratorFactory -> createStatementIteratorFromArray ( $ statements ) ; }
Transforms a statement array given by EasyRdf to a Saft StatementIterator instance.

@param array $rdfPhp RDF data structured as array. It structure looks like:
array(
$subject => array(
$predicate => array (
// object information
'datatype' => ...,
'lang' => ...,
'value' => ...
)
)
)

@return StatementIterator

@throws \Exception if a non-URI or non-BlankNode is used at subject position
@throws \Exception if a non-URI or non-BlankNode is used at predicate position
Transforms a statement array given by EasyRdf to a Saft StatementIterator instance .