public function parse($graph, $data, $format = 'jsonld', $baseUri = null)
    {
        parent::checkParseParams($graph, $data, $format, $baseUri);

        foreach ($data as $quad) {
            $subject = (string)$quad->getSubject();

            if ('_:' === substr($subject, 0, 2)) {
                $subject = $this->remapBnode($subject);
            }

            $predicate = (string)$quad->getProperty();

            if ($quad->getObject() instanceof IRI) {
                $object = [
                    'type' => 'uri',
                    'value' => (string)$quad->getObject()
                ];

                if ('_:' === substr($object['value'], 0, 2)) {
                    $object = [
                        'type' => 'bnode',
                        'value' => $this->remapBnode($object['value'])
                    ];
                }
            } else {
                $object = [
                    'type' => 'literal',
                    'value' => $quad->getObject()->getValue()
                ];

                if ($quad->getObject() instanceof LanguageTaggedString) {
                    $object['lang'] = $quad->getObject()->getLanguage();
                } else {
                    $object['datatype'] = $quad->getObject()->getType();
                }
            }

            $this->addTriple($subject, $predicate, $object);
        }
    }
public function parse($graph, $data, $format = 'jsonld', $baseUri = null)
    {
        parent::checkParseParams($graph, $data, $format, $baseUri);

        foreach ($data as $quad) {
            $subject = (string)$quad->getSubject();

            if ('_:' === substr($subject, 0, 2)) {
                $subject = $this->remapBnode($subject);
            }

            $predicate = (string)$quad->getProperty();

            if ($quad->getObject() instanceof IRI) {
                $object = [
                    'type' => 'uri',
                    'value' => (string)$quad->getObject()
                ];

                if ('_:' === substr($object['value'], 0, 2)) {
                    $object = [
                        'type' => 'bnode',
                        'value' => $this->remapBnode($object['value'])
                    ];
                }
            } else {
                $object = [
                    'type' => 'literal',
                    'value' => $quad->getObject()->getValue()
                ];

                if ($quad->getObject() instanceof LanguageTaggedString) {
                    $object['lang'] = $quad->getObject()->getLanguage();
                } else {
                    $object['datatype'] = $quad->getObject()->getType();
                }
            }

            $this->addTriple($subject, $predicate, $object);
        }
    }
public function parse ( $ graph , $ data , $ format = 'jsonld' , $ baseUri = null ) { parent :: checkParseParams ( $ graph , $ data , $ format , $ baseUri ) ; foreach ( $ data as $ quad ) { $ subject = ( string ) $ quad -> getSubject ( ) ; if ( '_:' === substr ( $ subject , 0 , 2 ) ) { $ subject = $ this -> remapBnode ( $ subject ) ; } $ predicate = ( string ) $ quad -> getProperty ( ) ; if ( $ quad -> getObject ( ) instanceof IRI ) { $ object = [ 'type' => 'uri' , 'value' => ( string ) $ quad -> getObject ( ) ] ; if ( '_:' === substr ( $ object [ 'value' ] , 0 , 2 ) ) { $ object = [ 'type' => 'bnode' , 'value' => $ this -> remapBnode ( $ object [ 'value' ] ) ] ; } } else { $ object = [ 'type' => 'literal' , 'value' => $ quad -> getObject ( ) -> getValue ( ) ] ; if ( $ quad -> getObject ( ) instanceof LanguageTaggedString ) { $ object [ 'lang' ] = $ quad -> getObject ( ) -> getLanguage ( ) ; } else { $ object [ 'datatype' ] = $ quad -> getObject ( ) -> getType ( ) ; } } $ this -> addTriple ( $ subject , $ predicate , $ object ) ; } }
Parse Quads as returned by JsonLD.
Parse Quads as returned by JsonLD .