From f775f8cedab3e449da5f475ec2361d2332cb0f2f Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Thu, 6 Jun 2013 22:12:49 -0400 Subject: [PATCH] Sort subjects and properties in toRDF. --- jsonld.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jsonld.php b/jsonld.php index ee2bfde..d07f780 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1,7 +1,7 @@ $node) { - foreach($node as $property => $items) { + $ids = array_keys((array)$graph); + 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') { $property = self::RDF_TYPE; }