Sort subjects and properties in toRDF.

This commit is contained in:
Dave Longley 2013-06-06 22:12:49 -04:00
parent 5be8e20433
commit f775f8ceda

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* PHP implementation of the JSON-LD API. * PHP implementation of the JSON-LD API.
* Version: 0.0.34 * Version: 0.0.35
* *
* @author Dave Longley * @author Dave Longley
* *
@ -2943,8 +2943,14 @@ class JsonLdProcessor {
protected function _graphToRDF($graph, $namer) { protected function _graphToRDF($graph, $namer) {
$rval = array(); $rval = array();
foreach($graph as $id => $node) { $ids = array_keys((array)$graph);
foreach($node as $property => $items) { sort($ids);
foreach($ids as $id) {
$node = $graph->{$id};
$properties = array_keys((array)$node);
sort($properties);
foreach($properties as $property) {
$items = $node->{$property};
if($property === '@type') { if($property === '@type') {
$property = self::RDF_TYPE; $property = self::RDF_TYPE;
} }