Skip to content

Commit

Permalink
Do not ignore @Index when checking for free-floating node
Browse files Browse the repository at this point in the history
This is currently being discussed at json-ld/json-ld.org#300
  • Loading branch information
lanthaler committed Sep 24, 2013
1 parent 8c8adab commit 2b52c8a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,9 @@ public function expand(&$element, $activectx = array(), $activeprty = null, $fra
}

// All properties have been processed. Make sure the result is valid
// and optimize object where possible
// and optimize it where possible
$numProps = count(get_object_vars($element));

// Indexes are allowed everywhere
if (property_exists($element, '@index')) {
$numProps--;
}

// Remove free-floating nodes
if ((false === $frame) && ((null === $activeprty) || ('@graph' === $activeprty)) &&
(((0 === $numProps) || property_exists($element, '@value') || property_exists($element, '@list') ||
Expand All @@ -489,6 +484,11 @@ public function expand(&$element, $activectx = array(), $activeprty = null, $fra
return;
}

// Indexes are allowed everywhere
if (property_exists($element, '@index')) {
$numProps--;
}

if (property_exists($element, '@value')) {
$numProps--; // @value
if (property_exists($element, '@language')) {
Expand Down

0 comments on commit 2b52c8a

Please sign in to comment.