From de770b30fd63b7034c3e268cca643078cbb52603 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Sun, 4 Mar 2012 15:35:44 -0500 Subject: [PATCH] Sort all properties except @id in normalization. --- jsonld.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/jsonld.php b/jsonld.php index 4348aae..d610e8e 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1950,16 +1950,13 @@ class JsonLdProcessor // sort property lists that now have canonically-named bnodes foreach($edges->props as $key => $value) { - if(count($value->bnodes) > 0) + $subject = $subjects->$key; + foreach($subject as $p => $v) { - $bnode = $subjects->$key; - foreach($bnode as $p => $v) + if(strpos($p, '@id') !== 0 and is_array($v)) { - if(strpos($p, '@') !== 0 and is_array($v)) - { - usort($v, '_compareObjects'); - $bnode->$p = $v; - } + usort($v, '_compareObjects'); + $subject->$p = $v; } } }