protected function EasyRdf_Parser_Json::parseJsonTriples in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Json.php \EasyRdf_Parser_Json::parseJsonTriples()
Parse the triple-centric JSON format, as output by libraptor
http://librdf.org/raptor/api/serializer-json.html
@ignore
1 call to EasyRdf_Parser_Json::parseJsonTriples()
- EasyRdf_Parser_Json::parse in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Json.php - Parse RDF/JSON into an EasyRdf_Graph
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Json.php, line 98
Class
- EasyRdf_Parser_Json
- A pure-php class to parse RDF/JSON with no dependancies.
Code
protected function parseJsonTriples($data, $baseUri) {
foreach ($data['triples'] as $triple) {
if ($triple['subject']['type'] == 'bnode') {
$subject = $this
->remapBnode($triple['subject']['value']);
}
else {
$subject = $triple['subject']['value'];
}
$predicate = $triple['predicate']['value'];
if ($triple['object']['type'] == 'bnode') {
$object = array(
'type' => 'bnode',
'value' => $this
->remapBnode($triple['object']['value']),
);
}
else {
$object = $triple['object'];
}
$this
->addTriple($subject, $predicate, $object);
}
return $this->tripleCount;
}